This project is an Incident Management Bot for Slack. It allows users to create and manage incidents directly from Slack and also provides a nice web UI to view all created incidents.
- Ruby version: 3.4.1
- Rails version: 8.0.1
- PostgreSQL: 17
- TailwindCSS v4
git clone https://github.com/yourusername/IncidentSlackBot.git
cd IncidentSlackBotCopy the .env.sample file in the root directory to a .env and fill in the environment variables.
Create a config/master.key with the correct secret.
docker-compose upbundle install
./bin/rails db:prepare./bin/dev- Go to the Slack API and create a new app.
- Choose "From scratch" and give your app a name and select the workspace where you want to install the app.
- Go to "OAuth & Permissions" in the left sidebar
- Add the following OAuth scopes:
- channels:join
- channels:manage
- chat:write
- commands
- groups:write
- users:read
- Click "Save Changes"
- Install the App to your Workspace
- Go to "Install App" in the left sidebar
- Click "Install App to Workspace"
- Authorize the app
- Configure Commands
- Go to Commands in the left sidebar
- Create new command
- Fill in the request url with: `https://<your-domain.com>/slack/commands
- Fill the remaining fields
- Click "Save"
- Configure Interactivity & Shortcuts
- Go to "Interactivity & Shortcuts" in the left sidebar
- Enable "Interactivity"
- Set the "Request URL" to https://<your-domain.com>/slack/interactions
- Click "Save Changes"
- Retrieve Slack Credentials
- Go to "OAuth & Permissions" in the left sidebar
- Copy the "Bot User OAuth Token" and add it to your rails credentials with
rails credentials:edit - Go to "Basic Information" in the left sidebar
- Copy the "Signing Secret" and add it to your rails credentials with
rails credentials:edit
- Test the app locally with ngrok
- Run
ngrok http --url=<your-domain.com> 3000 - Test the app locally by invoking the slash command in your slack workspace
I've created a RootlyInteractionsJob class to handle the interactions request from slack in a Solid Queue job and
prevent it from giving a timeout in case the request takes more than 3s. However, since I'm using a render free plan
and it does not support having a worker service I ended up commenting out the job enqueing and just using a synchronous request on SlackController#interactions. It seems to be working well so far in the production environment.