VIMessenger
Interface that may be used to control messaging functions.
Methods
createConversation
createConversation(config: ): Future<VIConversationEvent>
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
config:
Returns
type:
Future<VIConversationEvent>
editUser
editUser(customData: Map<String, Object>?
, privateCustomData: Map<String, Object>?
): Future<VIUserEvent>
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
type:
Future<VIUserEvent>
getConversation
getConversation(uuid: String
): Future<VIConversationEvent>
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
type:
Future<VIConversationEvent>
getConversations
getConversations(uuids: List<String>
): Future<List<VIConversationEvent>>
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
type:
Future<List<VIConversationEvent>>
getPublicConversations
getPublicConversations(): Future<VIConversationListEvent>
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
type:
Future<VIConversationListEvent>
getSubscriptions
getSubscriptions(): Future<VISubscriptionEvent>
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
type:
Future<VISubscriptionEvent>
getUserByIMId
getUserByIMId(userId: int
): Future<VIUserEvent>
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
type:
Future<VIUserEvent>
getUserByName
getUserByName(username: String
): Future<VIUserEvent>
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
type:
Future<VIUserEvent>
getUsersByIMId
getUsersByIMId(users: List<int>
): Future<List<VIUserEvent>>
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
type:
Future<List<VIUserEvent>>
getUsersByName
getUsersByName(users: List<String>
): Future<List<VIUserEvent>>
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
type:
Future<List<VIUserEvent>>
joinConversation
joinConversation(uuid: String
): Future<VIConversationEvent>
Joins the current user 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 (VIConversation.publicJoin is true)
- the conversation is not a direct one (VIConversation.direct is false)
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
type:
Future<VIConversationEvent>
leaveConversation
leaveConversation(uuid: String
): Future<VIConversationEvent>
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
type:
Future<VIConversationEvent>
managePushNotifications
managePushNotifications(notifications: List<VIMessengerNotification>?
): Future<VIUserEvent>
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
notifications:
List<VIMessengerNotification>?
List of VIMessengerNotification
Returns
type:
Future<VIUserEvent>
recreateConversation
recreateConversation(uuid: String
, conversationConfig: , lastSequence: int
, lastUpdateTime: int
, createdTime: int
): 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:
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
type:
recreateMessage
recreateMessage(uuid: String
, conversationUuid: String
, text: String
, payload: List<Map<String, Object>>
, sequence: int
): 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
OptionalMessage sequence number
Returns
type:
setStatus
setStatus(online: bool
): Future<VIStatusEvent>
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
type:
Future<VIStatusEvent>
subscribe
subscribe(users: List<int>
): Future<VISubscriptionEvent>
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
type:
Future<VISubscriptionEvent>
unsubscribe
unsubscribe(users: List<int>
): Future<VISubscriptionEvent>
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
type:
Future<VISubscriptionEvent>
unsubscribeFromAll
unsubscribeFromAll(): Future<VISubscriptionEvent>
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
type:
Future<VISubscriptionEvent>
Props
me
me: Gets the Voximplant user identifier for the current user, e.g., 'username@appname.accname'
Returns
type:
String?
onCreateConversation
onCreateConversation: Triggered when a new conversation is created with the current user.
Returns
type:
onEditConversation
onEditConversation: Triggered when the properties of a conversation the current user belongs to are modified.
Returns
type:
onRead
onRead: Triggered when a participant in a conversation mark the event as read.
Returns
type:
onRemoveConversation
onRemoveConversation: Triggered when a conversation the current user belongs to is removed.
Returns
type:
onRemoveMessage
onRemoveMessage: Triggered when a message has been removed from a conversation the current user belongs to.
Returns
type:
onSendMessage
onSendMessage: Triggered when a new message has been sent to a conversation the current user belongs to.
Returns
type:
onSubscribe
onSubscribe: Callback for getting notified about new subscriptions.
Returns
type:
onUnsubscribe
onUnsubscribe: Callback for getting notified about changes in current subscriptions.
Returns
type: