A Python script to export Slack threads to Markdown files, including user mentions, attachments, and reactions.
- Resolve Slack user IDs to usernames.
- Handle attachments and blocks in messages.
- Download and embed file attachments.
- Export reactions associated with messages.
- Opsgenie-specific message formatting.
- Comprehensive logging.
-
Clone the repository:
git clone https://github.com/walbeh/slack-thread-exporter.git cd slack-thread-exporter
-
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Slack Bot Token:
Obtain a Slack Bot Token with the required scopes. Set it as an environment variable:
export SLACK_TOKEN='xoxb-your-slack-bot-token'
Alternatively, you can pass it as a command-line argument when running the script.
Ensure your Slack app has the following OAuth scopes:
channels:read
: To access channel information.channels:history
: To read message history in channels.groups:read
: To access private channels information.groups:history
: To read message history in private channels.users:read
: To resolve user IDs to usernames.files:read
: To download file attachments.reactions:read
: To access reactions on messages.
Run the script with the Slack thread URL:
python sl-ex.py <xoxb-xxxxx> <SLACK_LINK>