Skip to content

mjmammoth/MusicalChair

Repository files navigation

MusicalChair Slack bot 🎵🪑

Selects a random user in a channel and asks them for their song of the day

MusicalChair avatar, created with MidJourney

OAuth Scopes

Scope Purpose
chat:write To post the message
channels:read To get a list of all members

Environment Variables

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.

Local Dev

Prerequisites

  • 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 uses docker 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 and message.channels
  • 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

Local dev loop

  1. 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
  1. Make changes to the code to auto-restart the process inside the contianer.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published