Sample - Slack Web API
POST/chat.delete

Delete a message

Deletes a message from a channel. Supply ts and channel to identify the message, and use as_user to control whether deletion occurs as the authenticated user or with bot scope. Use this method only when the authenticated user or bot has permission to delete the specified message.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 3 body fields
tokenstringoptional
Authentication token with the `chat:write` scope.

The message identification and deletion-identity options.

tsnumberoptional
Timestamp of the message to be deleted.
channelstringoptional
Channel containing the message to be deleted.
as_userbooleanoptional
Pass true to delete the message as the authed user with `chat:write:user` scope. [Bot users](/bot-users) in this context are considered authed users. If unused or false, the message will be deleted with `chat:write:bot` scope.

2 status codes
200Returns the deleted message's channel identifier and timestamp with `ok: true`.
channelstringrequired
okbooleanrequired
Allowed:true
tsstringrequired
defaultReturns `ok: false` with an error when the message or channel cannot be found, deletion is not permitted, authentication fails, or an argument is invalid.
callstackstringoptional
Note: PHP callstack is only visible in dev/qa
errorstringrequired
Allowed:message_not_foundchannel_not_foundcant_delete_messagecompliance_exports_prevent_deletionnot_authedinvalid_authaccount_inactivetoken_revokedno_permissioninvalid_arg_nameinvalid_array_arginvalid_charset
okbooleanrequired
Allowed:false

Error handling

Provide ts as the message timestamp and channel as the containing channel. If you set as_user to true, the token must have the chat:write:user scope; otherwise deletion uses the chat:write:bot scope.