Selects a random user in a channel and asks them for their song of the day
Scope | Purpose |
---|---|
chat:write |
To post the message |
channels:read |
To get a list of all members |
Name | Necessity | Default | Description |
---|---|---|---|
SLACK_BOT_TOKEN |
Required | Token provided on bot creation, begins with xoxb- |
|
SLACK_CHANNEL_ID |
Required | Channel ID that the bot asks the question in and gets list of users from. | |
SLACK_SIGNING_SECRET |
Required | Slack bot signing secret used to authenticate requests from Slack. |
- A slack workspace to which you can add a bot and edit its permissions, create one if needed, adding the OAuth scopes listed above.
Docker
- the app is containerised and the development environment usesdocker compose
ngrok
, used to forward an https URL to your local machine, needed to test slack events and actions *. Use ngrok to forward traffic to your local machine, copy the URL.ngrok http 8000
- Set up your slack app by going to the app home under Slack Apps
- Under Features > Interactivity & Shortcuts, enable and configure the URL to
{ngrok_url}/slack/actions
- Under Features > Event Subscriptions, enable and configure the URL to
{ngrok_url}/slack/events
- Subscribe to the following events:
app_home_opened
,app_mention
andmessage.channels
- Subscribe to the following events:
- Under Features > Interactivity & Shortcuts, enable and configure the URL to
- Additional to the required standard environment variables, add these to your
.env
file:
Name | Description |
---|---|
DEPLOYMENT_ENV |
Set to Local to enable local development mocking |
LOCAL_URL |
Set to the https URL obtained from ngrok |
- Start the docker compose application (in older docker versions,
docker-compose
needed to be downloaded separately)
docker compose up -d --build && docker compose logs -f
- Make changes to the code to auto-restart the process inside the contianer.