Optional
ext?: anyOptional
isOptional
isOptional
marks?: ChatConversationMarkType[]Optional
pinnedThe conversation ID.
The conversation type.
Optional
extThe conversation extension.
Whether the current conversation is a thread conversation.
true
: Yes.false
: No.Note
This parameter is valid only for group chat.
Optional
isWhether the conversation is pinned:
true
: Yes.false
: No.Optional
marksThe conversation marks.
Optional
pinnedThe UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is 0
when the conversation is not pinned.
Deletes all the messages of the conversation.
This method deletes all the messages of the conversation from both the memory and local database.
A description of the exception. See ChatError.
Deletes a message from the local database.
The ID of message to delete.
A description of the exception. See ChatError.
Deletes messages sent or received in a certain period from the local database.
params
A description of the exception. See ChatError.
Gets the pinned messages in the conversation from the server.
The list of pinned messages. If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
Gets the latest message from the conversation.
The message instance. The SDK returns undefined
if the message does not exist.
A description of the exception. See ChatError.
Gets the latest message received in the conversation.
The message instance. The SDK returns undefined
if the message does not exist.
A description of the exception. See ChatError.
Gets the count of messages in the conversation.
The count of messages.
A description of the exception. See ChatError.
Gets messages of a certain quantity in a conversation from the local database.
Note
The obtained messages will also join the existing messages of the conversation stored in the memory.
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.
- If direction
is set as ChatSearchDirection.UP
, the SDK retrieves messages, starting from the latest one, in the descending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.
- If direction
is set as ChatSearchDirection.DOWN
, the SDK retrieves messages, starting from the oldest one, in the ascending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.The maximum number of messages to retrieve each time. The value range is [1,400].
The message list (excluding the ones with the starting or ending timestamp). If no message is obtained, an empty list is returned.
Gets messages with keywords in a conversation in the local database.
The keywords for query.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.Up
: Messages are retrieved in the descending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.ChatSearchDirection.Down
: Messages are retrieved in the ascending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) 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 the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.
The maximum number of messages to retrieve each time. The value range is [1,400].
Optional
sender: stringThe 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.
A description of the exception. See ChatError.
2024-04-17 This method is deprecated. Use getMsgsWithKeyword instead.
Gets messages of a certain type that a specified user sends in a conversation.
The message type. See ChatMessageType.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending of the Unix timestamp (ChatOptions.sortMessageByServerTime) 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].
Optional
sender: stringThe 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.
A description of the exception. See ChatError.
2024-04-17 This method is deprecated. Use getMsgsWithMsgType instead.
Gets messages that are sent and received in a certain period in a conversation in the local database.
The starting Unix timestamp for search. The unit is millisecond.
The ending Unix timestamp for search. The unit is millisecond.
The message search direction. See ChatSearchDirection.
ChatSearchDirection.UP
: Messages are retrieved in the descending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.ChatSearchDirection.DOWN
: Messages are retrieved in the ascending order of the Unix timestamp (ChatOptions.sortMessageByServerTime) included in them.The maximum number of messages to retrieve each time. The value range is [1,400].
The list of retrieved messages (excluding the ones with the starting or ending timestamp). If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
2024-04-17 This method is deprecated. Use getMsgWithTimestamp instead.
Gets 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.
Optional
direction?: ChatSearchDirectionOptional
loadThe list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
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.
Optional
count?: numberOptional
direction?: ChatSearchDirectionOptional
searchOptional
sender?: stringOptional
timestamp?: numberThe list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
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.A description of the exception. See ChatError.
Gets 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.
Optional
count?: numberOptional
direction?: ChatSearchDirectionOptional
sender?: stringOptional
timestamp?: numberThe list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
Gets 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.
Optional
count?: numberOptional
direction?: ChatSearchDirectionThe list of retrieved messages (excluding with the ones with the starting or ending timestamp). If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
Gets the pinned messages in the conversation from the local database.
The list of pinned messages. If no message is obtained, an empty list is returned.
A description of the exception. See ChatError.
Gets the count of unread messages in the conversation.
The count of unread messages.
A description of the exception. See ChatError.
Marks all messages as read.
A description of the exception. See ChatError.
Marks a message as read.
The message ID.
A description of the exception. See ChatError.
Deletes messages from the conversation (from both local storage and server).
The IDs of messages to delete from the current conversation.
A description of the exception. See ChatError.
Deletes messages from the conversation (from both local storage and server).
The message timestamp in millisecond. The messages with the timestamp smaller than the specified one will be deleted.
A description of the exception. See ChatError.
Sets the extension information of the conversation.
The extension information of the conversation. This parameter must be in the key-value format.
A description of the exception. See ChatError.
Updates a message in the local database.
After you modify a message, the message ID remains unchanged and the SDK automatically updates attributes of the conversation, like latestMessage
.
The message instance.
A description of the exception. See ChatError.
The conversation class, which defines one-to-one conversations, group conversations, and chat room conversations.
Each type of conversation involves messages that are sent and received.
You can get the conversation name by conversation type: