/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

List replies in a message thread

Copy link

You can retrieve replies of a parent message if you can determine the parent message. First, create a ThreadedMessageListParams object and set properties related to the thread where the target replies belong to.

JavaScriptTypeScript
const params = {
    prevResultSize: PREV_RESULT_SIZE,
    nextResultSize: NEXT_RESULT_SIZE,
    isInclusive: INCLUSIVE,
    reverse: REVERSE,
    includeParentMessageInfo: INCLUDE_PARENT_MESSAGE_INFO,
};

ThreadedMessageListParams

Copy link
Property nameTypeDescription

prevResultSize

int

Specifies the number of messages to retrieve that were sent before the specified timestamp or message ID.

nextResultSize

int

Specifies the number of messages to retrieve that were sent after the specified timestamp or message ID.

isInclusive

boolean

Determines whether to include the messages with the matching timestamp or message ID in the results. (Default: false)

reverse

boolean

Determines whether to sort the retrieved messages in reverse order. If false, the results are in ascending order. (Default: false)

includeParentMessageInfo

boolean

Determines whether to include the information of the parent messages in the result. (Default: false)

includeParentMessageText

boolean

(Deprecated) Determines whether to include the parent message text in the results when the messages are replies in a thread. If the type of the parent message is UserMessage, the value is a message property. If it is FileMessage, the value is the name of the uploaded file.

With the timestamp of the parent message, you can retrieve its replies by passing a ThreadedMessageListParams object as an argument to the parameter in the getThreadedMessagesByTimestamp() method.

JavaScriptTypeScript
const {
    parentMessage,
    threadedMessages,
} = await parentMessage.getThreadedMessagesByTimestamp(TIMESTAMP, params);

List of argument

Copy link
Argument nameTypeDescription

TIMESTAMP

long

Specifies the timestamp to be the reference point of the retrieval in Unix milliseconds format.