Quickstart: Hubot for HipChat on Heroku
This is a HipChat-specific version of the more general instructions in the Hubot wiki.
From your existing HipChat account add your bot as a new user. Stay signed in to the account - we'll need to access its account settings later.
Make sure native dependencies are installed:
(e.g. OS X with brew) % brew install icu4c % brew link icu4c (e.g. Linux with apt-get) % apt-get install libexpat1-dev % apt-get install libicu-dev
hubotfrom npm, if you don't already have it. Note the explicit version reference. The version # of hubot-hipchat is kept in line with hubot. If your hubot's version is greater than hubot-hipchat's, that means it hasn't been tested and may not work!
% npm install --global coffee-script email@example.com
Create a new
% hubot --create <path>
Switch to the new
% cd <above path>
% npm install
% npm install --save hubot-hipchat
Procfileand change it to use the
hipchatadapter. You can also remove the
-n Hubotarg as the bot will automatically fetch its @mention name from HipChat.
web: bin/hubot --adapter hipchat
hubotdirectory into a git repository:
% git init % git add . % git commit -m "Initial commit"
Install the Heroku command line tools if you don't have them installed yet.
Create a new Heroku application and (optionally) rename it:
% heroku create our-company-hubot
Add Redis To Go to your Heroku app:
% heroku addons:add redistogo:nano
You will need to set a configuration variable if you are hosting on the free Heroku plan.
% heroku config:add HEROKU_URL=http://our-company-hubot.herokuapp.com
Where the URL is your Heroku app's URL (shown after running
heroku create, or
Set the JID to the "Jabber ID" shown on your bot's XMPP/Jabber account settings:
% heroku config:add HUBOT_HIPCHAT_JID="..."
Set the password to the password chosen when you created the bot's account.
% heroku config:add HUBOT_HIPCHAT_PASSWORD="..."
If using HipChat Server Beta, you need to set xmppDomain to btf.hipchat.com.
% heroku config:add HUBOT_HIPCHAT_XMPP_DOMAIN="btf.hipchat.com"
Deploy and start the bot:
% git push heroku master % heroku ps:scale web=1
This will tell Heroku to run 1 of the
webprocess type which is described in the
You should see the bot join all rooms it has access to (or are specified in HUBOT_HIPCHAT_ROOMS, see below). If not, check the output of
heroku logs. You can also use
heroku configto check the config vars and
heroku restartto restart the bot.
heroku pswill show you its current process state.
Assuming your bot's name is "Hubot", the bot will respond to commands like "@hubot help". It will also respond in 1-1 chat ("@hubot" must be omitted there, so just use "help" for example).
To configure the commands the bot responds to, you'll need to edit the
hubot-scripts.jsonfile (valid script names here) or add scripts to the
To deploy an updated version of the bot, simply commit your changes and run
git push heroku masteragain.
Bonus: Add a notification hook to Heroku so a notification is sent to a room whenever the bot is updated: https://www.hipchat.com/help/page/heroku-integration
robot.messageRoom syntax is as follows
This adapter uses the following environment variables:
This is your bot's Jabber ID which can be found in your XMPP/Jabber account settings. It will look something like
This is the password for your bot's HipChat account.
Optional. This is a comma separated list of room JIDs that you want your bot to join. You can leave this blank or set it to "All" to have your bot join every room. Room JIDs look like "firstname.lastname@example.org" and can be found in the XMPP/Jabber account settings - just add "@conf.hipchat.com" to the end of the room's "XMPP/Jabber Name".
Optional. This is a comma separated list of room JIDs that should not be joined.
Optional. Setting to
false will prevent the HipChat adapter from auto-joining rooms when invited.
Optional. Use to force the host to open the XMPP connection to.
Optional. Set to btf.hipchat.com if using HipChat Server Beta.
Optional. Set to
debug to enable detailed debug logging.
Optional. Seting to
false will prevent the HipChat adapter from auto-reconnecting if it detects a server error or disconnection.
To run locally on OSX or Linux you'll need to set the required environment variables and run the
bin/hubot script. An example script to run the bot might look like:
#!/bin/bash export HUBOT_HIPCHAT_JID="..." export HUBOT_HIPCHAT_PASSWORD="..." bin/hubot --adapter hipchat