Cleaning all messages on slack channel

Jerry Han
Jerry Han
Jul 27, 2017 · 3 min read

Recently, One of our slack channel had got so dirty.

I tried to delete all garbage messages on it. But How about for over 10k messages on it?

Yes, you can do archive that channel. But How about for the general channel?

Let’s clean whole messages of a channel by little programatic way.

Using python and ‘slack-cleaner’

  • You have to have installed python and pip by yourself.
  • install slack-cleaner via pip
  • get the target channel name to delete
  • verifying the expected run
    You can verify the result of ‘slack-cleaner’ running
  • after verifying, let’s execute delete by adding ‘perform’ option.

Using node and ‘delete-channel-message.js’

  • You have to have installed node by yourself.
  • download ‘delete-channel-message.js’
  • set the target token and target channel in .js file.
    Before edit the .js file, you should know the your channel id (not channel name) by browsing your target channel on the browser.
    If your goto your target channel in browser, there will be shown the hidden channel id.
    When you go to the your target channel by these url :
    It will be changed like this :
    >>[channel id hash value]/…
    You should use the this [channel id hash value].
  • and run it with node.

That’s it.

My prefer is node one.

Because the python one was service denied after some messages deleted.
It caused by not enough delay time. I maybe send pull request for it.

The node one works fine.

Thanks for reading.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store