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 changelogs of messages

Each message changelog has distinct properties such as the timestamp of an updated message or the unique ID of a deleted message. Based on these two properties, you can retrieve message changelogs using either the timestamp or the token. Both the getMessageChangeLogsSinceTimestamp() and getMessageChangeLogsSinceToken() methods require a parameter MessageChangeLogsParams object to determine which messages to return.

const params: MessageChangeLogsParams = {
    replyType: REPLY_TYPE,
    includeThreadInfo: INCLUDE_THREAD_INFO,
    includeParentMessageInfo: INCLUDE_PARENT_MESSAGE_INFO,
};

MessageChangeLogsParams

Property nameTypeDescription

replyType

string

Specifies the type of message to include in the result returned.
- NONE (default): Includes unthreaded messages and only the parent messages of threaded messages.
- ALL: Includes both threaded and unthreaded messages.
- ONLY_REPLY_TO_CHANNEL: Includes unthreaded messages, parent messages of threaded messages, and messages sent to the channel as replies with the reply_to_channel property set to true.

includeThreadInfo

boolean

Determines whether to include message thread information in the result returned. (Default: false)

includeParentMessageInfo

boolean

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

includeMetaArray

boolean

Determines whether to include information about meta array in the result returned. (Default: false)

includeReactions

boolean

Determines whether to include information about emoji reactions in the result returned. (Default: false)

By timestamp

You can retrieve message changelogs by specifying a timestamp. The results include changelogs that were created after the specified timestamp.

const {
    updatedMessages,
    deletedMessageIds,
    hasMore,
    token,
} = await channel.getMessageChangeLogsSinceTimestamp(TIMESTAMP, params);

List of arguments

Argument nameTypeDescription

TIMESTAMP

long

Specifies the timestamp to be the reference point for changelogs to retrieve in Unix milliseconds format.

By token

You can also retrieve message changelogs by specifying a token. The token is an opaque string that marks the starting point of the next page in the result set and it's included in the callback of the previous call. Based on the token, the next page starts with changelogs that were created after the specified token.

const {
    updatedMessages,
    deletedMessageIds,
    hasMore,
    token,
} = await channel.getMessageChangeLogsSinceToken(TOKEN, params);

List of arguments

Argument nameTypeDescription

TOKEN

string

Specifies the token to be the reference point for changelogs to retrieve.