This project automates the backup of Slack workspace files to a local folder, with options to upload the backup folder to Google Drive or Mega.io.
It follows a very simple Extract, Transform, Load process.
- Extract (download) data from a Slack Workspace into local storage
- Transform this data, typically sorting and/or compressing files
- Load (upload) the data into a remote storage (Mega or Google Drive)
This system can be extended to other service simply by subclassing the ETL, Exporter and Uploader classes.
This project is a work in progress and is meant to run locally. Some of the authentication process is not secure enough.
Gemini CLI, Github Copilot and Claude have been used extensively to write the code in this repository, especially the API interfaces and documentation.
git clone git@github.com:greird/slack-exporter.git
cd slack-exporterYour Slack App should have a Bot Token with the following permissions
- channels:history
- channels:read
- files:read
- groups:history
- groups:read
- links:read
For a conversation to be part of the export, the Slack App bot should be added to it.
To upload files to Google Drive, you need to enable the Google Drive API and obtain credentials.
- Go to the Google Cloud Console.
- Create a new project.
- Enable the Google Drive API for this project.
- Create OAuth consent screen credentials.
- Configure it for External use and add your own email address as a test user.
- Create new OAuth client ID credentials for a Desktop app.
- Download the JSON file containing your credentials and save it as
./credentials.jsonat the root of this directoy.
During the first run, the script will prompt you to authenticate via your browser to authorize access to your Google Drive.
To upload files to Mega.io, you need to install megacmd. If you use Docker you can skip this step as the installation is part of the Dockerfile.
Otherwise follow the documentation to install it manually.
SLACK_BOT_TOKEN='YOUR_SLACKBOT_TOKEN'You can also use this method to store your meta and google drive credentials if needed.
Edit main.py to use one of the pre-existing configuration or build a new subclass of ETL to create your own.
docker build -t "slack-exporter" .
docker run slack-exporterUse Poetry to install python dependencies
poetry install
poetry run python slack_exporter/main.pyOr use pip/pipx to install dependencies from requirements.txt.