Serverless Poll Bot for Slack using the Serverless Framework for deployment.
Polly is designed to run on AWS infrastructure using Lambda and DynamoDB. For small to medium teams the free tier provided by AWS should allow the usage without any costs.
After installing and adding the Bot to your Channel, you can create new polls using the /poll
command.
/poll "Do you like cats?" "Yes" "Of Course" "Everybody loves cats"
Next to the created poll you'll find a menu button which allows you to close and delete the poll. Furthermore you can open the settings menu that is used for things like scheduling.
You can create reuccuring polls using the scheduling feature. Open the settings menu, select the prefered schedule type and then configure it.
The configured time is using the user's timezone.
- Go to https://api.slack.com/apps and create a new App
- Copy the "Signing Secret" to your config (see below)
- Open "OAuth & Permissions" and add the following permissions:
- app_mentions:read
- channels:history
- chat:write
- commands
- users:read
- Click the "Install in Workspace" button and copy the "Bot Token" to your config (see below)
Create an .env file with the following content:
CLIENT_SIGNING_SECRET=123456450645
BOT_TOKEN=xoxb-SOME_TOKEN
After setting up serverless, you can simply deploy the application using:
sls deploy
When the application is deployed, you need to add the following configurations to Slack:
- Event Subscriptions
- Add Request URL
- Subscribe to
app_mention
andmessage.channels
commands
- Slash Commands
- Create new Command
/poll
with Request Url
- Create new Command
- Interactivity & Shortcuts
- Add Request URL
Now you should be able to add the Bot to your channels and use it.
There is a docker-compose file in /dynamodb
that can be used to start a local dynamoDB.
Afterwards the Bot can be started with npm start
. It's required to setup some reverse proxy (e.g. using ngrok
).
This bot was largely inspired by the openpollslack build by @KazuAlex.
The logo was kindly provided by @luisalisanne :-)