Simple slackbot for responding to messages containing a Piazza post number.
Based on regexbot by sjmelia.
Go to HOW-TO-UPDATE.md for instructions on how to update your deployment to the latest version.
- Go to https://api.slack.com/apps, create a new App, and connect it to the workspace of your choice.
- Add a bot user to your app.
- Install your app to your workspace in its current state (in order to generate access tokens).
- Go to "OAuth and Permissions" to find your Bot User OAuth access token. This will be the
SLACK_API_TOKEN
used by the Heroku app. - Go to "Basic Information" to find your Signing Secret. This will be the
SIGNING_SECRET
used by the Heroku app.
- Click the "Deploy to Heroku" button and choose a name for your Heroku app.
- Fill in all of the required environment variables (e.g. slack api token, piazza base url).
- Deploy the app.
- Go to Event Subscriptions, enable events, and connect it to your Heroku app's url. The path for events is
/slack/events
. - Add the following Bot event subscriptions:
message.channels
message.groups
message.im
message.mpim
- Reinstall the Slack app. The access tokens should remain the same.
Finally, in your Slack workspace, invite the bot user to any channels you wish it to have access to.
By default, this bot uses the Slack Events API to listen to messages. This allows the bot to work on free-tier Heroku dynos, for example, because it uses HTTP requests rather than websockets. If you have a persistent server and would like to use the Slack Real-Time Messaging API instead, set the USE_RTM
environment variable (to anything).
npm test
to lint and run tests