And turns out that now Slack offers workplace administrators an ability to read (“export”) messages even from private (direct) chats. Basically, it helps employers to spy on their employees.
Well, fuck you, Slack, and so on, but nothing we can do about it (except for switching to Telegram), so let’s see how we can delete our messages. Because, you know, not only work-related stuff was discussed in those private chats.
You can delete them manually, one by one, but that will take you quite a time. Instead, you can use a tool that automates this process - slack-cleaner.
Get you Slack token and run the following:
slack-cleaner --token YOUR-SLACK-TOKEN --message --direct petya --user vasya --rate=1
--token YOUR-SLACK-TOKEN- your Slack token;
--message- the type of content you want to delete, here it’s messages, but you can also delete files;
--direct petya- username of the person you have direct (private) chat with. You can also delete your messages from channels and other places;
--user vasya- your username;
--rate=1- the rate of queries to the Slack API. I used 1 per second, because Slack has some limits, and if you exceed those, you’ll get an error
Client Error: Too Many Requests.
Having run that, you’ll get the number of messages that are about to get deleted and the confirmation option:
Now you can re-run this program with `--perform` to actually perform the task.
And they will be deleted from Slack (hopefully, truly deleted and not stored in some archive database).
But - if your organization is using Slack with a free plan, then most probably old messages (the ones that are not shown to you because of the free plan message limit) are still there on Slack servers, and you cannot reach them like that. This label indicates that:
But as soon as your administrator will decide to upgrade the usage plan, these ancient messages should become available, and then I recommend you to fire the tool again immediately in order to delete those too.