This is a quick tutorial to explain how to bulk delete Slack DMs. To do this, here I will talk about a simple Python script that you can execute to delete all private direct messages from Slack. All the script needs for functioning is a Slack token that you can easily generate. It goes through all the messages in the chat and then delete them one by one. There is just a single command to initiate the deletion process and it is very easy. However, do note that this script only deletes messages from private DMs. Files shared in the chats will not be deleted.
One main disadvantage of the Slack free plan is that if lots of messages have piled up in DMs then there is no option to delete them in bulk. In order to delete them, you have to do that manually. And since deleting messages can be exhausting, you can use a simple tool mentioned here. The tool is basically a script that utilizes Slack API and helos you lean messages. On the other hand, cleaning messages from Slack is necessary because you only get 10K recent message limit in the free plan.
How to Bulk Delete Slack DMs?
Getting started with the script is very simple. You can easily download it and run it no matter what platform you are using. The script is in Python, so make sure that you have Python installed. Next, you just clone the repository and then open the terminal window in the same folder.
Now, you have to install some dependencies. For that, you run the following command.
python3 -m pip install -r requirements.txt or just
pip3 install -r requirements.txt
You need to have a Slack token in order to make the script work. You can see how to get Slack token from here. After getting the token, you need to add it to an environment variable. To do that, you run the following command.
Finally, it is time to finally run the script. Just run the script like this, and then just sit back and relax. It will go through each DM one by one and then simply delete all messages that it finds. However, it may take some time, and files inside the chats will not be deleted.
In this way, you can use this simple script to bulk delete all DMs in Slack. There is just one single command that you have to execute in order to make it work. So if you have a lot of direct messages piled up in your Slack account then just give this script a try.
It is a good practice to frequently keep deleting messages from Slack to save your quota. Since there is no native option to do that, you can use the script I have mentioned here. The script is simple and straightforward. And the post here will explain how to execute it in order to make it work. So, if you are looking for ways o delete all Slack DMS from your workspace then you are at the right place.