Options
All
  • Public
  • Public/Protected
  • All
Menu

export manager

Hierarchy

  • BaseManager
    • ChatManager

Index

Constructors

Properties

Methods

Constructors

Properties

_eventEmitter?: NativeEventEmitter
_messageListeners: Set<ChatMessageEventListener>
TAG: string = 'ChatManager'

Methods

  • addReaction(reaction: string, msgId: string): Promise<void>
  • Adds a Reaction.

    throws

    A description of the exception. See ChatError.

    Parameters

    • reaction: string

      The Reaction content.

    • msgId: string

      The ID of the message for which the Reaction is added.

    Returns Promise<void>

  • createChatThread(name: string, msgId: string, parentId: string): Promise<ChatMessageThread>
  • 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:

    throws

    A description of the exception. See ChatError.

    Parameters

    • name: string

      The name of the new message thread. It can contain a maximum of 64 characters.

    • msgId: string

      The ID of the parent message.

    • parentId: string

      The parent ID, which is the group ID.

    Returns Promise<ChatMessageThread>

    If success, the new message thread object is returned; otherwise, an exception will be thrown.

  • deleteConversation(convId: string, withMessage?: boolean): Promise<void>
  • Deletes a conversation and its local messages from the local database.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • withMessage: boolean = true

      Whether to delete the historical messages with the conversation.

      • (Default) true: Yes.
      • false: No.

    Returns Promise<void>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • Deletes a message from the local database.

    note If the conversation object does not exist, this method will create it.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • deleteMessagesBeforeTimestamp(timestamp: number): Promise<void>
  • Deletes local messages with timestamp that is before the specified one.

    throws

    A description of the exception. See ChatError.

    Parameters

    • timestamp: number

      The specified Unix timestamp(milliseconds).

    Returns Promise<void>

  • deleteMessagesWithTimestamp(convId: string, convType: ChatConversationType, params: { endTs: number; startTs: number }): Promise<void>
  • 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.

    params

    params

    • startTs: The starting UNIX timestamp for message deletion. The unit is millisecond.
    • endTs: The end UNIX timestamp for message deletion. The unit is millisecond.
    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • destroyChatThread(chatThreadId: string): Promise<void>
  • Downloads the message attachment.

    You can also call this method if the attachment fails to be downloaded automatically.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • Downloads the message thumbnail.

    throws

    A description of the exception. See ChatError.

    Parameters

    • message: ChatMessage

      The ID of the message with the thumbnail to be downloaded. Only the image messages and video messages have a thumbnail.

    • Optional callback: ChatMessageStatusCallback

    Returns Promise<void>

  • deprecated

    2023-07-24

    Gets the conversation list from the server.

    Note

    • To use this function, you need to contact our business manager to activate it.
    • After this function is activated, users can pull 10 conversations within 7 days by default (each conversation contains the latest historical message).
    • If you want to adjust the number of conversations or time limit, contact our business manager.
    throws

    A description of the exception. See ChatError.

    Returns Promise<ChatConversation[]>

    The conversation list of the current user.

  • fetchChatThreadFromServer(chatThreadId: string): Promise<undefined | ChatMessageThread>
  • Gets the details of the message thread from the server.

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The message thread ID.

    Returns Promise<undefined | ChatMessageThread>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • parentId: string

      The parent ID, which is the group ID.

    • cursor: string = ''

      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.

    • pageSize: number = 20

      The number of message threads that you expect to get on each page. The value range is [1,400].

    Returns Promise<ChatCursorResult<ChatMessageThread>>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<ChatMessage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • Optional cursor: string
    • Optional pageSize: number

    Returns Promise<ChatCursorResult<ChatConversation>>

    The list of retrieved conversations.

  • fetchConversationsFromServerWithPage(pageSize: number, pageNum: number): Promise<ChatConversation[]>
  • Gets conversations from the server with pagination.

    throws

    A description of the exception. See ChatError.

    Parameters

    • pageSize: number

      The number of conversations to retrieve on each page.

    • pageNum: number

      The current page number, starting from 1.

    Returns Promise<ChatConversation[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    • groupId: string
    • startAckId: string

      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.

    • pageSize: number = 0

      The number of read receipts for the group message that you expect to get on each page. The value range is [1,400].

    Returns Promise<ChatCursorResult<ChatGroupMessageAck>>

    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.

    params

    params

    • pageSize: The number of messages that you expect to get on each page. The value range is [1,50].
    • startMsgId: The starting message ID for query. After this parameter is set, the SDK retrieves messages, starting from the specified one, in the reverse chronological order of when the server receives them. If this parameter is set an empty string, the SDK retrieves messages, starting from the latest one, in the reverse chronological order of when the server receives them.
    • direction: 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.
    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<ChatCursorResult<ChatMessage>>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • chatType: ChatConversationType

      The conversation type. See ChatConversationType.

    • Optional params: { cursor?: string; options?: ChatFetchMessageOptions; pageSize?: number }
      • options: The parameter configuration class for pulling historical messages from the server. See ChatFetchMessageOptions.
      • cursor: The cursor position from which to start querying data.
      • pageSize: The number of messages that you expect to get on each page. The value range is [1,50].

    Returns Promise<ChatCursorResult<ChatMessage>>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • cursor: string = ''

      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.

    • pageSize: number = 20

      The number of message threads that you expect to get on each page. The value range is [1,400].

    Returns Promise<ChatCursorResult<ChatMessageThread>>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • parentId: string

      The parent ID, which is the group ID.

    • cursor: string = ''

      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.

    • pageSize: number = 20

      The number of message threads that you expect to get on each page. The value range is [1,400].

    Returns Promise<ChatCursorResult<ChatMessageThread>>

    If success, a list of message threads is returned; otherwise, an exception will be thrown.

  • fetchLastMessageWithChatThread(chatThreadIds: string[]): Promise<Map<string, ChatMessage>>
  • Gets the last reply in the specified message threads from the server.

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadIds: string[]

      The list of message thread IDs to query. You can pass a maximum of 20 message thread IDs each time.

    Returns Promise<Map<string, ChatMessage>>

    If success, a list of last replies are returned; otherwise, an exception will be thrown.

  • fetchMembersWithChatThreadFromServer(chatThreadId: string, cursor?: string, pageSize?: number): Promise<string[]>
  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The message thread ID.

    • cursor: string = ''

      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.

    • pageSize: number = 20

      The number of members that you expect to get on each page. The value range is [1,400].

    Returns Promise<string[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • Optional cursor: string
    • Optional pageSize: number

    Returns Promise<ChatCursorResult<ChatConversation>>

    The list of retrieved conversations.

  • Gets the Reaction details.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    • reaction: string

      The Reaction content.

    • Optional cursor: string

      The cursor position from which to start getting Reactions.

    • Optional pageSize: number

      The number of Reactions you expect to get on each page.

    Returns Promise<ChatCursorResult<ChatMessageReaction>>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgIds: string[]

      The message ID list.

    • groupId: string

      The group ID, which is invalid only when the chat type is group chat.

    • chatType: ChatMessageChatType

      The chat type.

    Returns Promise<Map<string, ChatMessageReaction[]>>

    If success, the Reaction list is returned; otherwise, an exception is thrown.

  • Gets all languages supported by the translation service.

    throws

    A description of the exception. See ChatError.

    Returns Promise<ChatTranslateLanguage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Returns Promise<ChatConversation[]>

    The retrieved conversations.

  • Gets the conversation by conversation ID and conversation type.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • createIfNeed: boolean = true

      Whether to create a conversation if the specified conversation is not found:

      • (Default) true: Yes.
      • false: No.

    Returns Promise<undefined | ChatConversation>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<number>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<undefined | ChatMessage>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<undefined | ChatMessage>

    The message instance. The SDK returns undefined if the message does not exist.

  • getMessage(msgId: string): Promise<undefined | ChatMessage>
  • Gets a message from the local database by message ID.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    Returns Promise<undefined | ChatMessage>

    The message.

  • Gets the details of the message thread from the memory.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message thread ID.

    Returns Promise<undefined | ChatMessageThread>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • startTime: number

      The starting Unix timestamp for query, in milliseconds.

    • endTime: number

      The ending Unix timestamp for query, in milliseconds.

    • direction: ChatSearchDirection = ChatSearchDirection.UP

      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.
    • count: number = 20

      The maximum number of messages to retrieve each time. The value range is [1,400].

    Returns Promise<ChatMessage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • startMsgId: string

      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.

    • direction: ChatSearchDirection = ChatSearchDirection.UP

      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.
    • loadCount: number = 20

      The maximum number of messages to retrieve each time. The value range is [1,50].

    Returns Promise<ChatMessage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • keywords: string

      The keywords for query.

    • direction: ChatSearchDirection = ChatSearchDirection.UP

      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.
    • timestamp: number = -1

      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.

    • count: number = 20

      The maximum number of messages to retrieve each time. The value range is [1,400].

    • Optional sender: string

      The user ID or group ID for retrieval. Usually, it is the conversation ID.

    Returns Promise<ChatMessage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • msgType: ChatMessageType

      The message type. See ChatMessageType.

    • direction: ChatSearchDirection = ChatSearchDirection.UP

      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.
    • timestamp: number = -1

      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.

    • count: number = 20

      The maximum number of messages to retrieve each time. The value range is [1,400].

    • Optional sender: string

      The user ID or group ID for retrieval. Usually, it is the conversation ID.

    Returns Promise<ChatMessage[]>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    Returns Promise<ChatMessageReaction[]>

    If success, the Reaction list is returned; otherwise, an exception will be thrown.

  • getThreadConversation(convId: string, createIfNeed?: boolean): Promise<undefined | ChatConversation>
  • Gets the thread conversation by conversation ID.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • createIfNeed: boolean = true

      Whether to create a conversation if the specified conversation is not found:

      • (Default) true: Yes.
      • false: No.

    Returns Promise<undefined | ChatConversation>

    The retrieved conversation object. The SDK returns null if the conversation is not found.

  • getUnreadCount(): Promise<number>
  • Gets the count of the unread messages.

    throws

    A description of the exception. See ChatError.

    Returns Promise<number>

    The count of the unread messages.

  • groupAckCount(msgId: string): Promise<number>
  • Gets the number of members that have read the group message.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    Returns Promise<number>

    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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • 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:

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The message thread ID.

    Returns Promise<ChatMessageThread>

    If success, the message thread details ChatMessageThread are returned; otherwise, an exception will be thrown.

  • leaveChatThread(chatThreadId: string): Promise<void>
  • Leaves a message thread.

    Each member in the message thread can call this method.

    In a multi-device login scenario, note the following:

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The ID of the message thread that the current user wants to leave.

    Returns Promise<void>

  • markAllConversationsAsRead(): Promise<void>
  • Marks all conversations as read.

    This method is for the local conversations only.

    throws

    A description of the exception. See ChatError.

    Returns Promise<void>

  • Marks all messages as read.

    note If the conversation object does not exist, this method will create it.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • Marks a message as read.

    note If the conversation object does not exist, this method will create it.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<ChatMessage>

    The modified message. See ChatMessageBody.

  • onChatMessageThreadCreated(params: any): void
  • Parameters

    • params: any

    Returns void

  • onChatMessageThreadDestroyed(params: any): void
  • Parameters

    • params: any

    Returns void

  • onChatMessageThreadUpdated(params: any): void
  • Parameters

    • params: any

    Returns void

  • onChatMessageThreadUserRemoved(params: any): void
  • Parameters

    • params: any

    Returns void

  • onCmdMessagesReceived(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onConversationHasRead(params: any): void
  • Parameters

    • params: any

    Returns void

  • onConversationsUpdate(): void
  • Returns void

  • onGroupMessageRead(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onMessageContentChanged(params: any): void
  • Parameters

    • params: any

    Returns void

  • onMessageReactionDidChange(params: any): void
  • Parameters

    • params: any

    Returns void

  • onMessagesDelivered(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onMessagesRead(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onMessagesRecalled(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onMessagesReceived(messages: any[]): void
  • Parameters

    • messages: any[]

    Returns void

  • onReadAckForGroupMessageUpdated(params: any): void
  • Parameters

    • params: any

    Returns void

  • pinConversation(convId: string, isPinned: boolean): Promise<void>
  • Sets whether to pin a conversation.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • isPinned: boolean

      Whether to pin a conversation:

      • true:Yes.
      • false: No. The conversation is unpinned.

    Returns Promise<void>

  • recallMessage(msgId: string): Promise<void>
  • Recalls the sent message.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    Returns Promise<void>

  • removeAllMessageListener(): void
  • Removes all message listeners.

    Returns void

  • removeConversationFromServer(convId: string, convType: ChatConversationType, isDeleteMessage?: boolean): Promise<void>
  • Deletes the specified conversation and its historical messages from the server.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • isDeleteMessage: boolean = true

      Whether to delete the historical messages with the conversation.

      • (Default) true: Yes.
      • false: No.

    Returns Promise<void>

  • removeMemberWithChatThread(chatThreadId: string, memberId: string): Promise<void>
  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The message thread ID.

    • memberId: string

      The user ID of the member to be removed from the message thread.

    Returns Promise<void>

  • Removes the message listener.

    Parameters

    Returns void

  • removeMessagesFromServerWithMsgIds(convId: string, convType: ChatConversationType, msgIds: string[]): Promise<void>
  • Deletes messages from the conversation (from both local storage and server).

    note If the conversation object does not exist, this method will create it.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation Type.

    • msgIds: string[]

      The IDs of messages to delete from the current conversation.

    Returns Promise<void>

  • removeMessagesFromServerWithTimestamp(convId: string, convType: ChatConversationType, timestamp: number): Promise<void>
  • Deletes messages from the conversation (from both local storage and server).

    note If the conversation object does not exist, this method will create it.

    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation Type.

    • timestamp: number

      The message timestamp in millisecond. The messages with the timestamp smaller than the specified one will be deleted.

    Returns Promise<void>

  • removeReaction(reaction: string, msgId: string): Promise<void>
  • Deletes a Reaction.

    throws

    A description of the exception. See ChatError.

    Parameters

    • reaction: string

      The Reaction to delete.

    • msgId: string

      The message ID.

    Returns Promise<void>

  • reportMessage(msgId: string, tag: string, reason: string): Promise<void>
  • Reports an inappropriate message.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The ID of the message to report.

    • tag: string

      The tag of the inappropriate message. You need to type a custom tag, like porn or ad.

    • reason: string

      The reporting reason. You need to type a specific reason.

    Returns Promise<void>

  • Resends a message.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • Retrieves messages with keywords in a conversation from the local database.

    throws

    A description of the exception. See ChatError.

    Parameters

    • keywords: string

      The keywords for query.

    • timestamp: number = -1

      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.

    • maxCount: number = 20

      The maximum number of messages to retrieve each time. The value range is [1,400].

    • from: string = ''

      The user ID or group ID for retrieval. Usually, it is the conversation ID.

    • direction: ChatSearchDirection = ChatSearchDirection.UP

      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.

    Returns Promise<ChatMessage[]>

    The list of retrieved messages (excluding the one with the starting timestamp). If no message is obtained, an empty list is returned.

  • sendConversationReadAck(convId: string): Promise<void>
  • Sends the conversation read receipt to the server.

    Note

    • This method is valid only for one-to-one conversations.
    • After this method is called, the sever will set the message status from unread to read.
    • The SDK triggers the ChatMessageEventListener.onConversationRead callback on the client of the message sender, notifying that the messages are read. This also applies to multi-device scenarios.
    throws

    A description of the exception. See ChatError.

    Parameters

    • convId: string

      The conversation ID.

    Returns Promise<void>

  • sendGroupMessageReadAck(msgId: string, groupId: string, opt?: { content: string }): Promise<void>
  • Sends the group message receipt to the server.

    Note

    throws

    A description of the exception. See ChatError.

    Parameters

    • msgId: string

      The message ID.

    • groupId: string

      The group ID.

    • Optional opt: { content: string }

      The extension information, which is a custom keyword that specifies a custom action or command.

      • content: string

    Returns Promise<void>

  • Sends a message.

    Note

    • For a voice or image message or a message with an attachment, the SDK will automatically upload the attachment.
    • You can determine whether to upload the attachment to the chat sever by setting ChatOptions.
    throws

    A description of the exception. See ChatError.

    Parameters

    • message: ChatMessage

      The message object to be sent. Ensure that you set this parameter.

    • Optional callback: ChatMessageStatusCallback

      The listener that listens for message changes.

    Returns Promise<void>

  • sendMessageReadAck(message: ChatMessage): Promise<void>
  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • message: ChatMessage

      The message for which the read receipt is to be sent.

    Returns Promise<void>

  • Sets the extension information of the conversation.

    note If the conversation object does not exist, this method will create it.

    Parameters

    • convId: string

      The conversation ID.

    • convType: ChatConversationType

      The conversation type. See ChatConversationType.

    • ext: {}

      The extension information. This parameter must be key-value type.

      • [key: string]: string | number | boolean

    Returns Promise<void>

  • setNativeListener(event: NativeEventEmitter): void
  • Parameters

    • event: NativeEventEmitter

    Returns void

  • Translates a text message.

    throws

    A description of the exception. See ChatError.

    Parameters

    • msg: ChatMessage

      The text message to translate.

    • languages: string[]

      The target languages.

    Returns Promise<ChatMessage>

    The translation.

  • updateChatThreadName(chatThreadId: string, newName: string): Promise<void>
  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    • chatThreadId: string

      The message thread ID.

    • newName: string

      The new message thread name. It can contain a maximum of 64 characters.

    Returns Promise<void>

  • 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.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<void>

  • Updates the local message.

    The message will be updated both in the memory and local database.

    throws

    A description of the exception. See ChatError.

    Parameters

    Returns Promise<ChatMessage>

    The updated message.

  • _callMethod<T>(method: string, args?: {}): Promise<T>
  • Type Parameters

    • T

    Parameters

    • method: string
    • Optional args: {}

      Returns Promise<T>

    • checkErrorFromResult(result: any): void
    • Parameters

      • result: any

      Returns void

    • handleGroupFileCallback(methodName: string, self: BaseManager, groupId: string, filePath: string, callback?: ChatGroupFileStatusCallback): void
    • Parameters

      Returns void

    Generated using TypeDoc