Introducing CampfireBot: how our robotic assistant fosters productivity and team-building
Written by Guillermo Esteves, Front-end Engineer, The Verge
If you’ve been following this blog for a while, then you’ve already been acquainted with many of our Product Team members in previous posts, but today, we’d like to introduce one of our hardest-working teammates: CampfireBot, or cfbot for short.
It all started during that magical summer of 2007: developed entirely in-house by our VP of Technology Pablo Mercado (long before 37signals released a Campfire API), CampfireBot was originally a Ruby script that simulated a login into Campfire, stored the cookie, parsed the HTML response to "listen" to a room and replied using HTTP POSTs, for the main purpose of automating code deployment to our servers. Since then, it has evolved to use the Campfire API, Campfire and Jabber listeners written in Go, Redis integration for data storage, and a browser GUI built into our Banana Stand sandbox management tool.
All of this allows cfbot to perform a number of jobs that greatly enhance our productivity across the entire team, such as:
- Announcements of deployments to staging, production, or our various sandboxes.
- Announcements of new commits in our various projects.
- Error alerts in our Notifications room thanks to Sentry, New Relic, and Nagios integration.
- Searching through Binder, our custom-built search tool for storing internal company information and resources.
- "Pinging" people via IM when certain user-configurable keywords are uttered in any room, which comes in handy to get someone’s attention when they’re busy and away from Campfire.
- Integration with FogBugz, allowing bugs to be assigned to any user from Campfire.
- Integration with Pager Duty, to find out who is on call when shit hits the fan outside of business hours.
- Real-time traffic numbers for our sites thanks to our top-secret Providence analytics tool.
However, cfbot’s functionality doesn’t stop there, and adding new commands has become a rite of passage for new developers joining the Product Team. This has resulted in a multitude of commands and utilities, some useful, some… not so much, yet equally entertaining:
good morning is usually a good way to start the day; if it’s early and there’s no one else in Campfire, cfbot will keep you company. You mileage may vary if your name is "Dave", though.
what is your mood? queries cfbot’s current mood.
congratulate, used to celebrate important milestones in our team.
roll for rolling dice, just for fun or to greatly simplify our decision-making process.
weather for [location] uses the Forecast.io API to get a weather report for any part of the world.
rdio me [song name] is pretty self explanatory, but useful when you want to
rickroll share a song with the team.
ralph me, displays a random quote from Ralph Wiggum, if you like… stuff.
swanson me does, well, see for yourself.
yelp me comes in handy when trying to decide where to go for lunch close to the office.
aww me, otter me, corgi me, red panda me, and others, get a random image from different subreddits, depending on the command (e.g. aww me displays a random image from /r/aww).
show me [search term] display the first result of the Google Image Search for that term. Can be used as show me a gif of [search term] to narrow down the search to animated gifs, or as giphy me [search term] to do the same thing using Giphy, since we tend to hit the rate limit for Google Image Search pretty frequently.
gif add [keyword] and gif me [keyword] are used for storing and retrieving random gifs from collections in Redis, because sometimes all you need to get you through a long day of work are a few gif me kittens.
store [keyword] and get [keyword] are just a simple way of telling cfbot to store and retrieve certain data in Redis.
But my personal favorite, and I’m sure many of my teammates will agree, is [person] is at [url], which uses ImageMagick to superimpose cutouts of many of our team members on top of any image on the web, and has resulted in many hijinks over the years:
The is at command hit a major milestone earlier this year, when Polygon Software Engineer David Zhou extended it with the addition of OpenCV for face detection and replacement, with hilarious results:
You might be wondering what the point of all of this is, and why we waste time on it. Well… On one hand, the utility of cfbot’s integration with our development tools and services is evident: it allows us to stay appraised of what everyone is working on, when code is being deployed to production or our sanbox/staging environments, and when serious errors occurs, all of which are crucial for a team that is spread across the United States and for which Campfire is our main communication hub. But on the other hand, our cfbot tomfoolery, silly as it may seem, encourages people to be present and active in Campfire throughout the day, which helps everyone remain informed and part of the team, no matter how far away they are from their teammates. And to be honest, those special and rare "cfbot moments" – when a well-placed "is at" causes the entire office to explode in laughter – are one of the main reasons why coming in to work every day is so much fun.