🐧 Ciel, Yiwei Gong

Hubot Heroku Hipchat

Thu Nov 21, 2013

How you can give Siri her very own robot brother with some help from Heroku and HipChat.

Github release Hubot which brings a lot of fun to the geek world. He’s the second robot butler to enter my life lately, Siri being the first. Today, I am going to introduce that deploy hubot on Heroku for free and working with HipChat. Don’t worry, all of them are free for personal use.

Get Start

First, you have to get hubot installed on your computer. Hubot is written in node.js and CoffeeScript. You have to install npm first. You may go to node.js official website http://nodejs.org to get more details.

After that, we may start installing our lovely hubot. Go to http://hubot.github.com and you will see

I would like to create my own hubot

then it brings a lot of information about hubot. Flow the instruction, we type

npm install -g hubot coffee-script

to install hubot. After that, we are going to create new bot.

cd /path/to/any/directory
hubot --create myhubot
cd myhubot

Now you are under hubot directory. If you want to run hubot locally, you may have to delete redis-brain.coffee in hubot-scripts.json, or you will need a Redis server running. More details ref to issue#551 on Github.

You may type bin\hubot now to start hubot locally for testing.


Now we are going to deploy hubot on Heroku. Heroku provides free node.js hosting for 1 project. See Pricing to get more details.

Before we start, you have to register a Heroku account and install Heroku Toolbelt. Make sure you have finished Get Start.

Heroku uses git to deploy their application. First we set up our Heroku account.

heroku login
Enter your Heroku credentials.
Email: [email protected]
Could not find an existing public key.
Would you like to generate one? [Yn]
Generating new SSH public key.
Uploading ssh public key /Users/you/.ssh/id_rsa.pub

Then, in hubot directory, create a git repository.

git init
git add .
git commit -m "Initial commit"

Then create a Heroku application:

heroku create

You may use heroku rename your_app_name to rename Heroku application.

After this command, you should see a URL link created by Heroku, which is your application URL. Also, Heroku creates a remote git repository and added as heroku. You can type git remote to see more details.

Now we have to configure environment variables on Heroku. Simply type

heroku config:add HEROKU_URL="Your application's URL"

Then we add RedisToGo to heroku.

heroku addons:add redistogo:nano


Ok, it is time to get HipChat. Go to there website and register a new user. Then in Group admin page, click user and Add user. You have to add a new user which will be used for hubot login. In this case, you may need register a new email for your hubot. Also, create a good @mentions for your hubot.

After this, your hubot email will receive an invitation, then you can register a new user. Login to HipChat with your hubot user, and In Account Setting, find XMPP/Jabber info. You can get all details about your Jabber account. We are going to use this in Deploy session.


Under your hubot directory, install hubot dependencies:

npm install

Install the HipChat adapter:

npm install --save hubot-hipchat

Edit Procfile and change it to use the HipChat adapter:

web: bin/hubot --adapter hipchat


git add .
git commit -m "HipChat Adapter"

Configure environment variables:

heroku config:add HUBOT_HIPCHAT_JID="Your hubot's JID in_XMPP/Jabber info Page"
heroku config:add HUBOT_HIPCHAT_PASSWORD="Your hubot's HipChat account password"


git push heroku master

You will see a lot of code flying. Heroku will report errors if unsuccessful.

After git push, we can start it with:

heroku ps:scale web=1

Now login HipChat with your own account, you will see your hubot is online. You may start talking with him. You can use @your_hubot help to get help information.

Something More

When deploy Heroku, you have some optional environment variables for HipChat setting. See hubot-hipchat to get more information.

You can add more functions to hubot. There are a lot on Github hubot-scripts. You may find a lot of fun with these awesome scripts. Simply, you can just edit hubot-scripts.json, and add script name you want, then git push again.

Have fun.

< 念奴娇
酬之铮兄诗 >