IMessenger
Interface that may be used to control messaging functions.
Methods
addMessengerListener
void
addMessengerListener( listener)
Add IMessengerListener to handle messenger events.
Parameters
listener:
IMessengerListener listener
Returns
type:
void
createConversation
void
createConversation( conversationConfig, handler)
Create a new conversation with the extended configuration.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onCreateConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.
Other parties of the conversation (online participants and logged in clients) can be informed about the conversation creation via the IMessengerListener.onCreateConversation(IConversationEvent) event.
Parameters
conversationConfig:
ConversationConfig instance with extended conversation parameters
Completion handler to get the result or null
Returns
type:
void
editUser
void
editUser(Map<String, Object>
customData, Map<String, Object>
privateCustomData, handler)
Edit current user information.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onEditUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.
Other users that are subscribed to the user can be informed about the editing via the IMessengerListener.onEditUser(IUserEvent) event.
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.
handler:
Completion handler to get the result or null
Returns
type:
void
getConversation
void
getConversation(String
uuid, handler)
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 IMessenger.getPublicConversations(IMessengerCompletionHandler))
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onGetConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.
Only the client that called the method can be informed about getting conversation.
Parameters
uuid:
String
Conversation UUID
Completion handler to get the result or null
Returns
type:
void
getConversations
void
getConversations(List<String>
uuids, handler)
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 IMessenger.getPublicConversations(IMessengerCompletionHandler))
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many conversations events as the specified number of conversations UUIDs is.
- Implement the IMessengerListener.onGetConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of conversations UUIDs is; the error event will be called once only.
Only the client that called the method can be informed about getting conversations.
Parameters
uuids:
List<String>
List of conversation UUIDs. Maximum 30 conversations.
handler:
Completion handler to get the result or null
Returns
type:
void
getMe
String
getMe()
Get the Voximplant user identifier for the current user, e.g., 'username@appname.accname'
Returns
type:
String
getPublicConversations
void
getPublicConversations( handler)
Get all public conversations (IConversation.isPublicJoin() 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
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationListEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onGetPublicConversations(IConversationListEvent) and IMessengerListener.onError(IErrorEvent) events.
Only the client that called the method can be informed about getting public conversations UUIDs.
Parameters
Completion handler to get the result or null
Returns
type:
void
getSubscriptionList
void
getSubscriptionList( handler)
Get all current subscriptions, i.e., the list of users the current user is subscribed to.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onGetSubscriptionList(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.
Only the client that called the method can be informed about getting subscriptions.
Parameters
Completion handler to get the result or null
Returns
type:
void
getUser
void
getUser(long
imUserId, handler)
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.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.
Only the client that called the method can be informed about getting user information.
Parameters
imUserId:
long
IM User id
handler:
Completion handler to get the result or null
Returns
type:
void
getUser
void
getUser(String
username, handler)
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.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.
Only the client that called the method can be informed about getting user information.
Parameters
username:
String
Voximplant user identifier
handler:
Completion handler to get the result or null
Returns
type:
void
getUsersByIMId
void
getUsersByIMId(List<Long>
imUsersId, handler)
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.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many user events as the specified number of IM user IDs is.
- Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of IM user ids is; the error event will be called once only.
Only the client that called the method can be informed about getting users information.
Parameters
imUsersId:
List<Long>
List of IM user ids
handler:
Completion handler to get the result or null
Returns
type:
void
getUsersByName
void
getUsersByName(List<String>
users, handler)
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.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly. The result will be a list with as many user events as the specified number of user names is.
- Implement the IMessengerListener.onGetUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events. The event with a result will be invoked as many times as the specified number of user names is; the error event will be called once only.
Only the client that called the method can be informed about getting users information.
Parameters
users:
List<String>
List of Voximplant user identifiers, e.g., 'username@appname.accname'
handler:
Completion handler to get the result or null
Returns
type:
void
joinConversation
void
joinConversation(String
uuid, handler)
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 (IConversation.isPublicJoin() is true)
- the conversation is not a direct one (IConversation.isDirect() is false)
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onEditConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.
Other parties of the conversation (online participants and logged in clients) can be informed about joining to the conversation via the IMessengerListener.onEditConversation(IConversationEvent) event.
Parameters
uuid:
String
Conversation UUID
Completion handler to get the result or null
Returns
type:
void
leaveConversation
void
leaveConversation(String
uuid, handler)
Make the current user to leave a conversation specified by the UUID.
It's possible only if the conversation is not a direct one (IConversation.isDirect() is false)
After a successful method call the conversation's UUID will be added to IUser.getLeaveConversationList().
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IConversationEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onEditConversation(IConversationEvent) and IMessengerListener.onError(IErrorEvent) events.
Other parties of the conversation (online participants and logged in clients) can be informed about leaving the conversation via the IMessengerListener.onEditConversation(IConversationEvent) event.
Parameters
uuid:
String
Conversation UUID
Completion handler to get the result or null
Returns
type:
void
managePushNotifications
void
managePushNotifications(List<MessengerNotification>
notifications, handler)
Manage messenger push notification subscriptions for the current user.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IUserEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onEditUser(IUserEvent) and IMessengerListener.onError(IErrorEvent) events.
Other logged in clients (of the current user) can be informed about managing push notifications via IMessengerListener.onEditUser(IUserEvent).
Parameters
notifications:
List<MessengerNotification>
List of MessengerNotification
handler:
Completion handler to get the result or null
Returns
type:
void
recreateConversation
recreateConversation( config, String
uuid, long
sequence, long
lastUpdate, long
createdAt)
Recreate a conversation.
Note that this method does not create a conversation, but restore a previously created conversation from a local storage (database).
Parameters
config:
Conversation config
uuid:
String
Conversation UUID
sequence:
long
Sequence of the last event stored in a local storage (database)
lastUpdate:
long
UNIX timestamp that specifies the time of the last event stored in a local storage (database)
createdAt:
long
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, long
sequence)
Recreate a message.
Note that this method does not create a message, but restore a previously created message from a local storage (database).
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:
long
Message sequence number
Returns
type:
removeMessengerListener
void
removeMessengerListener( listener)
Remove a previously added IMessengerListener.
Parameters
listener:
IMessengerListener listener
Returns
type:
void
setStatus
void
setStatus(boolean
online, handler)
Set the current user status.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with IStatusEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onSetStatus(IStatusEvent) and IMessengerListener.onError(IErrorEvent) events.
Other users (that are subscribed to the user) and other clients (of the current user) can be informed about the status changing via the IMessengerListener.onSetStatus(IStatusEvent) event.
Parameters
online:
boolean
True if user is available for messaging, false otherwise
handler:
Completion handler to get the result or null
Returns
type:
void
subscribe
void
subscribe(List<Long>
users, handler)
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.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onSubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.
Other logged in clients (of the current user) can be informed about the subscription via the IMessengerListener.onSubscribe(ISubscriptionEvent) event. User(s) specified in the 'users' parameter aren't informed about the subscription.
Parameters
users:
List<Long>
List of IM user ids
Completion handler to get the result or null
Returns
type:
void
unsubscribe
void
unsubscribe(List<Long>
users, handler)
Unsubscribe from other user(s) information and status changes.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onUnsubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.
Other logged in clients (of the current user) can be informed about the unsubscription via the IMessengerListener.onUnsubscribe(ISubscriptionEvent) event. User(s) specified in the 'users' parameter aren't informed about the unsubscription.
Parameters
users:
List<Long>
List of IM user ids
Completion handler to get the result or null
Returns
type:
void
unsubscribeFromAll
void
unsubscribeFromAll( handler)
Unsubscribe from all subscriptions.
To get the method call result use one of the following options:
- Specify the handler parameter to consume the results with ISubscriptionEvent or IErrorEvent in case of success/error accordingly.
- Implement the IMessengerListener.onUnsubscribe(ISubscriptionEvent) and IMessengerListener.onError(IErrorEvent) events.
Other logged in clients (of the current user) can be informed about the unsubscription via the IMessengerListener.onUnsubscribe(ISubscriptionEvent) event. Other users aren't informed about the unsubscription.
Parameters
Completion handler to get the result or null
Returns
type:
void