How to send notifications to a HipChat room? (discontinued)

Is it possible to send alert notifications to a HipChat room?

Note: Atlassian has discontinued both HipChat and Stride messaging services in favor of Slack. Please refer to our Slack integration article. These instructions are provided for archive reasons.

Q: I need to post a message to a HipChat room every time alert is executed. How can I do that?

A: Please follow the below tutorial, explaining how to post IPHost Network Monitor alert notifications to HipChat room. There is more than one way to do this; we will use personal access token, thus notifications will be sent on behalf of user who created this token. This is probably the easiest way.

1. Obtain personal access token

Authenticate in HipChat and open this URL (use your team name instead of the placeholder):

https://<your_team>.hipchat.com/account/api

Use the below settings to create a token:

Create new HipChat token

Write down the generated token:

Write down new HipChat token

2. Determine room ID for notifications

Create a new room for IPHost Monitor alerts, or use an existing room. Determine room ID by joining the room, and looking at current URL in a browser’s address field:

Determine HipChat room ID

Room ID is numeric trailing part of the URL. Write it down as well.

3. Create Send HTTP(S) request action

Now open IPHost GUI client and create new “Send HTTP(S) request” action (click “Alerting > Alerts”, select “Simple Actions” tab):

HipChat notifications - create HTTP(S) request action

For this action, use the parameters gathered at previous steps, and define JSON payload using the template variables:

HipChat notifications - HTTP(S) action definition

Fields values:

  • Set URL field to
    https://api.hipchat.com/v2/room/your_room_id/notification?auth_token=your_auth_token

    where

    your_room_id in the URL field: numeric room ID obtained at step 2

    your_auth_token in the URL field: token string obtained at step 1

  • Use the following POST Data (message payload):
        {
             "color" : "gray",
             "message" : "<img src='//cdn.iphostmonitor.com/images/icons/16x16/$NewState.png'/<>a href='$MonitorReportUrl'>$MonitorName</a> on <a href='$HostReportUrl'>$HostName</a> - $EventShortDescription $Duration"
        }
  • Add Content-Type: application/json to HTTP headers
  • Add 204 to Accepted response codes

Click “OK” required amount of times to save the changes.

Now add newly created Simple Action to an existing alert, for example to “E-mail to Administrator + Popup” alert used by the Default Alerting Rule. Click “Alerts”, select “E-mail to Administrator + Popup” (or any other alert of your choice), and click “Edit”. Use “Add” drop-down in a newly opened alert editor to add “Post to HipChat #alerts” simple action:

HipChat notifications - add HipChat action to alert

4. Test HipChat notifications

Now that “Post to HipChat #alerts” action has been added to alerts, try putting a monitor to Down state and back (by altering its “State conditions” and polling the monitor), or use “Alerting > Testing” tab to simulate alert execution.

If HipChat integration has been done correctly, you will see something like below in your HipChat room. Please note that alerts are identified by IPHost state icons:

HipChat notifications - see alerts in HipChat room

Related topics