How To Clear Slack Chat History

Whether you want to declutter your workspace or maintain a sense of privacy, learning how to clear your Slack chat history can come in handy. This blog post will walk you through the step-by-step process of how to do it.

Some Important Notes Before We Start

Please remember that only Workspace Owners and Admins have the power to delete messages in Slack. If you fall into neither of these categories, you can only delete the messages that you’ve personally sent. Also, note that once a message is deleted, there’s no way to recover it, so proceed with caution.

Clearing Slack Chat History: A Step-by-Step Guide

Step #1: Open the Conversation

To start, you need to navigate to the conversation that you wish to clear. This could be a private conversation, a group chat, or a channel.

Step #2: Find the Message You Want to Delete

Scroll through the conversation until you find the message that you wish to delete. Hover over the message, and you’ll see a series of icons appear. Click on the “More actions” option (the three vertically-aligned dots).

Step #3: Delete the Message

In the dropdown menu, click on the “Delete message” option. You will be asked to confirm your decision. Click on the “Yes, delete this message” button to finalize your decision.

How to Delete Multiple Messages at Once

If you are an admin or owner and wish to delete multiple messages at once, you will need to use Slack’s API. Here’s a basic example of how to do so:

    const deleteConversationHistory = (channel) => {
      const result = await app.client.conversations.history({
        token: process.env.BOT_TOKEN,
        channel: channel,
        inclusive: true
      });

      result.messages.forEach(async (message) => {
        await app.client.chat.delete({
          token: process.env.BOT_TOKEN,
          channel: channel,
          ts: message.ts
        });
      });
    };
    

This script fetches the history of a specified conversation, and then steps through each message in the history, deleting it. You’ll need to replace “BOT_TOKEN” with your bot’s token and “channel” with the ID of the channel whose history you want to delete.

Conclusion

Cleaning up your Slack workspace by deleting unnecessary messages can help you stay organized and maintain your privacy. Know that you need to take the utmost care while deleting messages as there’s no way to retrieve them once deleted. Happy Slacking!