Delete Messages
Discover how to delete both regular and scheduled messages on Slack by using Python and Slack's API. Learn to interact with chat.delete and chat.deleteScheduledMessage endpoints, handle message timestamps, and manage scheduled message IDs. This lesson guides you through sending messages, retrieving necessary parameters, and automating message deletion with practical Python examples.
We'll cover the following...
Overview
In this lesson, we’ll learn to delete regular and scheduled messages in Slack.
Let’s look at the following endpoints in this lesson:
chat.delete: This endpoint deletes a message.chat.deleteScheduledMessage: This endpoint deletes a scheduled message.
Delete a message
To delete a message we access the https://slack.com/api/chat.delete endpoint. We’ll pass a message’s timestamp, ts, as a parameter to delete a message. We can use the chat.postMessage endpoint to send a message and receive the timestamp ts as a response. ...