VIMessenger
Interface that may be used to control messaging functions.
Methods
createConversation
Future<VIConversationEvent>
createConversation( 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
config:
Returns
type:
Future<VIConversationEvent>
editUser
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
type:
Future<VIUserEvent>
getConversation
Future<VIConversationEvent>
getConversation(String
uuid)
Get a conversation by its UUID.
It's possible if:
- the user that calls the method is/was 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
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
type:
Future<List<VIConversationEvent>>
getPublicConversations
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
type:
Future<VIConversationListEvent>
getSubscriptions
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
type:
Future<VISubscriptionEvent>
getUserByIMId
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
type:
Future<VIUserEvent>
getUserByName
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
type:
Future<VIUserEvent>
getUsersByIMId
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
type:
Future<List<VIUserEvent>>
getUsersByName
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
type:
Future<List<VIUserEvent>>
joinConversation
Future<VIConversationEvent>
joinConversation(String
uuid)
Join the current user to any conversation specified by the UUID.
It's 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
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
type:
Future<VIConversationEvent>
managePushNotifications
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
notifications:
List<VIMessengerNotification>?
List of VIMessengerNotification
Returns
type:
Future<VIUserEvent>
recreateConversation
recreateConversation(String
uuid, 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:
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(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
OptionalMessage sequence number
Returns
type:
setStatus
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
type:
Future<VIStatusEvent>
subscribe
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
type:
Future<VISubscriptionEvent>
unsubscribe
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
type:
Future<VISubscriptionEvent>
unsubscribeFromAll
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
type:
Future<VISubscriptionEvent>
Props
me
String?
me
Get the Voximplant user identifier for the current user, e.g., 'username@appname.accname'
Returns
type:
String?
onCreateConversation
onCreateConversation
Callback for getting notified when a new conversation is created with the current user.
Returns
type:
onEditConversation
onEditConversation
Callback for getting notified when the properties of a conversation the current user belongs to were modified
Returns
type:
onEditMessage
onEditMessage
Callback for getting notified when a message was edited
Returns
type:
onEditUser
onEditUser
Callback for getting notified when an user changes
Returns
type:
onRead
onRead
Callback for getting notified when a participant in a conversation mark the event as read
Returns
type:
onRemoveConversation
onRemoveConversation
Callback for getting notified when a conversation the current user belongs to is removed
Returns
type:
onRemoveMessage
onRemoveMessage
Callback for getting notified when a message was removed from a conversation the current user belongs to
Returns
type:
onSendMessage
onSendMessage
Callback for getting notified when a new message was sent to a conversation the current user belongs to
Returns
type:
onSetStatus
onSetStatus
Callback for getting notified when an user status was changed
Returns
type:
onSubscribe
onSubscribe
Callback for getting notified about new subscriptions.
Returns
type:
onTyping
onTyping
Callback for getting notified when some user is typing text in a conversation.
Returns
type:
onUnsubscribe
onUnsubscribe
Callback for getting notified about changes in current subscriptions.
Returns
type: