This tool allows you to backup (and potentially delete) the content of a Slack channel (including files).
You will need to provide your own
SLACK_API_TOKEN token as a environment variable
$ export SLACK_API_TOKEN=xoxp-WHATEVER $ ./slack-backup.py '#random' --where mybackup
You will end up with a folder named
mybackup containing a
conversation.txt file with all the history and a
files folder with the uploaded files (which are properly tagged as such in the history).
The tool also allows to control a date range for the backup and to delete the backed up history:
$ ./slack-backup.py -h usage: slack-backup.py [-h] [--where WHERE] [--delete] [--from FROM] [--to TO] channel Backup a slack channel (and potentially delete) the content of a Slack channel (including files) positional arguments: channel channel to backup (use # prefix for channels, @ prefix for DMs) optional arguments: -h, --help show this help message and exit --where WHERE where to store the backup --delete delete the backed up messages --from FROM when to start backing/deleting up --to TO when to stop backing/deleting up
You will need to create a Slack app with the following permissions:
- When using public channels:
- When using private channels:
- When using Direct Messages:
- When deleting messages:
This project is using the old Slack API for channels and direct messages instead of new conversations one (https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api).