The drupalorg-slack
Slack app uses Drupal.org's API to retrieve several
data points that are relevant to an organization's Drupal
Marketplace rank and report it into your Slack
workspace. The data points include issue credit count, number of projects
supported, and case studies submitted, as well as the marketplace rank itself.
It also keeps track of the "high scores" for each of these values.
The functionality is composed of two pieces, the slash command, and an external trigger:
- The slash command is triggered from within Slack by any user with permission and will result in an ephemeral message sent back to Slack with the response. Only the requesting user can see this response.
- The external trigger allows for a request from outside of Slack to trigger the app. This is useful for scheduling the app to notify a channel regularly.
- Remix on Glitch (easiest for a quick start since Glitch will host your app and provide a URL for Slack to talk directly to; more info on Glitch). Alternatively, and more traditionally, you may clone this repo and get the app running somewhere that it will be accessible on the web.
- Copy
.env.sample
to.env
. - Create a new app in the Slack "Your Apps" dashboard.
- In your newly created Slack app configuration, Create a slash command via the
"Slash Commands" tab in the sidebar and set the request URL to your app:
https://your-app-name-here.glitch.me/slack/events
- Configure the required environment variables in
.env
:SLACK_SIGNING_SECRET
: Navigate to the "Basic Information" tab and use the "Signing Secret".SLACK_BOT_TOKEN
: Navigate to the "Install App" tab and use the "Bot User OAuth Access Token" value.DRUPAL_ORG_NODE_ID
: Your organization's node ID from Drupal.org.
- Configure the optional environment variables in
.env
. These values are utilized when the app is triggered from an external source such as a cron or Jenkins job as opposed to a "slash command" from within Slack.DEFAULT_CHANNEL_ID
/SANDBOX_CHANNEL_ID
(optional): Populate these values with the Slack channel ID's where you want the app to post notifications. The easiest way to get these values is to load your Slack workspace in a web browser (as opposed to the Slack app) and grab the channel IDs from the address bar.ORG_TOKEN
: A secure value used to validate a request.
- Customize default values:
DEBUG_MODE
: Setting this value totrue
results in theSANDBOX_CHANNEL_ID
being used instead of theDEFAULT_CHANNEL_ID
.VERBOSE_MODE
: Set totrue
to enable verbose console logging.
To trigger the app from outside of Slack:
- Ensure
DEFAULT_CHANNEL_ID
,SANDBOX_CHANNEL_ID
, andORG_TOKEN
are configured as described above. - Make a POST request with your token in the following format:
curl --fail -X POST \
'https://your-app-name-here.glitch.me/triggers?token=YOUR_ORG_TOKEN_HERE'