Rate this page:

VIMessenger

Interface that may be used to control messaging functions.

Methods

createConversation

Copy URL

Future<VIConversationEvent>

createConversation(

VIConversationConfig

config
)

Create 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
)

Edit 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 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.

Returns

getConversation

Copy URL

Future<VIConversationEvent>

getConversation(

String

uuid
)

Get a conversation by its UUID.

It's possible if:

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
)

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

It's 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()

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

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

Returns

getSubscriptions

Copy URL

Future<VISubscriptionEvent>

getSubscriptions()

Get 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
)

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.

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
)

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.

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
)

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.

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
)

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.

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
)

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

It's 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
)

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

It's possible only if the conversation is not a direct one (VIConversation.direct is false) After a successful method call the conversation's UUID will be 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
)

Manage 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
)

Recreate 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 was 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
)

Recreate 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 were 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
)

Set 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

    True if user is available for messaging, false otherwise

Returns

subscribe

Copy URL

Future<VISubscriptionEvent>

subscribe(

List<int>

users
)

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.

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 aren't 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
)

Unsubscribe from 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.

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 aren't 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()

Unsubscribe 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 aren't 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

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

Returns

  • type:

    String?

onCreateConversation

Copy URL

VICreateConversation?

onCreateConversation

Callback for getting notified when a new conversation is created with the current user.

onEditConversation

Copy URL

VIEditConversation?

onEditConversation

Callback for getting notified when the properties of a conversation the current user belongs to were modified

Returns

onEditMessage

Copy URL

VIEditMessage?

onEditMessage

Callback for getting notified when a message was edited

Returns

onEditUser

Copy URL

VIEditUser?

onEditUser

Callback for getting notified when an user changes

Returns

onRead

Copy URL

VIIsRead?

onRead

Callback for getting notified when a participant in a conversation mark the event as read

Returns

onRemoveConversation

Copy URL

VIRemoveConversation?

onRemoveConversation

Callback for getting notified when a conversation the current user belongs to is removed

onRemoveMessage

Copy URL

VIRemoveMessage?

onRemoveMessage

Callback for getting notified when a message was removed from a conversation the current user belongs to

Returns

onSendMessage

Copy URL

VISendMessage?

onSendMessage

Callback for getting notified when a new message was sent to a conversation the current user belongs to

Returns

onSetStatus

Copy URL

VISetStatus?

onSetStatus

Callback for getting notified when an user status was changed

Returns

onSubscribe

Copy URL

VISubscribe?

onSubscribe

Callback for getting notified about new subscriptions.

Returns

onTyping

Copy URL

VITyping?

onTyping

Callback for getting notified 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