hubot-hipchat v2.12.0-6
hubot-hipchat
Quickstart: Hubot for HipChat on Heroku
The Easy Way
Try deploying the "Triatomic" starter HipChat Hubot project to Heroku. Once you have it running, simply clone it and customize its scripts as you please.
The "I do it myself!" Way
This is a HipChat-specific version of the more general instructions in the Hubot wiki. Some of this guide is derived from Hubot's general set up instructions. You may wish to see that guide for more information about the general use and configuration of Hubot, in addition to details for deploying it to environments other than Heroku.
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.
If you are using Linux, make sure libexpat is installed:
% apt-get install libexpat1-devYou will need node.js. Joyent has an excellent blog post on how to get those installed, so we'll omit those details here. You'll want node.js 0.12.x or later.
Once node and npm are ready, we can install the hubot generator:
% npm install -g yo generator-hubotThis will give us the hubot yeoman generator. Now we can make a new directory, and generate a new instance of hubot in it, using this Hubot HipChat adapter. For example, if we wanted to make a bot called myhubot:
% mkdir myhubot % cd myhubot % yo hubot --adapter hipchatAt this point, you'll be asked a few questions about the bot you are creating. When you finish answering, yeoman will download and install the necessary dependencies. (If the generator hangs, a workaround is to re-run without the
--adapter hipchatargument, accept the defaultcampfirevalue when prompted, and then re-run yet again, again with the hipchat adapter argument, accepting the prompts to overwrite existing files. This appears to be an issue with the generator itself.)Turn your
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-hubotAdd Redis To Go to your Heroku app:
% heroku addons:add redistogo:nanoConfigure it:
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.comWhere the URL is your Heroku app's URL (shown after running
heroku create, orheroku rename).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=1This will tell Heroku to run 1 of the
webprocess type which is described in theProcfile.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 useheroku configto check the config vars andheroku 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 thescripts/directory.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
Scripting Gotchas
robot.messageRoom syntax is as follows
robot.messageRoom("1234_room@conf.hipchat.com", "message");Adapter configuration
This adapter uses the following environment variables:
HUBOT_HIPCHAT_JID
This is your bot's Jabber ID which can be found in your XMPP/Jabber account settings. It will look something like 123_456@chat.hipchat.com
HUBOT_HIPCHAT_PASSWORD
This is the password for your bot's HipChat account.
HUBOT_HIPCHAT_ROOMS
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 "123_development@conf.hipchat.com" 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".
HUBOT_HIPCHAT_ROOMS_BLACKLIST
Optional. This is a comma separated list of room JIDs that should not be joined.
HUBOT_HIPCHAT_JOIN_ROOMS_ON_INVITE
Optional. Setting to false will prevent the HipChat adapter from auto-joining rooms when invited.
HUBOT_HIPCHAT_JOIN_PUBLIC_ROOMS
Optional. Setting to false will prevent the HipChat adapter from auto-joining rooms that are publicly available (i.e. guest-accessible).
HUBOT_HIPCHAT_HOST
Optional. Use to force the host to open the XMPP connection to.
HUBOT_HIPCHAT_XMPP_DOMAIN
Optional. Set to btf.hipchat.com if using HipChat Server.
HUBOT_LOG_LEVEL
Optional. Set to debug to enable detailed debug logging.
HUBOT_HIPCHAT_RECONNECT
Optional. Seting to false will prevent the HipChat adapter from auto-reconnecting if it detects a server error or disconnection.
Running locally
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 hipchatBut be aware that credentials normally shouldn't be checked into your vcs.
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
