Pagerduty talking to hipchat

Posted on Wednesday, September 10, 2014


This guide will go over setting up a webhook in a pagerduty service to send updates to a HipChat room.  When this is set up, correctly, whenever a service is triggered, acknowledgement, or resolved a message will be pushed to your HipChat room.

This guide will get you through getting a pagerduty service (alert) webhook







Adding a room to Hipchat


I am not going to go over how to set up Hipchat in this guide, I am going to assume you already have it set up.  If you need some help with that I wrote this guide http://www.whiteboardcoder.com/2014/08/hipchat-getting-stared.html.   

This guide takes a lot from a pagerduty guide which can be found at http://www.pagerduty.com/docs/guides/hipchat-integration-guide/ [1]



Head over to the hipchat page https://www.hipchat.com/ [2]




Click Sign in







Enter your information and click Sign In.





Click Launch the web app






Click Create Room






Give it a name and topic, Set it to Open and click Create Room.






Now I have the room I want to send pagerduty updates to.


Pagerduty webhook to HipChat



Login to pagerduty.




Open Services.






Open a service by clicking on its name.







Scroll down to and click on + Add a webhook









Now comes the hard part.  Enter in a Name for the webhook, I used HipChat.  Then enter the endpoint URL.


Says to enter the URL like this

https://api.hipchat.com/v1/webhooks/pagerduty/?auth_token=<auth_token>&room_id=<room_id>

But replaces the room_id with your room id and the auth_token with your auth token.


Where can we find those?



Room Id









From the HipChat page click on the Rooms tab







Click on the room name









Here is the room ID.  The API ID is the room ID.

For this document assume its 777







Click On Tokens on the left hand side.  Enter a label.  I entered pagerdutytest1234,  Then click Create.






A long token key is created for you.

For this document assume its R4r7.


Putting this all together in the URL webhook we would have

https://api.hipchat.com/v1/webhooks/pagerduty/?auth_token=R4r7&room_id= 777








Back on pagerduty, enter in the HipChat URL and click Save







You now have a webhook!


Try it out!


Trigger your event and see what shows up in the HipChat room.




It did not work…..





Fixing the issue



I had a token for the room and not an API key.  The room id was correct.

Only the HipChat Admin for your group has this Key.  In my case I found it and entered it.

If you are the admin here is how to locate it.




Logint to HipChat as an admin.
Then click on Group Admin





Click API




Enter your password  and click Submit






For type select "Notification"





Give it a name and click Create









The Admin API Token is here!

A long token key is created for you.
For this document assume its A099.




Putting this all together in the URL webhook we would have 
https://api.hipchat.com/v1/webhooks/pagerduty/?auth_token=A099&room_id= 777









Back on pagerduty, enter in the HipChat URL and click Save







You now have a webhook!






Try it out!


Trigger your event and see what shows up in the HipChat room.




This time it did work just fine!











You can see that Pagerduty will send messages to hipchat when a service is

·         Triggered  (red)
·         Acknowledged (yellow)
·         Resolved  (green)


That is it, hope you got your pagerduty talking to hipchat.

I think this is a very nice useful feature for teams.






References
[1]        How To Integrate HipChat with PagerDuty
                        http://www.pagerduty.com/docs/guides/hipchat-integration-guide/
                Accessed 08/2014
[2]        hipchat web page
                        https://www.hipchat.com/

                Accessed 08/2014




This post is a part of and epic, the pagerduty and twilio epic.

Epic Goal:   Set up a phone number, via twillio, that when called will set off a pagerduty event.

No comments:

Post a Comment