How Deleting a Message Actually Works in Slack
Slack's chat.delete method removes a message -- but the message isn't identified by a single message_id the way many APIs work. Slack requires both the channel ID and the message's ts (a timestamp string that also serves as its unique identifier within that channel) to locate and delete it.
Real API Details
Only the message's original author (or a workspace admin/owner, depending on permission settings) can delete it via the API -- a bot token generally needs the chat:write permission and can typically only delete messages it posted itself, not arbitrary user messages, unless granted elevated admin scopes.
Practical Considerations
Store both the channel and ts values together when you post a message if you might need to delete or update it later, since neither value alone is sufficient to locate the message afterward.
Use cases
Remove outdated or erroneous bot messages from a channel automatically.
- Clear test messages after a workflow deployment in Slack.
- Remove sensitive content after it has been replaced with a security-approved notice.
- Maintain channel cleanliness by pruning demo content in Slack automations.
- Automate cleanup of ephemeral messages in Slack threads.
Delete actions should be used judiciously within Slack automation pipelines.
