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

List changelogs of messages

Copy link

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 take a MessageChangeLogsParams object as an optional parameter that determines which messages to return.

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

MessageChangeLogsParams

Copy link
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

Copy link

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

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

List of arguments

Copy link
Argument nameTypeDescription

TIMESTAMP

long

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

By token

Copy link

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.

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

List of arguments

Copy link
Argument nameTypeDescription

TOKEN

string

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