Integration with HipChat

Article ID:205031084
2 minute readKnowledge base

Issue

  • Jenkins notifications with Hipchat

  • Integrate Hipchat with Jenkins

Environment

  • Jenkins

  • Jenkins LTS

  • CloudBees Jenkins Enterprise

  • HipChat

Resolution

A quick guide to setting up integration with HipChat and Jenkins:

  1. First, install the HipChat plugin. In your Jenkins instance, go to Manage Jenkins > Manage Plugins > Available > and search for the HipChat plugin.

  2. Restart the Jenkins instance.

  3. Open another browser tab and navigate to your HipChat API url. For public/cloud HipChat, the URL is https://www.hipchat.com/account/api. For self-hosted/Datacenter HipChat, the URL will be https://YOURHIPCHATHOST/account/api

  4. You will be prompted to log into HipChat if you haven’t already. Log in as the user you want to send HipChat notifications from. We recommend that you create a dedicated HipChat user for this, named e.g. "Jenkins."

  5. Generate a new API token with the following permissions: Send Notification, View Room. You can put anything in the Label field, such as "Jenkins notifications." This is just to help you track in HipChat where the API token is used.

  6. Select and copy the API token string.

  7. In Jenkins, go to Manage Jenkins > Configure System, and scroll down to the section labeled "Global HipChat Notifier Settings."

  8. For cloud HipChat, leave the server hostname set to api.hipchat.com. For self-hosted hipchat, the hostname should be the same one you used to access the web UI, e.g. "hipchat.mycompany.com."

  9. Leave "Use v2 API" checked.

  10. Click the "Add" button next to "Credentials," set the Kind to "Secret text," and paste your HipChat API token into the Secret field. In the ID field put something like "hipchat-api." After saving the credential, select it from the dropdown menu.

  11. Enter the name of the room you want notifications to be sent to by default (you can override this on a per-job basis).

  12. Put the name of the HipChat user you used to create the API token (e.g. Jenkins in our example) in the "Send As" field.

  13. At this point if you click the "Test configuration" button you should see a test message appear in the HipChat room you specified.

If desired, you can now configure default HipChat notifications which would be sent for any Jenkins job in your instance which does not otherwise have them configured. A better practice is usually to configure these on a per-job basis, so as to limit the amount of alert noise in your HipChat rooms. If you use per-job configuration, you will have the option to specify different HipChat rooms for each job.