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

Update a message in a channel

A user can update any of their own text and file messages sent using UserMessageUpdateParams and FileMessageUpdateParams. An error is returned if a user attempts to update another user's messages. In addition, channel operators can update any messages sent in a channel.

User messageFile message
const params: UserMessageUpdateParams = {
    message: NEW_TEXT_MESSAGE,
    customType: NEW_CUSTOM_TYPE,
    data = NEW_DATA,
const updatedMessage = await channel.updateUserMessage(MESSAGE_ID, params);

If a message is updated, the onMessageUpdated() method in the channel event handler is invoked on all channel participants' devices including the one that updated the message.

Open channelGroup channel
const channelHandler = new OpenChannelHandler({
    onMessageUpdated: (channel: BaseChannel, message: BaseMessage) => {
        // ...

sb.openChannel.addOpenChannelHandler(UNIQUE_HANDLER_ID, channelHandler);