This article is very old. Technical aspects of this article may be
Recently, I came across Hubot - the amazing bot
from Github, which lets me do nearly anything while
talking to it. Some of the examples being querying my site for availability,
tracking down how many visitors I had in last 24 hours, updating my twitter
status, grabbing tasks from my basecamp projects, and so on.
Currently, I am using Hubot on HipChat and GTalk, but as
my team frequently uses Skype, I will be enabling a Skype adapter for it,
pretty soon (the Skype adapter, in particular, can not be installed on
Heroku). The Hubot instance runs as Edwin Jarvis, as
I always wanted to have something close to the esteemed J.A.R.V.I.S. from the
Here is a brief overview for anyone wanting to get started with Hubot:
- Install Node.js
- Clone the hubot repository from github, locally:
git clone http://github.com/github/hubot jarvis
This should start the Hubot in your Shell. If, instead, this gives an error
redis was not found or something similar, make sure to remove
hubot-scripts.json file, and try running again!
Using Multiple Adapters
Ok, so running Hubot locally is good - we can see what it does, we can test
out our code/scripts, etc., but the real power of hubot lies in running it
over a chat server, so that it acts like ChatOps - you can virtually do
anything online by simply talking to the Hubot (think: deploying your code).
Since, Hipchat now provides a free plan for upto
5 users, it stands ideally as a Chat server for our needs (we are a small
team). Additionally, GTalk serves as a quick access to our bot, since it is
always open via either the GMail browser tab, or via some chat client.
However, there is a sligh problem. Hubot doesn’t currently support multiple
adapters, i.e. we can’t tell hubot to run on both Hipchat and Gtalk,
simultaneously, while using the same source code. But, why use the same
source? Why not make another hubot to run on GTalk? Well, I use a lot of
scripts - some are custom - and it is a pain to update two sources to make the
two hubots use the same set of scripts. Therefore, I implemented the following
procedure to let the two hubots use the same source:
- First, create new dedicated accounts for our hubot on both Hipchat and
hubot-gtalk as dependencies in
It should look like:
"hubot-hipchat": ">= 2.4.5",
"hubot-gtalk": ">= 0.0.1",
Procfile so that it uses adapter name and user from the environment
variables that we will create for the heroku instance of each bot:
web: bin/hubot -a $HUBOT_ADAPTER_NAME -n $HUBOT_ADAPTER_USER
- Create a git repository for our bot, so that we can track our bot’s code:
git add .
git commit -am "Initial Commit"
Download and install Heroku Toolbelt, since
we will be deploying our bots to Heroku.
Let us, first deploy our bot on GTalk, since it is a bit easy. Start by
creating a Heroku application for our GTalk bot:
heroku rename 'some-random-name-for-our-gtalk-bot'
git remote rename heroku gtalk
- We will be using
redis as our bot’s brain. So, install
redis on our
heroku instance (which is free, by the way):
heroku addons:add redistogo:nano
- Set our environment variables for the GTalk bot:
heroku config:add \
HUBOT_ADAPTER_USER="<bot name>" \
HUBOT_GTALK_USERNAME="<bot gmail complete address>" \
HUBOT_GTALK_PASSWORD="<bot gmail password>" \
HUBOT_GTALK_WHITELIST_DOMAINS="<your company domain name>"
Your Gtalk bot is now live.
Let us, now, run this on HipChat. Start again, by creating a Heroku
application for our Hipchat bot:
heroku rename 'some-random-name-for-our-hipchat-bot'
git remote rename heroku hipchat
heroku addons:add redistogo:nano
git push hipchat master
- Set our environment variables for the HipChat bot. Settings marked with
@@ can be obtained by visiting your bot’s XMPP/Jabber account
settings, after logging in HipChat
with your bot’s account:
heroku config:add --app="<name-for-our-hipchat-bot>" \
HUBOT_ADAPTER_USER="<@@room name>" \
HUBOT_HIPCHAT_PASSWORD="<hipchat.com password for your bot>"
- Your HipChat bot should now be live. Try logging in as a normal hipchat
user, and talking to the bot (hint:
@jarvis help, where my bot’s mention