A simple Slack app that provides multiple-choice polling functionality. Users can vote for one or more choices by clicking on buttons in an interactive Slack message created by the bot using a Slack slash command.
Before you begin, you'll need to have the bot running at a publicly accessible domain. Prefereably, you would have a reverse proxy or load balancer with HTTPS support in front of the bot.
- As a Slack admin, browse to https://api.slack.com/apps and click on [Create New App]
- Give the app a name (ex. "Poll Bot") and select the Slack workspace it should be connected with. Click [Create App]
- Under "Features" select "Interactive Components"
- Turn on "Interactivity" and fill in the "Request URL" with your bot's domain name, followed by
/interaction
:and [Save Changes]https://yourdomain.com/interaction
- Under "Features" select "Slash Commands" and [Create New Command]
- Pick a clear name for the command (ex. "/pollbot") and for the Request URL enter your bot's domain, followed by
/command
:For "Short Description", enter "Creates a poll". For "Usage Hint" enter:https://yourdomain.com/command
Make sure "Escape channels, users, and links sent to your app" is enabled, and [Save]"Title" "Choice 1" "Choice 2" ...
- Under "OAuth & Permissions", make sure your app has
chat:write:bot
andcommands
permissions. Click [Save] - Under "Settings" select "Install App" and [Install App to Workplace]
Go-slack-poll uses Redis for persistence of its polls. If you have Docker and the docker-compose
utility installed, you can easily spin up all of the necessary infrastructure from the command line. From the root of this repo, run:
$ SLACK_SIGNING_SECRET=YourAppSigningSecret docker-compose up
The pollbot and supporting Redis cluster can easily be installed on an existing Kubernetes cluster using Helm from the chart included in this repo. Once you have helm
installed, run:
$ helm install ./helm/go-slack-poll \
--name go-slack-poll \
--set env.slackSigningSecret=`echo "YourAppSigningSecret" | base64`
You can create a poll in Slack using the /pollbot
command (or whatever slash command you have configured in your Slack app settings):
/pollbot "Is this pollbot just the best?" "Yes ๐" "No ๐"