Skip to content

Instantly share code, notes, and snippets.

@howardpanton
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howardpanton/d1c1f71b50baef64e789 to your computer and use it in GitHub Desktop.
Save howardpanton/d1c1f71b50baef64e789 to your computer and use it in GitHub Desktop.

Adding HipChat support to applications

Simple instruction that show you how to add HipChat support for your app so that it will post to a room of your choice, preferably one for the application in question. Both require an API token which you can get from Niklas. v2 of the HipChat API lets you use your own tokens, but I couldn't get that working intially.

Travis

You can optionally use secure tokens in your travis.yml file. It requires you to install the travis command line tool:

$ gem install travis

If you aleady have a travis.yml file (I assume you have), and run this command in the same dir:

$ travis encrypt <API token>@<room name> --add notifications.hipchat.rooms

It will prepopulate your travis.yml file with the correct information. You manually add it like so:

notifications:
  hipchat:
    rooms:
      secure: somesecuretokenstring
    template:
    - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}"

Capistrano

You need to add the hipchat gem to you GemFile in the development section

gem 'hipchat'

to you deploy.rb file you add:

set :hipchat_token, "<API token>"
set :hipchat_room_name, "room name"
set :hipchat_announce, true

Simple. Now when you deploy you should see the notification in the room you chose. As you can see the Capistrano setup does not use a secure token. You could store the API key in a yml file that is not in source control and load it manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment