Integration with HipChat

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 http://www.hipchat.com/account/api. For self-hosted/Datacenter HipChat, the URL will be http://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.

Have more questions? Submit a request

3 Comments

  • 0
    Avatar
    Mark Stosberg

    The embedded article images on this page are all broken. 

  • 0
    Avatar
    Mark Stosberg

    It would be helpful to clarify whether a HipChat API v1 token is being used or Hipchat API v2 token. v1 API tokens are deprecated. 

  • 0
    Avatar
    Allan Burdajewicz

    Hello Mark,

    I have created a ticket internally to fix the images.

    The HipChat plugin integrates with both version. You can specify which version you want to use in the Global configuration. If you use Pipeline, you can also specify the version in the Jenkinsfile / pipeline script:

    hipchatSend(
      color: "RED",
      message: "${env.JOB_NAME} #${env.BUILD_NUMBER} failed! (<a href=\"${env.RUN_DISPLAY_URL}\">Open</a>)",
      notify: true,
      room: 'teama-room',
      credentialId: 'HipChat-API-Token-v2',
      v2enabled: true
    )

     

    If it didn't help you can request help on Users Mailing list or IRC. If you are a CloudBees customer feel free to raise a support ticket.

    Regards,

    Edited by Allan Burdajewicz
Please sign in to leave a comment.