Update message properties

Change the properties of an existing message


Overview #

Update the content or properties of an existing message. This can only be used to modify messages created by the current viewer.
await window.CordSDK.thread.updateMessage(
  'my-awesome-thread-id',
  'message-42',
  {
    content: [{ type: 'p', children: [{ text: 'An updated message content' }]}],
  }
);
Copy

What this function returns #

A promise that resolves to true if the operation succeeded or rejects if it failed.

Arguments this function takes #


threadID #

required
string
The ID of the thread containing the message.

messageID #

required
string
The ID of the message to update.

data #

required
ClientUpdateMessage
The data values to update. Any omitted values will be left at their current values.

This is an object with the following fields:


deleted #

optional
boolean
Whether to change the deleted status of this message.

removeReactions #

optional
string[]
A list of unicode strings representing the reactions you want to remove from this message. Removing a reaction that does not exist will have no effect and will not return an error. An error is returned if a reaction is both added and deleted in the same request.

removeAttachments #

optional
RemoveFileAttachment[]
The attachments you want to remove from this message. Removing an attachment that doesn't exist has no effect and won't return an error. Attempting to add and remove the same attachment in one request is an error.

iconURL #

optional
string | null
The URL of the icon to show next to the message. This is only used for action_message messages; other messages show the avatar of the author. If an action_message does not have an icon set, no icon is shown.

metadata #

optional
EntityMetadata
Arbitrary key-value pairs that can be used to store additional information.

url #

optional
string | null
A URL where the message can be seen. This determines where a user is sent when they click on a reference to this message, such as in a notification. If unset, it defaults to the thread's URL.

content #

optional
object[]
The content of the message.

type #

optional
"action_message" | "user_message"
The type of message this is. A user_message is a message that the author sent. An action_message is a message about something that happened, such as the thread being resolved. The default value is user_message.

extraClassnames #

optional
string | null
A optional space separated list of classnames to add to the message.

addReactions #

optional
string[]
A list of unicode strings representing the reactions you want to add to this message. Trying to create a reaction that already exists for a user does nothing.

addAttachments #

optional
CreateFileAttachment[]
A list of attachments to add to the message. The same file cannot be attached to the same message multiple times.

Ask Cordy