Rate this page:

Messenger

Methods

createConversation

Copy URL
createConversation(conversationConfig: 

ConversationConfig

):

Promise<MessengerEventTypes.CreateConversation,MessengerEventTypes.Error>

Creates a new conversation with the extended configuration.Other parties of the conversation (online participants and logged in clients) can be informed about the conversation creation via the MessengerEventTypes.CreateConversation.

Parameters

  • conversationConfig:

    ConversationConfig

    Optional

    ConversationConfig instance with extended conversation parameters

editUser

Copy URL
editUser(customData: 

object

,
privateCustomData:

object

):

Promise<MessengerEventTypes.EditUser,MessengerEventTypes.Error>

Edits the current user information.Other users that are subscribed to the user can be informed about the editing via the MessengerEventTypes.EditUser event.

Parameters

  • customData:

    object

    Optional

    New custom data. If null, previously set custom data is not to be changed. If empty object, previously set custom data is removed.

  • privateCustomData:

    object

    Optional

    New private custom data. If null, previously set private custom data is not to be changed. If empty object, previously set private custom data is removed.

getConversation

Copy URL
getConversation(uuid: 

string

):

Promise<MessengerEventTypes.GetConversation,MessengerEventTypes.Error>

Gets a conversation by its UUID.It is possible if:

  • the user that calls the method is/has been a participant of this conversation
  • the conversation is an available public conversation (see Messenger.getPublicConversations)

Only the client that called the method can be informed about getting conversation.

Parameters

  • uuid:

    string

    Conversation UUID

getConversations

Copy URL
getConversations(uuids: 

string[]

):

Promise<MessengerEventTypes.GetConversation[],MessengerEventTypes.Error>

Gets the multiple conversations by the list of UUIDs. Maximum 30 conversations.It is possible if:

  • the user that calls the method is/has been a participant of this conversation
  • the conversation is an available public conversation (see [Messenger#getPublicConversations])

Only the client that called the method can be informed about getting conversations.

Parameters

  • uuids:

    string[]

    Array of UUIDs. Maximum 30 conversations.

getMe

Copy URL
getMe(): 

string

|

null

Gets the full Voximplant user identifier, for example 'username@appname.accname', for the current user.

Returns

  • type:

    string

  • type:

    null

getPublicConversations

Copy URL
getPublicConversations(): 

Promise<MessengerEventTypes.GetPublicConversations,MessengerEventTypes.Error>

Gets all public conversations (Conversation.publicJoin is true).It is possible to get all public conversations (UUIDs) that have been created by:

  • the current user
  • other users of the same child account
  • users of the main Voximplant developer account

Only the client that called the method can be informed about getting public conversations UUIDs.

getSubscriptions

Copy URL
getSubscriptions(): 

Promise<MessengerEventTypes.GetSubscriptions,MessengerEventTypes.Error>

Gets all current subscriptions, i.e., the array of users the current user is subscribed to.Only the client that called the method can be informed about getting subscriptions.

getUserByIMId

Copy URL
getUserByIMId(userId: 

number

):

Promise<MessengerEventTypes.GetUser,MessengerEventTypes.Error>

Gets information for the user specified by the IM user id.It is possible to get any user of the main Voximplant developer account or its child accounts.

Only the client that called the method can be informed about getting user information.

Parameters

  • userId:

    number

    IM User id

getUserByName

Copy URL
getUserByName(username: 

string

):

Promise<MessengerEventTypes.GetUser,MessengerEventTypes.Error>

Gets information for the user specified by the Voximplant user name, e.g., 'username@appname.accname'.It is possible to get any user of the main Voximplant developer account or its child accounts.

Only the client that called the method can be informed about getting user information.

Parameters

  • username:

    string

    Voximplant user identifier

getUsersByIMId

Copy URL
getUsersByIMId(users: 

number[]

):

Promise<MessengerEventTypes.GetUser[],MessengerEventTypes.Error>

Gets information for the users specified by the array of the IM user ids. Maximum 50 users.It is possible to get any users of the main Voximplant developer account or its child accounts.

Only the client that called the method can be informed about getting users information.

Parameters

  • users:

    number[]

    Array of IM user ids

getUsersByName

Copy URL
getUsersByName(users: 

string[]

):

Promise<MessengerEventTypes.GetUser[],MessengerEventTypes.Error>

Gets information for the users specified by the array of the Voximplant user names. Maximum 50 users.It is possible to get any users of the main Voximplant developer account or its child accounts.

Only the client that called the method can be informed about getting users information.

Parameters

  • users:

    string[]

    Array of Voximplant user identifiers

joinConversation

Copy URL
joinConversation(uuid: 

string

):

Promise<MessengerEventTypes.EditConversation,MessengerEventTypes.Error>

Joins the current user to any conversation specified by the UUID.It is possible only on the following conditions:

  • a conversation is created by a user of the main Voximplant developer account or its child accounts
  • public join is enabled (Conversation.publicJoin is true)
  • the conversation is not a direct one (Conversation.direct is false)

Other parties of the conversation (online participants and logged in clients) can be informed about joining to the conversation via the MessengerEventTypes.EditConversation event.

Parameters

  • uuid:

    string

    Conversation UUID

leaveConversation

Copy URL
leaveConversation(uuid: 

string

):

Promise<MessengerEventTypes.EditConversation,MessengerEventTypes.Error>

Makes the current user leave a conversation specified by the UUID.It is possible only if the conversation is not a direct one (Conversation.direct is false).

After a successful method call the conversation's UUID is added to User.leaveConversationList.

Other parties of the conversation (online participants and logged in clients) can be informed about leaving the conversation via the MessengerEventTypes.EditConversation event.

Parameters

  • uuid:

    string

    Conversation UUID

managePushNotifications

Copy URL
managePushNotifications(notifications: 

MessengerNotification[]

):

Promise<MessengerEventTypes.EditUser,MessengerEventTypes.Error>

Manages messenger push notification subscriptions for the current user.Other logged in clients (of the current user) can be informed about managing push notifications via MessengerEventTypes.EditUser

Parameters

off

Copy URL
off(eventType: 

MessengerEventTypes

,
event:

Function

):

void

Removes a handler for specified event.

Parameters

  • event:

    Function

    Optional

    Handler function. If not specified, all handlers for the event type are removed.

Returns

  • type:

    void

on

Copy URL
on(eventType: 

MessengerEventTypes

,
event:

Function

):

void

Registers a handler for specified messenger event. Use Messenger.off method to delete a handler.

Parameters

Returns

  • type:

    void

setStatus

Copy URL
setStatus(online: 

boolean

):

Promise<MessengerEventTypes.SetStatus,MessengerEventTypes.Error>

Sets the current user status.Other users (that are subscribed to the user) and other clients (of the current user) can be informed about the status changing via the MessengerEventTypes.SetStatus event.

Parameters

  • online:

    boolean

    Whether the user is available for messaging

subscribe

Copy URL
subscribe(users: 

number[]

):

Promise<MessengerEventTypes.Subscribe,MessengerEventTypes.Error>

Subscribes for other user(s) information and status changes.It is possible to subscribe for any user of the main Voximplant developer account or its child accounts.

Other logged in clients (of the current user) can be informed about the subscription via the MessengerEventTypes.Subscribe event.

User(s) specified in the 'users' parameter are not informed about the subscription.

Parameters

  • users:

    number[]

    Array of IM user ids

unsubscribe

Copy URL
unsubscribe(users: 

number[]

):

Promise<MessengerEventTypes.Unsubscribe,MessengerEventTypes.Error>

Unsubscribes from other user(s) information and status changes.Other logged in clients (of the current user) can be informed about the unsubscription via the MessengerEventTypes.Unsubscribe event.

User(s) specified in the 'users' parameter are not informed about the unsubscription.

Parameters

  • users:

    number[]

    Array of IM user ids

unsubscribeFromAll

Copy URL
unsubscribeFromAll(): 

Promise<MessengerEventTypes.Unsubscribe,MessengerEventTypes.Error>

Unsubscribes from all subscriptions.Other logged in clients (of the current user) can be informed about the unsubscription via the MessengerEventTypes.Unsubscribe event.

Other users are not informed about the unsubscription.