Rate this page:

VIMessenger

Interface that may be used to control messaging functions.

Methods

createConversation

Copy URL

Future<VIConversationEvent>

createConversation(

VIConversationConfig

config
)

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 VIMessenger.onCreateConversation callback.

Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError

Parameters

Returns

editUser

Copy URL

Future<VIUserEvent>

editUser(

Map<String, Object>?

customData,

Map<String, Object>?

privateCustomData
)

Edits the current user information.

Throws VIException, if operation failed, otherwise returns VIUserEvent instance. For all possible errors see VIMessagingError

Parameters

  • customData:

    Map<String, Object>?

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

  • privateCustomData:

    Map<String, Object>?

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

Returns

getConversation

Copy URL

Future<VIConversationEvent>

getConversation(

String

uuid
)

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 VIMessenger.getPublicConversations)

Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError

Parameters

  • uuid:

    String

    Conversation UUID

Returns

getConversations

Copy URL

Future<List<VIConversationEvent>>

getConversations(

List<String>

uuids
)

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

It is possible if:

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

Throws VIException, if operation failed, otherwise returns List of VIConversationEvent instances. For all possible errors see VIMessagingError

Parameters

  • uuids:

    List<String>

    List of conversation UUIDs. Maximum 30 conversations.

Returns

getPublicConversations

Copy URL

Future<VIConversationListEvent>

getPublicConversations()

Gets all public conversations (VIConversation.publicJoin 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

Throws VIException, if operation failed, otherwise returns VIConversationListEvent instance. For all possible errors see VIMessagingError

Returns

getSubscriptions

Copy URL

Future<VISubscriptionEvent>

getSubscriptions()

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

Throws VIException, if operation failed, otherwise returns VISubscriptionEvent instance. For all possible errors see VIMessagingError

Returns

getUserByIMId

Copy URL

Future<VIUserEvent>

getUserByIMId(

int

userId
)

Gets the information for a user specified by the IM user id.

It is possible to get any user of the main Voximplant developer account or its child accounts.

Throws VIException, if operation failed, otherwise returns VIUserEvent instance. For all possible errors see VIMessagingError

Parameters

  • userId:

    int

    IM User id

Returns

getUserByName

Copy URL

Future<VIUserEvent>

getUserByName(

String

username
)

Gets the information for a 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.

Throws VIException, if operation failed, otherwise returns VIUserEvent instance. For all possible errors see VIMessagingError

Parameters

  • username:

    String

    Voximplant user identifier

Returns

getUsersByIMId

Copy URL

Future<List<VIUserEvent>>

getUsersByIMId(

List<int>

users
)

Gets the information for 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.

Throws VIException, if operation failed, otherwise returns List of VIUserEvent instances. For all possible errors see VIMessagingError

Parameters

  • users:

    List<int>

    List of IM user ids

Returns

getUsersByName

Copy URL

Future<List<VIUserEvent>>

getUsersByName(

List<String>

users
)

Gets the information for 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.

Throws VIException, if operation failed, otherwise returns List of VIUserEvent instances. For all possible errors see VIMessagingError

Parameters

  • users:

    List<String>

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

Returns

joinConversation

Copy URL

Future<VIConversationEvent>

joinConversation(

String

uuid
)

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

It is possible only on the following conditions:

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

Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError

Parameters

  • uuid:

    String

    Conversation UUID

Returns

leaveConversation

Copy URL

Future<VIConversationEvent>

leaveConversation(

String

uuid
)

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

It is possible only if the conversation is not a direct one (VIConversation.direct is false) After a successful method call the conversation's UUID is added to VIUser.leaveConversationList.

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

Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError

Parameters

  • uuid:

    String

    Conversation UUID

Returns

managePushNotifications

Copy URL

Future<VIUserEvent>

managePushNotifications(

List<VIMessengerNotification>?

notifications
)

Manages messenger push notification subscriptions for the current user.

Throws VIException, if operation failed, otherwise returns VIUserEvent instance. For all possible errors see VIMessagingError

Parameters

Returns

recreateConversation

Copy URL

VIConversation

recreateConversation(

String

uuid,

VIConversationConfig

conversationConfig,

int

lastSequence,

int

lastUpdateTime,

int

createdTime
)

Recreates a conversation.

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

Returns VIConversation instance or null if uuid is null.

Parameters

  • uuid:

    String

    Conversation UUID

  • conversationConfig:

    VIConversationConfig

    Conversation config

  • lastSequence:

    int

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

  • lastUpdateTime:

    int

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

  • createdTime:

    int

    UNIX timestamp that specifies the time of the conversation creation

Returns

recreateMessage

Copy URL

VIMessage

recreateMessage(

String

uuid,

String

conversationUuid,

String

text,

List<Map<String, Object>>

payload,

int

sequence = 0
)

Recreates a message.

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

Returns VIMessage instance or null if uuid or conversationUuid is null.

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:

    int

    Optional

    Message sequence number

Returns

setStatus

Copy URL

Future<VIStatusEvent>

setStatus(

bool

online
)

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 VIMessenger.onSetStatus

Throws VIException, if operation failed, otherwise returns VIStatusEvent instance. For all possible errors see VIMessagingError

Parameters

  • online:

    bool

    Whether the user is available for messaging

Returns

subscribe

Copy URL

Future<VISubscriptionEvent>

subscribe(

List<int>

users
)

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 VIMessenger.onSubscribe callback. User(s) specified in the 'users' parameter are not informed about the subscription.

Throws VIException, if operation failed, otherwise returns VISubscriptionEvent instance. For all possible errors see VIMessagingError

Parameters

  • users:

    List<int>

    List of IM user ids

Returns

unsubscribe

Copy URL

Future<VISubscriptionEvent>

unsubscribe(

List<int>

users
)

Unsubscribes from 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 unsubscription via the VIMessenger.onSubscribe callback. User(s) specified in the 'users' parameter are not informed about the unsubscription.

Throws VIException, if operation failed, otherwise returns VISubscriptionEvent instance. For all possible errors see VIMessagingError

Parameters

  • users:

    List<int>

    List of IM user ids

Returns

unsubscribeFromAll

Copy URL

Future<VISubscriptionEvent>

unsubscribeFromAll()

Unsubscribes from all subscriptions.

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

Throws VIException, if operation failed, otherwise returns VISubscriptionEvent instance. For all possible errors see VIMessagingError

Returns

Props

me

Copy URL

String?

me

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

Returns

  • type:

    String?

onCreateConversation

Copy URL

VICreateConversation?

onCreateConversation

Triggered when a new conversation is created with the current user.

onEditConversation

Copy URL

VIEditConversation?

onEditConversation

Triggered when the properties of a conversation the current user belongs to are modified.

Returns

onEditMessage

Copy URL

VIEditMessage?

onEditMessage

Triggered when a message has been edited.

Returns

onEditUser

Copy URL

VIEditUser?

onEditUser

Triggered when an user changes.

Returns

onRead

Copy URL

VIIsRead?

onRead

Triggered when a participant in a conversation mark the event as read.

Returns

onRemoveConversation

Copy URL

VIRemoveConversation?

onRemoveConversation

Triggered when a conversation the current user belongs to is removed.

onRemoveMessage

Copy URL

VIRemoveMessage?

onRemoveMessage

Triggered when a message has been removed from a conversation the current user belongs to.

Returns

onSendMessage

Copy URL

VISendMessage?

onSendMessage

Triggered when a new message has been sent to a conversation the current user belongs to.

Returns

onSetStatus

Copy URL

VISetStatus?

onSetStatus

Triggered when an user status has been changed.

Returns

onSubscribe

Copy URL

VISubscribe?

onSubscribe

Callback for getting notified about new subscriptions.

Returns

onTyping

Copy URL

VITyping?

onTyping

Triggered when some user is typing text in a conversation.

Returns

onUnsubscribe

Copy URL

VIUnsubscribe?

onUnsubscribe

Callback for getting notified about changes in current subscriptions.

Returns