MessageClient reference
Complete reference for the MessageClient in the Knock JavaScript SDK.
Client for interacting with message operations in the Knock API.
Constructor#
Initializes a new message client instance.
Parameters:
The Knock client instance to use for API requests.
Returns: MessageClient
Methods#
get
#Retrieves a specific message by its ID.
Parameters:
The unique identifier of the message to retrieve.
Returns: Promise<Message>
Example:
updateStatus
#Updates the engagement status of a message. For the "interacted" status, additional metadata can be provided.
Parameters:
The unique identifier of the message to update.
The engagement status to set (e.g., 'read', 'seen', 'archived', 'interacted').
Optional parameters. Required when status is 'interacted' to provide metadata.
Returns: Promise<Message>
Example:
removeStatus
#Removes an engagement status from a message. Note: Cannot remove "interacted" status.
Parameters:
The unique identifier of the message to update.
The engagement status to remove (e.g., 'read', 'seen', 'archived'). Cannot be 'interacted'.
Returns: Promise<Message>
Example:
batchUpdateStatuses
#Updates the engagement status of multiple messages in a single request.
Parameters:
Array of message IDs to update.
The engagement status to set on all messages. Can include removal statuses like 'unseen', 'unread', 'unarchived'.
Optional parameters. Required when status is 'interacted' to provide metadata.
Returns: Promise<Message[]>
Example:
bulkUpdateAllStatusesInChannel
#Updates the engagement status of all messages in a specific channel.
Parameters:
The ID of the channel containing the messages to update.
The engagement status to set on all messages in the channel.
Additional options for the bulk update operation.
Returns: Promise<BulkOperation>
Example: