Skip to main content

chat.update method

Welcome to the new home of Slack developer docs!

We're still building and not all features are available quite yet. Enjoy this peek into the future!

Not ready for the future? Return to the past at api.slack.com.

Usage info

This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.

Ephemeral messages created by chat.postEphemeral or otherwise cannot be updated with this method.

New Slack apps may use this method with the chat:write scope and either a bot or user token.

To define your message, refer to our formatting spec and our guide to composing messages.

text, blocks or attachments

This method will behave differently depending on whether blocks or text is supplied. Slack will always try to render the message using blocks, and use text only for notifications. If you don't include blocks, the message's previous blocks will only be retained if the text argument is not provided. If the text argument is provided and blocks are not provided, the blocks will be removed, and the provided text will be used for message rendering. To remove previous blocks, include an empty array for the blocks field. If blocks are used and a message is being updated, the edited flag will not be displayed on the message (the flag will be displayed on the message if using text).

Similarly, the attachments field is required when not presenting text. If you don't include attachments, the message's previous attachments will be retained. To remove previous attachments, include an empty array for this field.

Valid message types

Only messages posted by the authenticated user are able to be updated using this method. This includes regular chat messages, as well as messages containing the me_message subtype. Bot users may also update the messages they post.

Attempting to update other message types will return a cant_update_message error.

To use chat.update with a bot users token, you'll need to think of your bot user as a user, and pass as_user set to true while editing a message created by that same bot user.

Response

The response includes the text, channel and timestamp properties of the updated message so clients can keep their local copies of the message in sync.

Updating interactive messages

If you're posting an interactive message, you may use chat.update to continue updating ongoing state changes around a message. Provide the ts field the message you're updating and follow the bot user instructions above to update message text, and remove or add blocks.