SlackDown allows you to back up Slack messages (including public channels, private channels, direct messages, and group messages) to local Markdown files. It also supports downloading and organizing file attachments.
- Backs up Slack messages from:
- Public channels
- Private channels
- Direct messages (DMs)
- Group messages (MPIMs)
- Saves messages in Markdown format with timestamps, reactions, and threads.
- Downloads file attachments and organizes them into folders.
- Supports selective backup of specific channels or users.
- Python 3.8 or higher.
- A Slack app with the necessary permissions and a User OAuth token. See this instruction for more details.
-
Clone the Repository:
> git clone https://github.com/CafeAuLait-CC/SlackDown.git > cd SlackDown
-
Install Dependencies:
Linux & macOS:
> python3 -m venv ./slack_env > source ./slack_env/bin/activate > pip install -r requirements.txt
Windows (PowerShell):
> python3 -m venv slack_env > slack_env\Scripts\Activate.ps1 > pip install -r requirements.txt
Note: You might need to run the following command if you encounter an error running the
Activate.ps1in PowerShell.> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -
Create a Slack App:
- Go to the Slack API and create a new app. See this instruction for more details.
- Install the app to your workspace and obtain the User OAuth Token.
-
Edit the
config.txtFile: Edit theconfig.txtfile in the project directory with the following content:[Slack] User_OAuth_Token = xoxp-your-slack-user-oauth-token [Directories] Direct_Msg_Directory = backup/dm Group_Msg_Directory = backup/groups Channel_Msg_Directory = backup/channels Attachment_Directory = backup/attachments [Options] Backup_Attachments = True Backup_List = all
-
Replace
xoxp-your-slack-user-oauth-tokenwith your actual Slack User OAuth token (the one starts withxoxp). -
You can choose whether or not you want to backup the attachments in the conversation, by setting the
Backup_AttachmentstoTrueorFalse. -
The
Backup_Listcould beallor a specific list of conversations you want to backup, e.g.Backup_List = general, bobmeans backup the messages from thegeneralchannel and your DMs withbob,bobis the [display name] of a user in your workspace.
-
-
Run the Script:
> python slackdown.pyThe script will back up messages and attachments to the specified directories.
User_OAuth_Token: Your Slack user OAuth token.Direct_Msg_Directory: Directory to store direct messages (default:dm).Group_Msg_Directory: Directory to store group messages (default:groups).Channel_Msg_Directory: Directory to store channel messages (default:channels).Attachment_Directory: Directory to store downloaded attachments (default:attachments).Backup_Attachments: Whether to download attachments (default:True).Backup_List: List of specific channels or users to back up (default:all. E.g.general, alice, wheregeneralis the general channel andaliceis the display name of a user in your workspace.).
- Messages: Saved as Markdown files in the respective directories (
dm,groups,channels). - Attachments: Downloaded to the
attachmentsfolder, organized by channel or user.
#### 2023-10-10
**Alex** (12:34:56): Hello `@bob`, please check `@channel` for updates.
**Bob** (12:35:10): Got it!
_Reactions_: 👍 (x2), 😂 (x1)
[Attachment: Alex_image1.png](attachments/dm/Alex_image1.png)attachments/
├── dm/
│ ├── Alex_image1.png
│ └── Alex_image2.png
└── general/
└── Team_image1.png
- Run this script periodically (e.g. monthly or every 3 months) could appends new messages to existing backup files, ensuring that edits and new messages are reflected.
- Attachment files in one conversation with the same content are not duplicated; instead, the existing file is reused.
This project is licensed under the MIT License. See the LICENSE file for details.
This project is generated by DeepSeek-V3.