Playing Jeopardy in Slack (Heroku/Outgoing Webhook Integration)

  • Posted on: 16 January 2015
  • By: davis

Slack is pretty awesome. If you're bored, why not try playing Jeopardy?

This was a fun experiment in setting up Heroku to work with Slack.

First, you'll want to grab the source code.

You'll need a free Heroku account (requires credit card information, but they don't bill you unless you buy something) and Slack administration privileges (to add integrations).

  1. Visit https://slack.com/services/new/outgoing-webhook and set up a new Slack Outgoing Webhook.
  2. Create a Trigger word such as "trebekbot" (this will tell Slack to send the message to our Heroku app)
  3. Note the token you just generated.
  4. Visit https://api.slack.com/web and create an API token.
  5. You can either hit the author's one-step "Deploy to Heroku" button (recommended), or clone the repo, set up a Heroku app with Redis Cloud (free), and deploy trekbot. Ensure that you set up the config variables in .env.example!
  6. So close! Whatever you name your Heroku app, you'll need one more step to tie Slack and Herkou together.
  7. Go back to your Outgoing Webhook and scroll down to "URL(s)" Enter https://[YOURAPP].herokuapp.com

If you've set everything up correctly, your Slack channels will now have access to a game of Jeopardy.

Quick Tip: You can set per-channel blacklists. I recommend blocking the app from #general and any productive work channels you may have. Leave the app able to speak in #random, or perhaps create #trebek

Usage:

trebekbot jeopardy me: starts a round of Jeopardy! trebekbot will pick a category and score for you.
trebekbot what/who is/are [answer]: sends an answer. Remember, responses must be in the form of a question!
trebekbot what's my score: shows your current score.
trebekbot show the leaderboard: shows the current top scores.
trebekbot show the loserboard: shows the current bottom scores.
trebekbot help: shows this help information.