Rate this page:

Messenger

This API is in beta and subject to change.

Interface that controls messaging functions.

Methods

addMessengerListener

Copy URL
fun addMessengerListener(listener: 

MessengerListener

):

Unit

This API is in beta and subject to change.

Adds MessengerListener to handle messenger events.

Parameters

Returns

  • type:

    Unit

removeMessengerListener

Copy URL
fun removeMessengerListener(listener: 

MessengerListener

):

Unit

This API is in beta and subject to change.

Removes a previously added MessengerListener.

Parameters

Returns

  • type:

    Unit

getUser

Copy URL
fun getUser(imId: 

Long

,
callback:

MessengerCallback<UserEvent>?

):

Unit

This API is in beta and subject to change.

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.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onGetUser and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

getUsersByUsernames

Copy URL
fun getUsersByUsernames(usernames: 

List<String>

,
callback:

MessengerCallback<List<UserEvent>>?

):

Unit

This API is in beta and subject to change.

Gets information for the users specified by the list 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.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly. The result is a list with as many user events as the specified number of user names is.
  2. Implement the MessengerListener.onGetUser and MessengerListener.onError events. The event with a result is invoked as many times as the specified number of user names is; the error event is called once only.

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

Parameters

  • usernames:

    List<String>

    The list of Voximplant usernames, e.g., username@appname.accname

  • callback:

    MessengerCallback<List<UserEvent>>?

    Optional

    Callback to be called when the function completes

Returns

  • type:

    Unit

getUsersByImId

Copy URL
fun getUsersByImId(imIds: 

List<Long>

,
callback:

MessengerCallback<List<UserEvent>>?

):

Unit

This API is in beta and subject to change.

Gets information for the users specified by the list 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.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly. The result is a list with as many user events as the specified number of IM user IDs is.
  2. Implement the MessengerListener.onGetUser and MessengerListener.onError events. The event with a result is invoked as many times as the specified number of IM user ids is; the error event is called once only.

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

Parameters

  • imIds:

    List<Long>

    The list of IM user ids

  • callback:

    MessengerCallback<List<UserEvent>>?

    Optional

    Callback to be called when the function completes

Returns

  • type:

    Unit

editUser

Copy URL
fun editUser(customData: 

Map<String, Any>?

,
privateCustomData:

Map<String, Any>?

,
callback:

MessengerCallback<UserEvent>?

):

Unit

This API is in beta and subject to change.

Edits the current user information.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onEditUser and MessengerListener.onError events.

Other users that are subscribed to the user can be informed about the editing via the MessengerListener.onEditUser event.

Parameters

  • customData:

    Map<String, Any>?

    Optional

    A new custom data. If null, previously set custom data is not changed. If empty map, previously set custom data is removed

  • privateCustomData:

    Map<String, Any>?

    Optional

    A new private custom data. If null, previously set private custom data is not changed. If empty map, previously set private custom data is removed

  • Optional

    Callback to be called when the function completes

Returns

  • type:

    Unit

subscribe

Copy URL
fun subscribe(imIds: 

List<Long>

,
callback:

MessengerCallback<SubscriptionEvent>?

):

Unit

This API is in beta and subject to change.

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.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onSubscribe and MessengerListener.onError events.

Other logged in clients (of the current user) can be informed about the subscription via the MessengerListener.onSubscribe event. User(s) specified in the 'users' parameter are not informed about the subscription.

Parameters

Returns

  • type:

    Unit

unsubscribe

Copy URL
fun unsubscribe(imIds: 

List<Long>

,
callback:

MessengerCallback<SubscriptionEvent>?

):

Unit

This API is in beta and subject to change.

Unsubscribes from other user(s) information and status changes.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onUnsubscribe and MessengerListener.onError events.

Other logged in clients (of the current user) can be informed about the unsubscription via the MessengerListener.onUnsubscribe event. User(s) specified in the 'users' parameter are not informed about the unsubscription.

Parameters

Returns

  • type:

    Unit

unsubscribeFromAll

Copy URL
fun unsubscribeFromAll(callback: 

MessengerCallback<SubscriptionEvent>?

):

Unit

This API is in beta and subject to change.

Unsubscribes from all subscriptions.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onUnsubscribe and MessengerListener.onError events.

Other logged in clients (of the current user) can be informed about the unsubscription via the MessengerListener.onUnsubscribe event. Other users are not informed about the unsubscription.

Parameters

Returns

  • type:

    Unit

getSubscriptionList

Copy URL
fun getSubscriptionList(callback: 

MessengerCallback<SubscriptionEvent>?

):

Unit

This API is in beta and subject to change.

Gets all current subscriptions, i.e., the list of users the current user is subscribed to.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onGetSubscriptionList and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

setStatus

Copy URL
fun setStatus(online: 

Boolean

,
callback:

MessengerCallback<StatusEvent>?

):

Unit

This API is in beta and subject to change.

Sets the current user status.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with StatusEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onSetStatus and MessengerListener.onError events.

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

Parameters

  • online:

    Boolean

    Whether the user is available for messaging

  • Optional

    Callback to be called when the function completes

Returns

  • type:

    Unit

createConversation

Copy URL
fun createConversation(conversationConfig: 

ConversationConfig

,
callback:

MessengerCallback<ConversationEvent>?

):

Unit

This API is in beta and subject to change.

Creates a new conversation with the extended configuration.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onCreateConversation and MessengerListener.onError events.

Other parties of the conversation (online participants and logged in clients) can be informed about the conversation creation via the MessengerListener.onCreateConversation event.

Parameters

Returns

  • type:

    Unit

getConversation

Copy URL
fun getConversation(uuid: 

String

,
callback:

MessengerCallback<ConversationEvent>?

):

Unit

This API is in beta and subject to change.

Gets a conversation by its UUID.

It is possible if:

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

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onGetConversation and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

getConversations

Copy URL
fun getConversations(uuids: 

List<String>

,
callback:

MessengerCallback<List<ConversationEvent>>?

):

Unit

This API is in beta and subject to change.

Gets the multiple conversations by the list of UUIDs. Maximum 30 conversations.

It is possible if:

  • the user that calls the method is a participant of these conversations
  • the conversations are the available public conversations (see Messenger.getPublicConversations)

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly. The result is a list with as many conversations events as the specified number of conversations UUIDs is.
  2. Implement the MessengerListener.onGetConversation and MessengerListener.onError events. The event with a result is invoked as many times as the specified number of conversations UUIDs is; the error event is be called once only.

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

Parameters

  • uuids:

    List<String>

    The list of conversation UUIDs. Maximum 30 conversations

  • Optional

    Callback to be called when the function completes

Returns

  • type:

    Unit

getPublicConversations

Copy URL
fun getPublicConversations(callback: 

MessengerCallback<ConversationListEvent>?

):

Unit

This API is in beta and subject to change.

Gets all public conversations (Conversation.isPublicJoin is true).

It is possible to get all public conversations (UUIDs) that are created by:

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

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationListEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onGetPublicConversations and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

joinConversation

Copy URL
fun joinConversation(uuid: 

String

,
callback:

MessengerCallback<ConversationEvent>?

):

Unit

This API is in beta and subject to change.

Joins to any conversation specified by the UUID.

It is possible only on the following conditions:

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onEditConversation and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

leaveConversation

Copy URL
fun leaveConversation(uuid: 

String

,
callback:

MessengerCallback<ConversationEvent>?

):

Unit

This API is in beta and subject to change.

Makes the current user to leave a conversation specified by the UUID.

It is possible only if the conversation is not a direct one (Conversation.isDirect is false)

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

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onEditConversation and MessengerListener.onError events.

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

Parameters

Returns

  • type:

    Unit

recreateConversation

Copy URL
fun recreateConversation(config: 

ConversationConfig

,
uuid:

String

,
sequence:

Long

,
lastUpdate:

Long

,
createdAt:

Long

):

Conversation?

This API is in beta and subject to change.

Recreates a conversation.

Note that this method does not create a conversation, but restore a previously created conversation from a local storage (database).

Parameters

  • The conversation config

  • uuid:

    String

    The conversation UUID

  • sequence:

    Long

    The sequence of the last event stored in a local storage (database)

  • lastUpdate:

    Long

    The UNIX timestamp that specifies the time of the last event stored in a local storage (database).

  • createdAt:

    Long

    The UNIX timestamp that specifies the time of the conversation creation

Returns

recreateMessage

Copy URL
fun recreateMessage(messageUuid: 

String

,
conversationUuid:

String

,
text:

String?

,
payload:

List<Map<String, Any>>?

,
sequence:

Long

):

Message?

This API is in beta and subject to change.

Recreates a message.

Note that this method does not create a message, but restore a previously created message from a local storage (database).

Parameters

  • messageUuid:

    String

    The Message UUID

  • conversationUuid:

    String

    The Conversation UUID this message belongs to

  • text:

    String?

    Optional

    The text of this message

  • payload:

    List<Map<String, Any>>?

    Optional

    The list of payload objects associated with the message

  • sequence:

    Long

    The Message sequence number

Returns

managePushNotifications

Copy URL
fun managePushNotifications(notifications: 

List<MessengerNotification>

,
callback:

MessengerCallback<UserEvent>?

):

Unit

This API is in beta and subject to change.

Manages messenger push notification subscriptions for the current user.

To get the method call result use one of the following options:

  1. Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
  2. Implement the MessengerListener.onEditUser and MessengerListener.onError events.

Other logged in clients (of the current user) can be informed about managing push notifications via MessengerListener.onEditUser.

Parameters

Returns

  • type:

    Unit

getInstance

Copy URL
@JvmStatic
fun getInstance():

Messenger

This API is in beta and subject to change.

Returns

Props

me

Copy URL
val me: 

String?

This API is in beta and subject to change.

The Voximplant username for the current user, e.g., username@appname.accname. Null if the client is not logged in.

Returns

  • type:

    String?