Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
Message
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

List replies in a message thread

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.

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

ThreadedMessageListParams

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.

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

List of argument

Argument nameTypeDescription

TIMESTAMP

long

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