This app allows users to flag messages in Slack by adding a specific reaction or using a message shortcut. Flagged messages trigger a workflow that collects additional details and notifies administrators. This app needs to be added to all channels for flagging. It will add itself to public channels as needed. Private channels need to have the app added explicitly.
-
Flag messsages for administrator review using the :flag-message: reaction or a message shortcut.
-
The user receives a direct message from the Flag Message app asking to provide additional details (Continue) or dismiss the message flag.
-
After providing details the message text, message link, and user-provided details are sent to an admin review channel.
- Go to Slack API: Applications.
- Click
Create New App
. - Choose
From scratch
. - Enter the App Name and select the Development Slack Workspace.
- Click
Create App
.
- In your app settings, go to
OAuth & Permissions
. - Scroll down to
Scopes
and add the following Bot Token Scopes:app_mentions:read
channels:history
channels:join
channels:read
chat:write
commands
groups:history
groups:read
im:history
im:read
links:write
mpim:history
mpim:read
reactions:read
users:read
- Click
Save Changes
.
- In your app settings, go to
Socket Mode
. - Enable Socket Mode.
- Create an App-Level Token with the scope
connections:write
. - Copy the token and keep it for later use.
- In your app settings, go to
Event Subscriptions
. - Enable
Enable Events
. - Under
Subscribe to bot events
, add:reaction_added
- Click
Save Changes
.
- In your app settings, go to
Install App
. - Click
Install App to Workspace
. - Copy the
Bot User OAuth Token
and keep it for later use.
- Go to Heroku and create a new account if you don't have one.
- Create a new Heroku app.
Ensure your code repository has the following files:
app.js
(main application code)package.json
(list of dependencies)Procfile
(to specify the worker process).gitignore
(to ignore node_modules and other unnecessary files)
Set the following Config Vars in your Heroku app:
- SLACK_CLIENT_ID=your-client-id
- SLACK_CLIENT_SECRET=your-client-secret
- SLACK_SIGNING_SECRET=your-signing-secret
- SLACK_APP_TOKEN=your-app-level-token
- SLACK_BOT_TOKEN=your-bot-user-oauth-token
- SLACK_WORKSPACE=your-workspace-name
- FLAGGED_MESSAGE_CHANNEL_ID=your-channel-id
- Go to the Slack workspace where you installed the app.
- Invite the bot to the channels where it will be used:
/invite @your-bot-name
- To flag a message, add the reaction
:flag-message:
to the message. - Alternatively, use the message shortcut to flag the message:
- Click on the three dots next to a message.
- Select More message shortcuts.
- Choose your app’s shortcut to flag the message.