Adds a message listener.
The message listener to add.
Adds a Reaction.
The Reaction content.
The ID of the message for which the Reaction is added.
Creates a message thread.
Each member of the group where the thread belongs can call this method.
Upon the creation of a message thread, the following will occur:
In a single-device login scenario, each member of the group to which the message thread belongs will receive the ChatMessageEventListener.onChatMessageThreadCreated callback. You can listen for message thread events by setting ChatMessageEventListener.
In a multi-device login scenario, the devices will receive the ChatMultiDeviceEventListener.onThreadEvent callback. You can listen for message thread events by setting ChatMultiDeviceEventListener.
The name of the new message thread. It can contain a maximum of 64 characters.
The ID of the parent message.
The parent ID, which is the group ID.
If success, the new message thread object is returned; otherwise, an exception will be thrown.
Deletes a conversation and its local messages from the local database.
The conversation ID.
Whether to delete the historical messages with the conversation.
true
: Yes.false
: No.Whether the conversation is successfully deleted.
true
: Yes.false
: No.Deletes all messages in the conversation from both the memory and local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
Deletes a message from the local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The ID of the message to delete.
Deletes local messages with timestamp that is before the specified one.
The specified Unix timestamp(milliseconds).
Deletes messages sent or received in a certain period from the local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
Destroys the message thread.
Only the owner or admins of the group where the message thread belongs can call this method.
Note
In a single-device login scenario, each member of the group to which the message thread belongs will receive the ChatMessageEventListener.onChatMessageThreadDestroyed callback. You can listen for message thread events by setting ChatMessageEventListener.
In a multi-device login scenario, the devices will receive the ChatMultiDeviceEventListener.onThreadEvent callback. You can listen for message thread events by setting ChatMultiDeviceEventListener.
The message thread ID.
Downloads the message attachment.
You can also call this method if the attachment fails to be downloaded automatically.
The ID of the message with the attachment to be downloaded.
The listener that listens for message changes.
Downloads the message thumbnail.
The ID of the message with the thumbnail to be downloaded. Only the image messages and video messages have a thumbnail.
The conversation list of the current user.
Gets the details of the message thread from the server.
The message thread ID.
If success, the details of the message thread are returned; otherwise, an exception will be thrown.
Uses the pagination to get the list of message threads in the specified group.
This method gets data from the server.
The parent ID, which is the group ID.
The position from which to start getting data. At the first method call, if you set cursor
to null
or an empty string, the SDK will get data in the reverse chronological order of when message threads are created.
The number of message threads that you expect to get on each page. The value range is [1,400].
If success, a list of message threads is returned; otherwise, an exception will be thrown.
Gets the list of original messages included in a combined message.
A combined message contains one or more multiple original messages.
The combined message.
The list of original messages in the message body.
Gets the list of conversations from the server with pagination.
The SDK retrieves the list of conversations in the reverse chronological order of their active time (generally the timestamp of the last message).
If there is no message in the conversation, the SDK retrieves the list of conversations in the reverse chronological order of their creation time.
The list of retrieved conversations.
Gets conversations from the server with pagination.
The number of conversations to retrieve on each page.
The current page number, starting from 1.
If success, the list of conversations is returned; otherwise, an exception will be thrown.
Uses the pagination to get read receipts for group messages from the server.
For how to send read receipts for group messages, see sendConversationReadAck.
The message ID.
The starting read receipt ID for query. After this parameter is set, the SDK retrieves read receipts, from the specified one, in the reverse chronological order of when the server receives them.
If this parameter is set as null
or an empty string, the SDK retrieves read receipts, from the latest one, in the reverse chronological order of when the server receives them.
The number of read receipts for the group message that you expect to get on each page. The value range is [1,400].
The list of retrieved read receipts (excluding the one with the starting ID) and the cursor for the next query.
Uses the pagination to get messages in the specified conversation from the server.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The list of retrieved messages (excluding the one with the starting ID) and the cursor for the next query.
retrieve the history message for the specified session from the server.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The list of retrieved messages (excluding the one with the starting ID) and the cursor for the next query.
Uses the pagination to get the list of message threads that the current user has joined.
The position from which to start getting data. At the first method call, if you set cursor
to null
or an empty string, the SDK will get data in the reverse chronological order of when the user joins the message threads.
The number of message threads that you expect to get on each page. The value range is [1,400].
If success, a list of message threads is returned; otherwise, an exception will be thrown.
Uses the pagination to get the list of message threads that the current user has joined in the specified group.
This method gets data from the server.
The parent ID, which is the group ID.
The position from which to start getting data. At the first method call, if you set cursor
to null
or an empty string, the SDK will get data in the reverse chronological order of when the user joins the message threads.
The number of message threads that you expect to get on each page. The value range is [1,400].
If success, a list of message threads is returned; otherwise, an exception will be thrown.
Gets the last reply in the specified message threads from the server.
The list of message thread IDs to query. You can pass a maximum of 20 message thread IDs each time.
If success, a list of last replies are returned; otherwise, an exception will be thrown.
Uses the pagination to get a list of members in the message thread.
Each member of the group to which the message thread belongs can call this method.
The message thread ID.
The position from which to start getting data. At the first method call, if you set cursor
to null
or an empty string, the SDK will get data in the chronological order of when members join the message thread.
The number of members that you expect to get on each page. The value range is [1,400].
If success, the list of members in a message thread is returned; otherwise, an exception will be thrown.
Get the list of pinned conversations from the server with pagination.
The SDK returns the pinned conversations in the reverse chronological order of their pinning.
The list of retrieved conversations.
Gets the Reaction details.
The message ID.
The Reaction content.
The cursor position from which to start getting Reactions.
The number of Reactions you expect to get on each page.
If success, the SDK returns the Reaction details and the cursor for the next query. The SDK returns null
if all the data is fetched.
If a failure occurs, an exception is thrown.
Gets the list of Reactions.
The message ID list.
The group ID, which is invalid only when the chat type is group chat.
The chat type.
If success, the Reaction list is returned; otherwise, an exception is thrown.
Gets all languages supported by the translation service.
The list of languages supported for translation.
Gets all conversations from the local database.
Conversations will be first retrieved from the memory. If no conversation is found, the SDK retrieves from the local database.
The retrieved conversations.
Gets the conversation by conversation ID and conversation type.
The conversation ID.
The conversation type. See ChatConversationType.
Whether to create a conversation if the specified conversation is not found:
true
: Yes.false
: No.The retrieved conversation object. The SDK returns null
if the conversation is not found.
Gets the unread message count of the conversation.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The unread message count.
Gets the latest message from the conversation.
Note
The operation does not change the unread message count. If the conversation object does not exist, this method will create it.
The SDK gets the latest message from the memory first. If no message is found, the SDK loads the message from the local database and then puts it in the memory.
The conversation ID.
The conversation type. See ChatConversationType.
The message instance. The SDK returns undefined
if the message does not exist.
Gets the latest received message from the conversation.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The message instance. The SDK returns undefined
if the message does not exist.
Gets a message from the local database by message ID.
The message ID.
The message.
Gets the details of the message thread from the memory.
The message thread ID.
If success, the details of the message thread are returned; otherwise, an exception will be thrown.
Retrieves messages that are sent and received in a certain period in a conversation in the local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The starting Unix timestamp for query, in milliseconds.
The ending Unix timestamp for query, in milliseconds.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp included in them.The maximum number of messages to retrieve each time. The value range is [1,400].
The list of retrieved messages (excluding with the ones with the starting or ending timestamp). If no message is obtained, an empty list is returned.
Retrieves messages of a specified quantity in a conversation from the local database.
The retrieved messages will also be put in the conversation in the memory according to the timestamp included in them.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The starting message ID for query. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If this parameter is set an empty string, the SDK retrieves messages according to the message search direction while ignoring this parameter.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp included in them.The maximum number of messages to retrieve each time. The value range is [1,50].
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
Gets messages that the specified user sends in a conversation in a certain period.
This method gets data from the local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The keywords for query.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp included in them.The starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
The maximum number of messages to retrieve each time. The value range is [1,400].
The user ID or group ID for retrieval. Usually, it is the conversation ID.
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
Retrieves messages of a certain type in the conversation from the local database.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The message type. See ChatMessageType.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp included in them.The starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
The maximum number of messages to retrieve each time. The value range is [1,400].
The user ID or group ID for retrieval. Usually, it is the conversation ID.
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
Gets the list of Reactions from a message.
The message ID.
If success, the Reaction list is returned; otherwise, an exception will be thrown.
Gets the thread conversation by conversation ID.
The conversation ID.
Whether to create a conversation if the specified conversation is not found:
true
: Yes.false
: No.The retrieved conversation object. The SDK returns null
if the conversation is not found.
Gets the count of the unread messages.
The count of the unread messages.
Gets the number of members that have read the group message.
The message ID.
If success, the SDK returns the number of members that have read the group message; otherwise, an exception will be thrown.
Imports messages to the local database.
You can only import messages that you sent or received.
The messages to import.
Inserts a message to the conversation in the local database.
For example, when a notification messages is received, a message can be constructed and written to the conversation. If the message to insert already exits (msgId or localMsgId is existed), the insertion fails.
The message will be inserted based on the Unix timestamp included in it. Upon message insertion, the SDK will automatically update attributes of the conversation, including latestMessage
.
The message to be inserted.
Joins a message thread.
Each member of the group where the message thread belongs can call this method.
In a multi-device login scenario, note the following:
The devices will receive the ChatMultiDeviceEventListener.onThreadEvent callback.
You can listen for message thread events by setting ChatMultiDeviceEventListener.
The message thread ID.
If success, the message thread details ChatMessageThread are returned; otherwise, an exception will be thrown.
Leaves a message thread.
Each member in the message thread can call this method.
In a multi-device login scenario, note the following:
The devices will receive the ChatMultiDeviceEventListener.onThreadEvent callback.
You can listen for message thread events by setting ChatMultiDeviceEventListener.
The ID of the message thread that the current user wants to leave.
Marks all conversations as read.
This method is for the local conversations only.
Marks all messages as read.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
Marks a message as read.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The message ID.
Modifies a message.
After this method is called to modify a message, both the local message and the message on the server are modified.
This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.
The ID of the message to modify.
The modified text message body. See ChatTextMessageBody.
The modified message. See ChatMessageBody.
Sets whether to pin a conversation.
The conversation ID.
Whether to pin a conversation:
true
:Yes.false
: No. The conversation is unpinned.Recalls the sent message.
The message ID.
Removes all message listeners.
Deletes the specified conversation and its historical messages from the server.
The conversation ID.
The conversation type. See ChatConversationType.
Whether to delete the historical messages with the conversation.
true
: Yes.false
: No.Removes a member from the message thread.
Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.
The removed member will receive the ChatMessageEventListener.onChatMessageThreadUserRemoved callback.
You can listen for message thread events by setting ChatMessageEventListener.
The message thread ID.
The user ID of the member to be removed from the message thread.
Removes the message listener.
The message listener to remove.
Deletes messages from the conversation (from both local storage and server).
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation Type.
The IDs of messages to delete from the current conversation.
Deletes messages from the conversation (from both local storage and server).
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation Type.
The message timestamp in millisecond. The messages with the timestamp smaller than the specified one will be deleted.
Deletes a Reaction.
The Reaction to delete.
The message ID.
Reports an inappropriate message.
The ID of the message to report.
The tag of the inappropriate message. You need to type a custom tag, like porn
or ad
.
The reporting reason. You need to type a specific reason.
Resends a message.
The message object to be resent.
The listener that listens for message changes.
Retrieves messages with keywords in a conversation from the local database.
The keywords for query.
The starting Unix timestamp in the message for query. The unit is millisecond. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the timestamp included in them.
The maximum number of messages to retrieve each time. The value range is [1,400].
The user ID or group ID for retrieval. Usually, it is the conversation ID.
The message search direction. See ChatSearchDirection.
- (Default) ChatSearchDirection.Up
: Messages are retrieved in the descending order of the Unix timestamp included in them.
- ChatSearchDirection.Down
: Messages are retrieved in the ascending order of the Unix timestamp included in them.
The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
Sends the conversation read receipt to the server.
Note
The conversation ID.
Sends the group message receipt to the server.
Note
true
.The message ID.
The group ID.
The extension information, which is a custom keyword that specifies a custom action or command.
Sends a message.
Note
The message object to be sent. Ensure that you set this parameter.
The listener that listens for message changes.
Sends the read receipt to the server.
This method applies to one-to-one chats only.
Note
This method takes effect only when you set ChatOptions.requireAck as true
.
To send a group message read receipt, you can call sendGroupMessageReadAck.
We recommend that you call sendConversationReadAck when opening the chat page. In other cases, you can call this method to reduce the number of method calls.
The message for which the read receipt is to be sent.
Sets the extension information of the conversation.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The extension information. This parameter must be key-value type.
Translates a text message.
The text message to translate.
The target languages.
The translation.
Changes the name of the message thread.
Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.
Each member of the group to which the message thread belongs will receive the ChatMessageEventListener.onChatMessageThreadUpdated callback.
You can listen for message thread events by setting ChatMessageEventListener.
The message thread ID.
The new message thread name. It can contain a maximum of 64 characters.
Updates a message in the local database.
After you modify a message, the message ID remains unchanged and the SDK automatically updates properties of the conversation, like latestMessage
.
note If the conversation object does not exist, this method will create it.
The conversation ID.
The conversation type. See ChatConversationType.
The ID of the message to update.
Updates the local message.
The message will be updated both in the memory and local database.
The updated message.
Generated using TypeDoc
export manager