Slack: Retrieve all messages

This Python script exports everything to JSON by a simple run: https://gist.github.com/Chandler/fb7a070f52883849de35

It creates the directories for you and you have the option to exclude direct messages or channels.

All you need to install is the slacker module, which is simply pip install slacker. Then run it with --token='secret-token'. You need a legacy token, which is available here at the moment.


If you need to do this dynamically via API you can use the channels.list method to list all of the channels in your team and channels.history method to retrieve the history of each channel. Note that this will not include DMs or private groups.

If you need to do this as a one time thing, go to https://my.slack.com/services/export to export your team's message archives as series of JSON files

message archive export screen


For anyone looking for Direct Message history downloads, this node based cli tool allows you to download messages from DMs and IMs in both JSON and CSV. I've used it, and it works very well.

Tags:

Slack Api