I have been having some nerdy fun lately building chat bot integrations with the new messaging and file sharing app, Slack. Slack was created by the same folks who made the web game Glitch, many of whom were also previously involved in the creation of Flickr and the web game that predated it. Point being, Slack is pretty rad and fun to use.
All you need to know is that Slack, amongst other things, provides a chat room for my company that can be connected to various external services that can then send and receive messages in the chat room alongside all the real people. I hope my team can use it to work better as an organism by embedding things like peer review into our regular conversation via integrations with Github and our automated deployment system.
The first thing I did was build a bot using Node and hosted on Heroku that would query my Google calendar and respond with the next upcoming scheduled event. I wrote a quick script to parse the provided ICS file, do some time zone conversions, and tied it in to Slack via a simple webhook.
Voila, @Bot is now in my Slack chat room available to help me and my team at XOXCO stay organized.
But why stop there? It was so easy to build this, I decided to keep going. I added commands to see the day’s full schedule. I added a command that queries Toggl, our time tracking app, and displays a summary of everyone’s billed hours for the week. I even taught the bot to help us choose where to eat lunch.
Next, I added a JSON (and plain-text) endpoint to the services offered by tableflipper.com, allowing my bot to request a random table flipping GIF on demand. You too can request GIFs by hitting tableflipper.com/json ortableflipper.com/gif. Why?
So, tables flipped, I taught the bot about anger and the release thereof:
Part of doing all of this involved building a Node module to send and receive Slack messages. You can use it too as I have made it available on Github and installable via NPM.
Building things like this is getting easier and easier by the day. Soon the entire world will be controlled by automated deploy scripts, and that is a world I welcome with open arms.