Rate this page:

IMessenger

Interface that may be used to control messaging functions.

Methods

addMessengerListener

Copy URL

void

addMessengerListener(

IMessengerListener

listener
)

Add IMessengerListener to handle messenger events.

Parameters

Returns

  • type:

    void

createConversation

Copy URL

void

createConversation(

ConversationConfig

conversationConfig,

IMessengerCompletionHandler<IConversationEvent>

handler
)

Create a new conversation with the extended configuration.

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

  1. Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onCreateConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

editUser

Copy URL

void

editUser(

Map<String, Object>

customData,

Map<String, Object>

privateCustomData,

IMessengerCompletionHandler<IUserEvent>

handler
)

Edit current user information.

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

  1. Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onEditUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.

Other users that are subscribed to the user can be informed about the editing via the IMessengerListener.onEditUser(IUserEvent) event.

Parameters

  • customData:

    Map<String, Object>

    New custom data. If null, previously set custom data will not be changed. If empty map, previously set custom data will be removed.

  • privateCustomData:

    Map<String, Object>

    New private custom data. If null, previously set private custom data will not be changed. If empty map, previously set private custom data will be removed.

  • Completion handler to get the result or null

Returns

  • type:

    void

getConversation

Copy URL

void

getConversation(

String

uuid,

IMessengerCompletionHandler<IConversationEvent>

handler
)

Get a conversation by its UUID.

It's possible if:

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

  1. Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onGetConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

getConversations

Copy URL

void

getConversations(

List<String>

uuids,

IMessengerCompletionHandler<List<IConversationEvent>>

handler
)

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

It's possible if:

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

  1. Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many conversations events as the specified number of conversations UUIDs is.
  2. Implement the IMessengerListener.onGetConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of conversations UUIDs is; the error event will be called once only.

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

Parameters

Returns

  • type:

    void

getMe

Copy URL

String

getMe()

Get the Voximplant user identifier for the current user, e.g., 'username@appname.accname'

Returns

  • type:

    String

getPublicConversations

Since ver. 2.9.0
Copy URL

void

getPublicConversations(

IMessengerCompletionHandler<IConversationListEvent>

handler
)

Get all public conversations (IConversation.isPublicJoin() is true).

It's possible to get all public conversations (UUIDs) that were 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 handler parameter to consume the results with IConversationListEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onGetPublicConversations(IConversationListEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

getSubscriptionList

Since ver. 2.9.0
Copy URL

void

getSubscriptionList(

IMessengerCompletionHandler<ISubscriptionEvent>

handler
)

Get 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 handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onGetSubscriptionList(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

getUser

Since ver. 2.9.0
Copy URL

void

getUser(

long

imUserId,

IMessengerCompletionHandler<IUserEvent>

handler
)

Get information for the user specified by the IM user id.

It's 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 handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

getUser

Copy URL

void

getUser(

String

username,

IMessengerCompletionHandler<IUserEvent>

handler
)

Get information for the user specified by the Voximplant user name, e.g., 'username@appname.accname'.

It's 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 handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

getUsersByIMId

Since ver. 2.9.0
Copy URL

void

getUsersByIMId(

List<Long>

imUsersId,

IMessengerCompletionHandler<List<IUserEvent>>

handler
)

Get information for the users specified by the list of the IM user ids. Maximum 50 users.

It's 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 handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many user events as the specified number of IM user IDs is.
  2. Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of IM user ids is; the error event will be called once only.

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

Parameters

Returns

  • type:

    void

getUsersByName

Copy URL

void

getUsersByName(

List<String>

users,

IMessengerCompletionHandler<List<IUserEvent>>

handler
)

Get information for the users specified by the list of the Voximplant user names. Maximum 50 users.

It's 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 handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many user events as the specified number of user names is.
  2. Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of user names is; the error event will be called once only.

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

Parameters

Returns

  • type:

    void

joinConversation

Copy URL

void

joinConversation(

String

uuid,

IMessengerCompletionHandler<IConversationEvent>

handler
)

Join the current user to any conversation specified by the UUID.

It's possible only on the following conditions:

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

  1. Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onEditConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

leaveConversation

Copy URL

void

leaveConversation(

String

uuid,

IMessengerCompletionHandler<IConversationEvent>

handler
)

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

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

After a successful method call the conversation's UUID will be added to IUser.getLeaveConversationList().

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

  1. Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onEditConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

managePushNotifications

Copy URL

void

managePushNotifications(

List<MessengerNotification>

notifications,

IMessengerCompletionHandler<IUserEvent>

handler
)

Manage messenger push notification subscriptions for the current user.

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

  1. Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onEditUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.

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

Parameters

Returns

  • type:

    void

recreateConversation

Copy URL

IConversation

recreateConversation(

ConversationConfig

config,

String

uuid,

long

sequence,

long

lastUpdate,

long

createdAt
)

Recreate a conversation.

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

Parameters

  • Conversation config

  • uuid:

    String

    Conversation UUID

  • sequence:

    long

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

  • lastUpdate:

    long

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

  • createdAt:

    long

    UNIX timestamp that specifies the time of the conversation creation

Returns

recreateMessage

Copy URL

IMessage

recreateMessage(

String

uuid,

String

conversationUUID,

String

text,

List<Map<String, Object>>

payload,

long

sequence
)

Recreate 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

    Universally unique identifier of message

  • conversationUUID:

    String

    UUID of the conversation this message belongs to

  • text:

    String

    Text of this message

  • payload:

    List<Map<String, Object>>

    List of payload objects associated with the message

  • sequence:

    long

    Message sequence number

Returns

removeMessengerListener

Copy URL

void

removeMessengerListener(

IMessengerListener

listener
)

Remove a previously added IMessengerListener.

Parameters

Returns

  • type:

    void

setStatus

Copy URL

void

setStatus(

boolean

online,

IMessengerCompletionHandler<IStatusEvent>

handler
)

Set the current user status.

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

  1. Specify the handler parameter to consume the results with IStatusEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onSetStatus(IStatusEvent) and IMessengerListener.onError(IErrorEvent) 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 IMessengerListener.onSetStatus(IStatusEvent) event.

Parameters

Returns

  • type:

    void

subscribe

Copy URL

void

subscribe(

List<Long>

users,

IMessengerCompletionHandler<ISubscriptionEvent>

handler
)

Subscribe for other user(s) information and status changes.

It's 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 handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onSubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.

Other logged in clients (of the current user) can be informed about the subscription via the IMessengerListener.onSubscribe(ISubscriptionEvent) event. User(s) specified in the 'users' parameter aren't informed about the subscription.

Parameters

Returns

  • type:

    void

unsubscribe

Copy URL

void

unsubscribe(

List<Long>

users,

IMessengerCompletionHandler<ISubscriptionEvent>

handler
)

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

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

  1. Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onUnsubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.

Other logged in clients (of the current user) can be informed about the unsubscription via the IMessengerListener.onUnsubscribe(ISubscriptionEvent) event. User(s) specified in the 'users' parameter aren't informed about the unsubscription.

Parameters

Returns

  • type:

    void

unsubscribeFromAll

Since ver. 2.9.0
Copy URL

void

unsubscribeFromAll(

IMessengerCompletionHandler<ISubscriptionEvent>

handler
)

Unsubscribe from all subscriptions.

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

  1. Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
  2. Implement the IMessengerListener.onUnsubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.

Other logged in clients (of the current user) can be informed about the unsubscription via the IMessengerListener.onUnsubscribe(ISubscriptionEvent) event. Other users aren't informed about the unsubscription.

Parameters

Returns

  • type:

    void