Show
Destroy
An entry
Get it down. Make it good. Share it.
Title
Text
Last Friday, in a @neoinnovate Slack channel, Principal, Michele Perras, encouraged us to build our own Slack bots. The thought of a Slack bot lingered over the weekend. I just spent ~3-days last week at the Code for America summit in Oakland, CA. On Saturday morning, while having coffee, I decided to give the [Slack API](https://api.slack.com/) a try. I quickly found the [slack-ruby-client](https://github.com/dblock/slack-ruby-client) .gem. Using the .gem, I was able to get to a working example [pretty quickly](https://twitter.com/randw/status/650388283063570432) - able to post a test message to a Slack channel from a Ruby prompt. Oh, the possibilities! How about Slack + [Code for America's API](http://codeforamerica.org/api/)? I wrote a basic service using the Slack bot, as an exercise with CfA's API and the [Heroku 1-click Deploy button](https://devcenter.heroku.com/articles/heroku-button). The exploration resulted in [civic-bot](https://github.com/afomi/civic-bot). The bot supports a few commands so far, and it retrieves data from Code for America's open API. In this case, we enter a Slack command, like `dot cfa:issues`, and that triggers a query to an external API based, and the result is displayed back in the Slack channel. This proof-of-concept enables behavior-of-our-choosing based on specific string sequences in a Slack channel. The bot service is 1-click deployable to Heroku and runs as a worker. Just specify the Slack Bot's token when creating the service. ### Takeaways * Slack's API is extra-easy to use * Programming bots is a challenging exercise in minimalist, functional design ------- #### Update: Code Snips * [Where message patterns are defined and responded to](https://github.com/afomi/civic-bot/blob/master/bot.rb) * [Where actions are defined](https://github.com/afomi/civic-bot/blob/master/slack/helper.rb) * [Where implementation details are stuffed for now](https://github.com/afomi/civic-bot/blob/master/slack/helper_text.rb) ------- Do you have any favorite Slack bots? Anything you'd love to see a Slack bot do? Share your thoughts below!
Status
idea
draft
release
personal
Series
Part of a Series?
Bitcoin
On Work
Phoenix Trello Tutorial
Civics
Re Email Address
Tags
slack
×
api
×
ruby
×
+
Slug
Url
Image 1
Image 2
Image 3
Visible
Date