STWMessaging Manager
This class represent the API for all actions/event related to the messaging
This class offers several possible operations defined in the following list :
- Send message
- Re-Send message
- CRUD for messages in DB
- Mark messages as read
- Get delivery messages
This class offers also the possibility to listen for any events related to a specific conversation using registerToConversation
Functions
Link copied to clipboard
open fun assignNewRegularAdmin( @NonNull context: Context, @NonNull conversationId: String, @NonNull phoneNumber: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
open fun assignNewRegularAdmin( @NonNull context: Context, @NonNull conversationId: String, @NonNull phoneNumber: String, leaveAfterAssign: Boolean, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to assign a new member to be a regular admin in the current group conversation The given conversation should
- be a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun assignNewRegularAdmins( @NonNull context: Context, @NonNull conversationId: String, @NonNull phoneNumberList: List<String>, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
open fun assignNewRegularAdmins( @NonNull context: Context, @NonNull conversationId: String, @NonNull phoneNumberList: List<String>, leaveAfterAssign: Boolean, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to assign a new list of members to be a regular admins in the current group conversation The given conversation should
- be a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun changeGroupName( @NonNull context: Context, @NonNull conversationId: String, @NonNull newGroupName: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to change the conversation name for the given threadItem to the newGroupName.
Link copied to clipboard
Content copied to clipboard
Call this method to close an existing group conversation.
Link copied to clipboard
open fun confirmAckMessageReception( @NonNull context: Context, @NonNull messageId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to confirm the reception of an acknowledged message.
Link copied to clipboard
open fun createConversation( @NonNull recipients: Array<String>, conversationType: Int, @NonNull conversationName: String, isAvailableOnlyRecipients: Boolean, @Nullable completion: CreateConversationCallback)
Content copied to clipboard
Call this method to create a new conversation, The created conversation will be empty.
Link copied to clipboard
open fun createNewConversation(@NonNull context: Context, @NonNull thread: ThreadItem)
Content copied to clipboard
Call this method to create a new conversation in the local Database.
Link copied to clipboard
Content copied to clipboard
Call this method to delete an existing conversation.
Link copied to clipboard
Content copied to clipboard
Call this method to delete an existing list of conversations.
Link copied to clipboard
open fun deleteMessage( @NonNull context: Context, @NonNull messageId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to delete an existing message from local Database and server.
open fun deleteMessage( @NonNull context: Context, @NonNull messageList: List<BaseMessage>, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to delete an existing list of messages.
Link copied to clipboard
open fun enableMessageReadConfirmation( @NonNull context: Context, isEnabled: Boolean, @Nullable callBack: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to change the read confirmation feature.
Link copied to clipboard
Call this method to permanently delete messages from the local database after a defined period of time in milli seconds.
Link copied to clipboard
open fun forwardMessages( @NonNull context: Context, @NonNull conversationId: String, @NonNull messageIdList: List<String>, @Nullable completion: CompletionCallback)
Content copied to clipboard
Call this method to forward messages to another existing conversation.
open fun forwardMessages( @NonNull context: Context, @NonNull messageIdList: List<String>, @NonNull recipients: Array<String>, conversationType: Int, @Nullable conversationName: String, @Nullable completion: CompletionCallback)
Content copied to clipboard
Call this method to forward messages to anther users and/or groups.
Link copied to clipboard
Link copied to clipboard
open fun getAllConversations(@NonNull context: Context): List<ThreadItem>
Content copied to clipboard
open fun getAllConversations( @NonNull context: Context, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfConversation: Int): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all conversations from local Database.
Link copied to clipboard
open fun getAllMessagesByType( @NonNull context: Context, @NonNull messageType: List<String>, @NonNull sessionTypes: List<Integer>, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfMessage: Int): List<BaseMessage>
Content copied to clipboard
Call this method to retrieve all messages from local Database by message type.
Link copied to clipboard
open fun getCompanyConversationByRecipientNumber(@NonNull context: Context, @NonNull internationalNumber: String): ThreadItem
Content copied to clipboard
Call this method to retrieve the company conversation from local Database initiated with the given user (internationalNumber).
Link copied to clipboard
open fun getCompanyConversations(@NonNull context: Context): List<ThreadItem>
Content copied to clipboard
open fun getCompanyConversations( @NonNull context: Context, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfConversation: Int): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all company conversations from local Database.
Link copied to clipboard
open fun getConversationByGroupId(@NonNull context: Context, @NonNull groupId: String): ThreadItem
Content copied to clipboard
Call this method to retrieve the conversation (group as type) represented by ThreadItem object given a groupId.
Link copied to clipboard
open fun getConversationById(@NonNull context: Context, @NonNull conversationId: String): ThreadItem
Content copied to clipboard
Call this method to retrieve the conversation represented by ThreadItem object given a conversationId.
Link copied to clipboard
open fun getConversationByRecipient(@NonNull context: Context, @NonNull internationalNumber: String): ThreadItem
Content copied to clipboard
Call this method to retrieve a one to one conversation from local Database object given international phone number of the recipient.
Link copied to clipboard
open fun getConversationByRecipientNumber(@NonNull context: Context, @NonNull internationalNumber: String): ThreadItem
Content copied to clipboard
Call this method to retrieve the conversation from local Database initiated with the given user (internationalNumber).
Link copied to clipboard
open fun getConversationListContainingRecipientGroupId(@NonNull context: Context, @NonNull groupId: String): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all related conversations for a given groupId.
Link copied to clipboard
open fun getConversationListForRecipientGroupId(@NonNull context: Context, @NonNull groupId: String): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all related conversations for a given groupId.
Link copied to clipboard
Call this method to get the number of conversations that can be deleted.
Link copied to clipboard
Call This method to get the fallBack message delay for delivery timer "DeliveryTimer" during which we wait for a delivery report from the server.
Link copied to clipboard
open fun getDeliveryReportForIncomingMessage(@NonNull context: Context, @NonNull messageId: String): MessageDeliveryReport
Content copied to clipboard
Call this method to retrieve the message delivery report received for a given message id from local Database.
Link copied to clipboard
open fun getDeliveryReportListByMessageId(@NonNull context: Context, @NonNull messageId: String): List<MessageDeliveryReport>
Content copied to clipboard
Call this method to retrieve all message delivery list given a message id from local Database.
Link copied to clipboard
open fun getDraftMessageByConversationId(@NonNull context: Context, @NonNull conversationId: String): BaseMessage
Content copied to clipboard
Call this method to retrieve the draft message given conversationId from local Database represented by BaseMessage object.
Link copied to clipboard
open fun getExternalConversations(@NonNull context: Context): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all external conversations from local Database.
Link copied to clipboard
open fun getGroupConversationByRecipients(@NonNull context: Context, @NonNull recipients: Array<String>): ThreadItem
Content copied to clipboard
Call this method to retrieve a group conversation from local Database object given groups and users.
Link copied to clipboard
open fun getGroupsInConversation(@NonNull context: Context, @Nullable conversationId: String): List<ContactItem>
Content copied to clipboard
Call this method to retrieve recipient groups in the given conversation.
Link copied to clipboard
Link copied to clipboard
open fun getLastActiveConversationByGroupId(@NonNull context: Context, @NonNull groupId: String): ThreadItem
Content copied to clipboard
Call this method to retrieve the last active conversation (one to many or group) from local Database initiated with only the given group ID.
Link copied to clipboard
Link copied to clipboard
open fun getLastMessageContainsLocationPins(@NonNull context: Context): BaseMessage
Content copied to clipboard
Call this method to retrieve the message which contains the last location attachment pins from local Database represented by BaseMessage object.
Link copied to clipboard
Link copied to clipboard
open fun getMembersOfGroupConversation(@NonNull context: Context, @NonNull conversationId: String): List<PhoneItem>
Content copied to clipboard
Call this method to retrieve list of members in group conversation The given conversation should :
- a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun getMessageByAttachmentId(@NonNull context: Context, @NonNull attachmentId: String): BaseMessage
Content copied to clipboard
Call this method to retrieve the message represented by BaseMessage object from local dataBase given an attachmentId
Link copied to clipboard
open fun getMessageById(@NonNull context: Context, @NonNull messageId: String): BaseMessage
Content copied to clipboard
Call this method to retrieve the message represented by BaseMessage object given a messageId.
Link copied to clipboard
open fun getMessageList( @NonNull context: Context, @NonNull conversationId: String, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfMessage: Int): List<BaseMessage>
Content copied to clipboard
Call this method to retrieve message list from local Database in the right chronological order This method should be executed in a worker thread since it contains a lot of operation that can exceed 5sec or block the UI thread.
Link copied to clipboard
Link copied to clipboard
open fun getMessagesByType( @NonNull context: Context, @NonNull conversationId: String, @NonNull messageType: List<String>, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfMessage: Int): List<BaseMessage>
Content copied to clipboard
Call this method to retrieve message list from local Database by message type.
Link copied to clipboard
open fun getMessagesByTypeAndSession( @NonNull context: Context, @NonNull conversationId: String, @NonNull messageType: List<String>, @NonNull sessionTypes: List<Integer>, @IntRange(from = 0 ) startingFrom: Int, @IntRange(from = 1 ) numberOfMessage: Int): List<BaseMessage>
Content copied to clipboard
Call this method to retrieve message list from local Database by message type.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Call this method to retrieve the total number of company conversations from local Database.
Link copied to clipboard
Call this method to retrieve the total number of conversations from local Database.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getNumberOfReceivedMessage(@NonNull context: Context, date: Long): Int
Content copied to clipboard
Call this method to retrieve the number of messages received after the given date from local Database.
Link copied to clipboard
open fun getNumberOfSentMessage(@NonNull context: Context, date: Long): Int
Content copied to clipboard
Call this method to retrieve the number of messages sent after a given date from local Database.
Link copied to clipboard
Call this method to retrieve the number of unread conversations.
Link copied to clipboard
Link copied to clipboard
Call this method to retrieve the total number of unread messages from local Database.
Link copied to clipboard
Link copied to clipboard
open fun getOneToManyConversationByRecipients(@NonNull context: Context, @NonNull recipients: Array<String>): ThreadItem
Content copied to clipboard
Call this method to retrieve a one to many conversation from local Database object given groups and users.
Link copied to clipboard
open fun getRecipientAdminRoleInGroupConversation( @NonNull context: Context, @NonNull recipientPhoneNumber: String, @NonNull conversationId: String): Int
Content copied to clipboard
Call this method to retrieve the recipient role in the group conversation The given conversation should :
- be a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun getRegularAdminsOfGroupConversation(@NonNull context: Context, @NonNull conversationId: String): List<PhoneItem>
Content copied to clipboard
Call this method to retrieve list of regular administrator in group conversation The given conversation should :
- a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
Call This method to get the fallBack message delay for sending timer "SendingTimer" during which we wait for the message to be sent to the server.
Link copied to clipboard
Link copied to clipboard
open fun getThreadsByRecipients( @NonNull context: Context, @Nullable groups: List<ContactItem>, @Nullable phones: List<PhoneItem>): List<ThreadItem>
Content copied to clipboard
Call this method to retrieve all the conversations by the exact list of recipients (single user and group contacts)
Link copied to clipboard
Link copied to clipboard
CAll this method to choose whether you want play the voice message audio output on speaker or earpiece device.
Link copied to clipboard
open fun handleDraftMessage( @NonNull context: Context, @Nullable conversationID: String, @Nullable text: String, @Nullable attachment: BaseAttachment, isAvailableOnlyRecipients: Boolean, @Nullable recipients: Array<String>, bearer: Int, @Nullable callback: CompletionCallback)
Content copied to clipboard
Call this method to add, update or remove drafts in conversations from local database.
Link copied to clipboard
Call this method to check if there are more conversations to retrieve from BE or no
Link copied to clipboard
Link copied to clipboard
open fun iMAdmin(@NonNull context: Context, @Nullable conversationId: String): Boolean
Content copied to clipboard
Call this method to check if i'm an administrator in a group conversation :
- I'm an admin initiator
- I'm a regular administrator.
- or if the conversation without administrators, contains only groups
- be a group group conversation (THREAD_TYPE_GROUP).
- exist.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun inviteParticipants( @NonNull context: Context, @NonNull invitedRecipients: Array<String>, @NonNull conversationId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to invite new participants (users and/or groups) to the conversation.
Link copied to clipboard
open fun isConversationSupportGroupAdmin(@NonNull context: Context, @NonNull conversationId: String): Boolean
Content copied to clipboard
Call this method to check whether the conversation supports the administrator group or not The given conversation should :
- a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
- not related to a broadcast group call.
Link copied to clipboard
Call this method to check if the device is able to send messages via IM "Instant messaging".
Link copied to clipboard
open fun isMessageReadConfirmationEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Call this method to check whether the seen message feature is enabled from user settings or not.
Link copied to clipboard
Call this method to check whether the message acknowledgement is enabled from user settings or not.
Link copied to clipboard
Call this method to check if the device is able to send messages via SMS.
Link copied to clipboard
open fun leaveGroupConversation( @NonNull context: Context, @NonNull conversationId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to leave a group conversation.
Link copied to clipboard
open fun loadMessages( @NonNull context: Context, @NonNull conversationId: String, @Nullable loadMessagesCallback: ILoadMessages)
Content copied to clipboard
Call this method to load messages of the given threadItem.
Link copied to clipboard
open fun loadMoreMessages( @NonNull context: Context, @NonNull conversationId: String, @Nullable loadMessagesCallback: ILoadMessages)
Content copied to clipboard
Call this method to load more messages of configured thread.
Link copied to clipboard
open fun readAllMessagesOfConversation( @NonNull context: Context, @NonNull conversationId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to mark all messages of the conversation as read and synced with back-end.
Link copied to clipboard
open fun readMessages( @NonNull context: Context, @NonNull messageList: List<BaseMessage>, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to mark as read the given message list and synced with back-end.
Link copied to clipboard
open fun registerToConversation(@NonNull conversationObservable: IConversationObservable)
Content copied to clipboard
Register to all events coming from any conversation.
open fun registerToConversation(@NonNull conversationId: String, @NonNull conversationObservable: IConversationObservable)
Content copied to clipboard
Register to all events related to the given conversationId
Link copied to clipboard
open fun registerToMessagingSetting(@NonNull messagingSettingsListener: IMessagingSettingsListener)
Content copied to clipboard
Register to all events coming from any message settings.
Link copied to clipboard
open fun removeGroupsFromConversation( @NonNull context: Context, @NonNull conversationId: String, @NonNull groups: List<String>, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to remove a group from a group conversation.
Link copied to clipboard
open fun removeRegularAdmin( @NonNull context: Context, @NonNull conversationId: String, @NonNull adminPhoneNumber: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to remove a regular admin from the current group conversation, means the adminPhoneNumber will be a simple member The given conversation should
- be a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun removeRegularAdmins( @NonNull context: Context, @NonNull conversationId: String, @NonNull adminPhoneNumberList: List<String>, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to remove the regular admin list from the current group conversation, means the adminPhoneNumberList will be all a simple members The given conversation should
- be a group group conversation (THREAD_TYPE_GROUP).
- exist and active.
- not related to a MyBusiness process.
- not an emergency conversation.
Link copied to clipboard
open fun removeUserFromGroupConversation( @NonNull context: Context, @NonNull conversationId: String, @NonNull removedInternationalNumber: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to remove a user from a group conversation.
Link copied to clipboard
open fun resendMessage( @NonNull context: Context, @NonNull messageId: String, @Nullable completion: CompletionCallback)
Content copied to clipboard
Call this method to resend a failed message.
Link copied to clipboard
open fun searchConversation(@NonNull context: Context, @NonNull searchKey: String): List<ThreadItem>
Content copied to clipboard
Call this method to search for conversation contains the given searchKey (search in message text contains the given searchKey).
Link copied to clipboard
open fun searchConversationContainsFile(@NonNull context: Context, @Nullable searchKey: String): List<ThreadItem>
Content copied to clipboard
Call this method to search for any conversations contains a document or a file attachment given a searchKey.
Link copied to clipboard
open fun searchExternalConversations(@NonNull context: Context, @NonNull searchKey: String): List<ThreadItem>
Content copied to clipboard
Call this method to search for all call out conversation contains the given searchKey (search in message text contains the given searchKey).
Link copied to clipboard
open fun sendMessage( @Nullable message: String, @Nullable attachment: BaseAttachment, @NonNull conversationId: String, isRequireAcknowledgement: Boolean, bearer: Int, @Nullable completion: CompletionCallback)
Content copied to clipboard
Call this method to send a new message/attachment for an existing conversation.
open fun sendMessage( @Nullable message: String, @Nullable attachment: BaseAttachment, @NonNull recipients: Array<String>, conversationType: Int, @Nullable conversationName: String, isAvailableOnlyRecipients: Boolean, isRequireAcknowledgement: Boolean, bearer: Int, @Nullable completion: CompletionCallback)
Content copied to clipboard
Call this method to send a new message/attachment A new conversation will be created based on the users, groups and the conversationType parameters.
Link copied to clipboard
open fun sendVoiceMessagePlayed( @NonNull context: Context, @NonNull messageId: String, @Nullable callback: STWOperationCallback<MessagingError>)
Content copied to clipboard
Call this method to synchronize voice message play with the webChat.
Link copied to clipboard
Content copied to clipboard
Call this method to set the period of time after which the messages will be deleted permanently in milli seconds.
Link copied to clipboard
open fun setVoiceMessageAudioSetting(@NonNull context: Context, option: Int)
Content copied to clipboard
Call this method to choose whether you want play the voice message audio output on speaker or earpiece device
Link copied to clipboard
open fun unregisterToConversation(@NonNull conversationObservable: IConversationObservable)
Content copied to clipboard
open fun unregisterToConversation(@NonNull conversationId: String, @NonNull conversationObservable: IConversationObservable)
Content copied to clipboard
Unregister a previously registered conversation callback
Same as unregisterToConversation but do a cleaning for all registered callback related to the given conversationId
Link copied to clipboard
open fun unregisterToMessagingSetting(@NonNull messagingSettingsListener: IMessagingSettingsListener)
Content copied to clipboard
Unregister a previously registered message settings callback
Link copied to clipboard
open fun updateConversationAvailability( @NonNull context: Context, @NonNull thread: ThreadItem, availability: Boolean)
Content copied to clipboard
Call this method to update the availability property of the conversation in the local Database.