Skip to content

codeforamerica/glossary-bot

Repository files navigation

Glossary Bot

Glossary Bot is a Slack bot that maintains a glossary of terms created by its users, and responds to requests with definitions.

It is a simple web app designed to be used as a Slack integration. Specifically, it responds to POSTs created by the Slack Slash Commands integration and responds with messages to Slack's Incoming Webhooks integration.

DemoGif

Deploy Glossary Bot

Glossary Bot is a Flask app built to run on Heroku. To deploy the bot using Heroku's automated setup, see below. To deploy or upgrade the bot from the command line, read DEPLOY. To install the bot locally for development and testing, read INSTALL.

Set Up on Slack

Glossary Bot uses two Slack integrations: Slash Commands for private communication between the bot and the user, and Incoming Webhooks for posting public messages.

Set up a Slash Command integration. There are three critical values that you need to set or save: Command is the command people on Slack will use to communicate with the bot. We use /gloss. URL is the public URL where the bot will live; LEAVE THIS PAGE OPEN so that you can fill this in after you've deployed the application to Heroku, as described below. Token is used to authenticate communication between Slack and the bot; save this value for when you're setting up the bot on Heroku.

Set up an Incoming Webhooks integration. The first important value here is Post to Channel, which is a default channel where public messages from the bot will appear. This default is always overridden by the bot, but you do need to have one – we created a new channel called #glossary-bot for this purpose. Save the value of Webhook URL; this is the URL that the bot will POST public messages to, and you'll need it when setting up Gloss Bot on Heroku.

Deploy on Heroku

Deploy

Click the button above to get started. In the form that loads, add a name for your bot in the App Name field, or leave it blank to have Heroku generate a unique name. You won't see this name in Slack, it'll just be part of the URL that Slack uses to communicate with the bot behind the scenes.

Paste the Token from the Slash Command integration into the SLACK_TOKEN field and the Webhook URL from the Incoming Webhooks integration into the SLACK_WEBHOOK_URL field. Now click the Deploy for Free button to deploy the bot!

When it's done deploying, click the View button at the bottom of the form. A Method Not Allowed error page will load, but don't worry about that. All you're looking for is your bot's URL, which looks something like https://my-glossary-bot.herokuapp.com/. Copy that URL, paste it into the URL field of the Slash Command integration page on Slack, and save the integration there.

And now you're good to get glossing! Open up Slack and type /gloss help to start.

If you installed Gloss Bot on Heroku using the Deploy on Heroku button and you want to upgrade it with the latest changes, follow these instructions.


Learn about Code for America

Code for America believes government can work for the people, and by the people, in the digital age, starting with the people who need it most. We build digital services that enhance government capabilities, and we help others do the same across all levels of government. We organize thousands of volunteers across nearly 80 chapters nationwide who improve government in their local communities. Our goal: a 21st century government that effectively and equitably serves all Americans. Learn more at codeforamerica.org.