hubot-hipchat-hs

2.4.5-1 • Public • Published

hubot-hipchat

Quickstart: Hubot for HipChat on Heroku

This is a HipChat-specific version of the more general instructions in the Hubot wiki.

  1. Create a new HipChat account for your bot to use. Stay signed in to the account - we'll need to access its account settings later.

  2. Download the latest Hubot package from https://github.com/github/hubot/archive/master.zip

  3. Extract it

  4. In a terminal, go to the extracted directory, and do this:

     % npm install
     % make package
    
  5. The hubot/ directory that was just created is all that is relevant to us now. Let's switch to it:

     % cd hubot/
    
  6. Edit package.json and add hubot-hipchat to the dependencies section. It should look something like this:

     "dependencies": {
       "hubot-hipchat": ">= 2.4.5",
       ...
     }
    
  7. Edit Procfile and change it to use the hipchat adapter:

     web: bin/hubot --adapter hipchat
    
  8. Turn your hubot directory into a git repository:

     % git init
     % git add .
     % git commit -m "Initial commit"
    
  9. Install the Heroku command line tools if you don't have them installed yet.

  10. Create a new Heroku application and (optionally) rename it:

     % heroku create
     % heroku rename our-company-hubot
    
  11. Note: If you're going to include the redis-brain.coffee plugin you'll need to add Redis To Go.

     % heroku addons:add redistogo:nano
    
  12. Configure it:

    You will need to set a configuration variable if you are hosting on the free Heroku plan.

     % heroku config:add HEROKU_URL=http://soothing-mists-4567.herokuapp.com
    

    Where the URL is your Heroku app's URL (shown after running heroku create, or heroku 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="..."
    
  13. Deploy and start the bot:

     % git push heroku master
     % heroku ps:scale web=1
    

    This will tell Heroku to run 1 of the web process type which is described in the Procfile.

  14. 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 config to check the config vars and heroku restart to restart the bot. heroku ps will show you its current process state.

  15. 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).

  16. To configure the commands the bot responds to, you'll need to edit the hubot-scripts.json file (valid script names here) or add scripts to the scripts/ directory.

  17. To deploy an updated version of the bot, simply commit your changes and run git push heroku master again.

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

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_DEBUG

Optional. Set to true to enable some additional debug logging.

HUBOT_HIPCHAT_HOST

Optional. Use to force the host to open the XMPP connection to.

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="..."

~/hubot/bin/hubot --adapter hipchat

OSX note

This adapter requires node-stringprep which in turn, requires icu-config to be available in the path. You'll need to install icu4c, which, conveniently, homebrew can take care of for you:

% brew install icu4c

But brew will not link any of the utilities, you'll have to do that by hand (in particular icu-config which is needed for node-stringprep to build correctly (it'll just appear like a broken package otherwise which will be really disturbing)). You can link it with brew using brew link icu4c.

Package Sidebar

Install

npm i hubot-hipchat-hs

Weekly Downloads

1

Version

2.4.5-1

License

MIT

Last publish

Collaborators

  • henryqdineen
  • maxwellskala
  • arota-hubspot
  • service-ccs
  • rberdeen-hubspot
  • also
  • kj800x
  • friss
  • jhilker