Messenger
Interface that controls messaging functions.
Methods
addMessengerListener
fun addMessengerListener(listener: ): Unit
Adds MessengerListener to handle messenger events.
Parameters
- listener:- MessengerListener listener 
Returns
- type:- Unit 
removeMessengerListener
fun removeMessengerListener(listener: ): Unit
Removes a previously added MessengerListener.
Parameters
- listener:- MessengerListener listener 
Returns
- type:- Unit 
getUser
fun getUser(imId: Long
, callback: ): Unit
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:
- Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
- Implement the MessengerListener.onGetUser and MessengerListener.onError events.
Only the client that called the method can be informed about getting user information.
Parameters
- imId:- Long - The IM user id 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
getUsers
@JvmNamefun getUsers(imIds: List<Long>
, callback: MessengerCallback<List<UserEvent>>?
): Unit
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:
- 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.
- 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
fun editUser(customData: Map<String, Any>?
, privateCustomData: Map<String, Any>?
, callback: ): Unit
Edits the current user information.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
- 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 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
subscribe
fun subscribe(imIds: List<Long>
, callback: ): Unit
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:
- Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
- 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
- imIds:- List<Long> - The list of IM user ids 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
unsubscribe
fun unsubscribe(imIds: List<Long>
, callback: ): Unit
Unsubscribes from other user(s) information and status changes.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
- 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
- imIds:- List<Long> - A list of IM user ids 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
unsubscribeFromAll
fun unsubscribeFromAll(callback: ): Unit
Unsubscribes from all subscriptions.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
- 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
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
getSubscriptionList
fun getSubscriptionList(callback: ): Unit
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:
- Specify the callback parameter to consume the results with SubscriptionEvent or ErrorEvent in case of success/error accordingly.
- Implement the MessengerListener.onGetSubscriptionList and MessengerListener.onError events.
Only the client that called the method can be informed about getting subscriptions.
Parameters
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
setStatus
fun setStatus(online: Boolean
, callback: ): Unit
Sets the current user status.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with StatusEvent or ErrorEvent in case of success/error accordingly.
- 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 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
createConversation
fun createConversation(conversationConfig: , callback: ): Unit
Creates a new conversation with the extended configuration.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
- 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
- conversationConfig:- The ConversationConfig instance with extended conversation parameters 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
getConversation
fun getConversation(uuid: String
, callback: ): Unit
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:
- Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
- Implement the MessengerListener.onGetConversation and MessengerListener.onError events.
Only the client that called the method can be informed about getting conversation.
Parameters
- uuid:- String - The conversation UUID 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
getConversations
fun getConversations(uuids: List<String>
, callback: MessengerCallback<List<ConversationEvent>>?
): Unit
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:
- 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.
- 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 
- callback:- MessengerCallback<List<ConversationEvent>>? Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
getPublicConversations
fun getPublicConversations(callback: ): Unit
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:
- Specify the callback parameter to consume the results with ConversationListEvent or ErrorEvent in case of success/error accordingly.
- Implement the MessengerListener.onGetPublicConversations and MessengerListener.onError events.
Only the client that called the method can be informed about getting public conversations UUIDs.
Parameters
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
joinConversation
fun joinConversation(uuid: String
, callback: ): Unit
Joins 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.isPublicJoin is true)
- the conversation is not a direct one (Conversation.isDirect is false)
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
- 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
- uuid:- String - The conversation UUID 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
leaveConversation
fun leaveConversation(uuid: String
, callback: ): Unit
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:
- Specify the callback parameter to consume the results with ConversationEvent or ErrorEvent in case of success/error accordingly.
- 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
- uuid:- String - The conversation UUID 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
managePushNotifications
fun managePushNotifications(notifications: List<MessengerNotification>
, callback: ): Unit
Manages messenger push notification subscriptions for the current user.
To get the method call result use one of the following options:
- Specify the callback parameter to consume the results with UserEvent or ErrorEvent in case of success/error accordingly.
- 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
- notifications:- List<MessengerNotification> - The list of MessengerNotification 
- callback:Optional- Callback to be called when the function completes 
Returns
- type:- Unit 
recreateConversation
fun recreateConversation(config: , uuid: String
, sequence: Long
, lastUpdate: Long
, createdAt: Long
): Recreates a conversation.
Note that this method does not create a conversation, but restore a previously created conversation from a local storage (database).
Parameters
- config:- 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
- type:
recreateMessage
fun recreateMessage(uuid: String
, conversationUuid: String
, payload: List<Map<String, Any>>
, sequence: Long
): Recreates a message.
Note that this method does not create a message, but restore a previously created message from a local storage (database).
Parameters
- uuid:- String - The Message UUID 
- conversationUuid:- String - The Conversation UUID this message belongs to 
- payload:- List<Map<String, Any>> - The list of payload objects associated with the message 
- sequence:- Long - The Message sequence number 
Returns
- type:
Props
me
val me: String?
The Voximplant username for the current user, e.g., username@appname.accname. Null if the client is not logged in.
Returns
- type:- String?