It's a Slack bot that sends you Fleetwood Mac lyrics.
- A Slack workspace you want to add the bot to
- Install Python3
- Install ngrok: https://ngrok.com/download
- Go to https://api.slack.com/apps and click Create New App
- Name it and choose a workspace
- Add Scopes
- Go to OAuth & Permissions
- Under Bot Token Scopes, add permissions. For this app, we at least need
app_mentions:read
, which allows our app to view messages that directly mention our bot, andchat:write
, which allows our app to send messages
- Scroll to the top of the OAuth & Permissions page and click Install App to Workspace
- Clone the Github repo:
git clone https://github.com/helloleah/fleetwood-slack.git
cd fleetwood-slack
- I recommend setting up a virtual environment for dependency management:
python3 -m venv .venv
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Grab your Signing Secret from the Basic Information page and your Slack Bot Token from the OAuth & Permissions page, and store them in environment variables:
export SLACK_SIGNING_SECRET=***
export SLACK_BOT_TOKEN=xoxb-***
- Run the Flask app:
FLASK_APP=app.py FLASK_ENV=development flask run -p 3000
- In a terminal, run ngrok:
ngrok http 3000
- On Event Subscriptions page, enable events (if not already enabled)
- In request URL, put ngrok URL plus
/slack/events
, e.g.https://8eb44499712a.ngrok.io/slack/events
- Click Subscribe to Bot Events
- Click Add Bot User Event and add the
app_mention
event, which will subscribe to message events that mention our bot
Be sure to /invite
the bot to a channel in your Slack workspace, then try @-mentioning the bot.