Bring a robot

Posted on

Ever find yourself in a chat room without a helper robot?

I know I have. These days I won’t set foot in one without my trusty @raybot though.

You should have a robot too.

And you can, for free, with Github’s hubot and Heroku. All told it took me about 4 hours to get hubot live and configured with 70 of my favorites scripts. But I tend to go 110% when adopting new tech. I’ll bet you can do it in 20 minutes if you’re a wiz.

Here’s the basic order of operations:

  1. Set up your hubot by following the setup instructions.
  2. Deploy it on Heroku.
  3. Customize to your heart’s content with all the scripts in the catalog
  4. Install dependencies for the additional scripts you install: `npm install <dependency> –save’
  5. Set configuration variables for the additional scripts via the CLI. Locally you can fire up a bash shell and run export <CONFIGURATION_VARIABLE>=<value>. To set them on your heroku server, use the Toolbelt like so: heroku config:add <CONFIG_VAR>=<value>. You don’t need to wrap the values or the variable name in quotes, e.g., export HUBOTIRCROOMS=krry uxioms
  6. Add it to your Grove.io IRC, your Skype rooms, Campfire chats, Gtalk, etc., with some node modules and environment variables.

And remember, as a node app, hubot’s mothertongue is JSON. So if you’re savvy you can directly configure most things by editing hubot-scripts.json and package.json. Or you go the safe routes and add .coffee scripts to the scripts/ directory and modules through npm.

Protip: set up a mongoDB on your heroku instance so your hubot’s data can persist across sessions, updates, and reboots. I went with mongolab (heroku addons:add mongolab) because it’s free and I had already tried MongoHQ on another project. You’ll have to add the mongolab-brain.coffee script to your hubot-scripts.json, and a few configuration variables that it specifies in the comments at the top.

Here’s the cool part

By adding some scripts, you can teach your hubot all kinds of awesome tricks, from fetching you GIFs of anything with party_gifs.coffee, to keeping track of everyone’s karma points with plusplus.coffee, to coming up with a great excuse for you with devexcuse.coffee. Hubot can be as useful or as amusing as you want. You can even rig up FOAAS to keep things/people in their place without straining your cuss-muscles.

And that’s what’s up on the hubot tip

May you never feel alone in a noisy, crowded chat room again.

Leave a Reply

Your email address will not be published. Required fields are marked *