Instant Slack Feedback
How do you get instant feedback from your colleagues on Slack? Perhaps it’s just a simple question, where shall we go for lunch? Or when shall we organise an event for.
There are a few poll Slack Apps available on the directory, but I wanted to see how easy or otherwise it would be to use the Slack API, to build my own our team. Slack also recently released Message Buttons and these new message attachments seemed like the perfect way to user responses to a poll.
Turns out you can easily put something together over the course of a day.
So what’s in a Slack App? You currently can have incoming webhooks for specific channels, this allows you to post messages from an external server into that channel using the specific hook URL you’re given.
You can also have commands, these are things like
/invite jake. Slack will send you a HTTPS POST command with the command and the parameters plus who initiated the command. (Yes it has to be HTTPS, and no self-signed certificates are not accepted. Hooray for Let’s Encrypt!)
Lastly there are bots, these are automated non-human users that can be invited to channels and interact with Slack in much the same way as a normal user.
What does my Slack App do then? You simply visit https://jeevespoll.com/, hit the Add to Slack button, give it the necessary permissions and it’s ready to go! Go to any channel, and simply type
/poll "My Question" "Answer 1" "Answer 2" "Answer 3". Jeeves will take over and do the rest for you, it’ll produce a live updated graph right within Slack as people change their votes. There’s also a link to a pie chart on the website that will also live update when people change their votes that will also show you who voted for what.
What features of the Slack App do I need? I’m currently only using the Slack Command feature. Eagle eyed readers will notice that in the screenshot sample above it says
BOT, but I’m not yet using the bot feature so what gives? Well Slack helpfully (for users that is) marks any message that wasn’t created by a user with the grey
I’ve registered the command
/poll with a URL of something like
https://myurl.com/process/poll. Now once a user types the command I registered, I get a POST message with the parameters the user used on the command. This is the bit after the
/poll so in my case the `“Question” “Answer 1” …“ bit.
I split this up to get the constituent parts out, then create a question in the database, and also insert the answers into the database. I then respond to Slack using the
response_url that I get given. I could just respond to the POST request using some JSON and Slack would turn that in to a message for me - however if I use this technique the original command message from the user hangs around, and stays there. If I use the
response_url instead, it helpfully replaces the original command message.
Where is Jeeves Poll headed? Well the basics are now implemented, teams can create polls, with a limit of 5 options (that’s the Slack limit on Message Buttons). I intend on seeing if I can use Message Reactions to poll for up to 10 options using the numbered emoji - I’ve seen this done by other polling apps, so I know it must be possible!
I also want to introduce more advance features, such as only allowing one vote per poll per user, rather than allowing multiple choices. This will be driven more by the website than by the command, and I will probably use a Bot to send the message into the relevant channel.
Let me know what you think! Add it to your Slack team, give it a try and get it touch on twitter - @florx