Installing the app
October 22, 2020 ยท View on GitHub
- In your Slack workspace, create a private channel for receiving reported messages.
- Duplicate
.env.sampleto.env - Add the ID of the private channel you created above to your .env file, after
SLACK_TRIAGE_CHANNEL(hint, you can get the id by opening that channel in a browser, it's the part of the URL that begins withG, egGABC123DE) - Go to api.slack.com/apps and create a new app
- Go to OAuth and permissions and add the following Bot Token scopes:
chat:write,im:historyandcommands. - Install the app on your workspace, accept the OAuth
- Add the application to the triage channel (in the channel click "Add an app" and find the app you created in step 4.)
- Copy the Bot User OAuth Access Token that begins with
xoxband paste it into the .env file afterSLACK_BOT_TOKEN - Go to Basic Information and click the Show button in the Signing Secret field, then copy that string. In the .env file, paste after
SLACK_SIGNING_SECRET - Back in the app configuration, go to Interactivity & Shortcuts, turn Interactivity to
Onand set the Request URL tohttps://YOUR-DOMAIN.TLD/slack/events - On the same Interactive Components page, click the Create New Shortcut button and choose "On messages"
- Set the fields to:
- Name:
Report message... - Short Description:
Report this message as inappropriate - Callback ID:
report_message
- Name:
- Deploy your code
- Once your server is live, go back to the app configuration, choose Event Subscriptions, turn Enable Events to
Onand set the Request URL tohttps://YOUR-DOMAIN.TLD/slack/events - On the same Event Subscriptions page, click the Subscribe to bot events header and choose "Add Bot User Event"
- Choose the
app_home_openedandmessage.imevents, then click the green "Save Changes" button
Database
If the SLACK_BOT_TOKEN variable is not set, the App expects a MySQL table in the configured database. This table can be created with the following query -
create table installations
(
team_id varchar(255) null,
installation text null
);