SIGN UP

IMessenger

Interface that may be used to control messaging functions.

Methods

void addMessengerListener(IMessengerListener listener)

Add IMessengerListener to handle messenger events.

Parameters

void createConversation(List<ConversationParticipant> participants)

Create new conversation. Triggers the IMessengerListener.onCreateConversation(IConversationEvent) event for all messenger objects on all connected clients that are mentioned in the 'participants' list.

Parameters

void createConversation(List<ConversationParticipant> participants, ConversationConfig conversationConfig)

Create new conversation with extended configuration. Triggers the IMessengerListener.onCreateConversation(IConversationEvent) event for all messenger objects on all connected clients that are mentioned in the 'participants' list.

     
         ConversationConfig config = ConversationConfig.createBuilder()
                 .setEnablePublicJoin(true)
                 .setDistinct(true)
                 .setTitle("new conversation")
                 .setModerators(moderators)
                 .build();
messenger.createConversation(participants, config);

Parameters

void editUser(Map<Object,Object> customData, Map<Object,Object> privateCustomData)

Edit current user information.

Parameters

  • customData:

    Map<Object,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<Object,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.

void getConversation(String uuid)

Get conversation by it's UUID.

Parameters

  • uuid:

    String

    Conversation UUID

void getConversations(List<String> uuids)

Get multiple conversations by array of UUIDs. Maximum 30 conversations. Note that calling this method will result in multiple IMessengerListener.onGetConversation(IConversationEvent) events.

Parameters

  • uuids:

    List<String>

    List of conversation UUIDs

String getMe()

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

Returns

  • Return:

    String

    Current user identifier

void getUser(String user)

Get user information for the user specified by the Voximplant user identifier, ex 'username@appname.accname'.

Parameters

  • user:

    String

    User identifier

void getUsers(List<String> users)

Get user information for the users specified by the list of the Voximplant user identifiers, ex 'username@appname.accname'.

Parameters

  • users:

    List<String>

    List of user identifiers

void joinConversation(String uuid)

Join current user to the conversation specified by the UUID.

Parameters

  • uuid:

    String

    Conversation UUID

void leaveConversation(String uuid)

Leave current user from the conversation specified by the UUID.

Parameters

  • uuid:

    String

    Conversation UUID

void managePushNotifications(List<MessengerNotifications> notifications)

Manage messenger push notification subscriptions.

Parameters

IConversation recreateConversation(List<ConversationParticipant> participants, String uuid, String title, long sequence, boolean publicJoin, List<String> moderators, long lastUpdate, long lastRead, boolean distinct, Map<Object,Object> customData, long createdAt, boolean isUberConversation)

Recreate conversation. Note that this method does not create conversation, but restore previously created conversation.

Parameters

  • participants:

    List<ConversationParticipant>
  • uuid:

    String

    Conversation UUID

  • title:

    String

    Conversation title

  • sequence:

    long

    Sequence of last event

  • publicJoin:

    boolean

    Public join option of the conversation

  • moderators:

    List<String>

    List of conversation's moderators

  • lastUpdate:

    long

    UNIX timestamp that specifies the time of the last event in the conversation

  • lastRead:

    long

    Sequence of last event that was read by user

  • distinct:

    boolean

    Distinct option of the conversation

  • customData:

    Map<Object,Object>

    Object with custom data, up to 5kb.

  • createdAt:

    long

    UNIX timestamp that specifies the time of the conversation creation

  • isUberConversation:

    boolean

    Specify if the conversation is uber conversation

Returns

IMessage recreateMessage(String uuid, String conversationUUID, String sender, String text, List<Payload> payload, long sequence)

Recreate a message. Note that this method does not create message, but restore previously created message.

Parameters

  • uuid:

    String

    Universally unique identifier of message

  • conversationUUID:

    String

    UUID of the conversation this message belongs to

  • sender:

    String

    User id of the sender of this message

  • text:

    String

    Text of this message

  • payload:

    List<Payload>

    List of Payload objects associated with the message

  • sequence:

    long

    Message sequence number

Returns

void removeConversation(String uuid)

Remove the conversation specified by the UUID.

Parameters

  • uuid:

    String

    UUID of the conversation to be removed

void removeMessengerListener(IMessengerListener listener)

Remove previously added IMessengerListener.

Parameters

void setStatus(boolean online)

Set user presence status. Triggers the IMessengerListener.onSetStatus(IStatusEvent) event for all messenger objects on all connected clients which are subscribed for notifications about this user. Including this one if conditions are met.

Parameters

  • online:

    boolean

    True if user is available for messaging, false otherwise

void subscribe(List<String> users)

Subscribe for user information change and presence status change. On change, the IMessengerListener.onSetStatus(IStatusEvent) event will be triggered.

Parameters

  • users:

    List<String>

    List of Voximplant user identifiers, ex 'username@appname.accname'

void unSubscribe(List<String> users)

Unsubscribe for user information change and presence status change.

Parameters

  • users:

    List<String>

    List of full Voximplant user identifiers, ex 'username@appname.accname'