A Python script to archive Slack conversations and download associated files.
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install required packages:
pip install -r requirements.txt
- Create a
settings.jsonfile with your Slack credentials:
{
"SLACK_BOT_TOKEN": "your-slack-bot-token",
"CHANNEL_ID": "your-channel-id"
}Run the script:
python convo_saver.pyThe script will:
- Fetch the 10 most recent messages from the specified Slack channel
- Save messages to a timestamped JSON file (YYYYMMDDHHMM.json)
- Download any attached files to a timestamped directory
- Properly handle binary files and Japanese text
Check slack-backup-viewer :: user firendly GUI
https://github.com/devtamtam/slack-backup-viewer.git
- Make sure not to commit your
settings.jsonfile as it contains sensitive information. - This script is designed for use with public channels and private channels (group chats). It does not support retrieving message history from direct messages (DMs). This is due to privacy limitations enforced by the Slack API, which prevent bots from being added to existing DMs between users