PagerDuty and Webscript.io | Conference Calls, Heartbeat Monitoring & More
PagerDuty sends out webhooks when different events happen on an incident. A webhook is a custom HTTP request that can contain more or less anything you want, posted to an address you specify. It’s a great way to get applications talking to each other without the complexity of a full-blown API. We currently use webhooks to support integrations with HipChat, Slack, Zapier and other tools, and we frequently see customers using this feature to build their own custom integrations.
Dave Hayes, product manager at PagerDuty, used webhooks in a previous hackday to create an animated map of PagerDuty incidents. He used Firebase to handle PagerDuty’s incoming webhooks, but I wanted something even simpler, and found webscript.io.
Webscript.io lets you choose a URL that listens for incoming webhooks, then executes a script on whatever comes in. It’s awesome for translating between different types of input and output, kind of like a coder’s version of Zapier. As a bonus, it can also run scheduled scripts (cron jobs) at specified intervals.
For my project, I wanted to use webscripts to automate incident conference calling.
When a high-severity incident comes in, the first thing you want to do is get some eyes on the problem. You may want a backup or manager on the line if you’re a junior responder, or for severe problems, you may want the on-calls from several different teams.
In the heat of the moment, you don’t want to be fussing with chatting a conference call number or URL in a chat room– your team should instantly have the information they need to start collaborating. I wanted to figure out an automated way to add a conference call to a PagerDuty incident the instant someone acks it.
I was originally going to try using the Twilio API for this project, but I read about VoiceChatAPI (a Plivo project), which makes creating a new conference call ultra-simple. You don’t even need an API key!
Here’s how I set up my webscript.
And here’s how to do it:
1. Go to webscript.io, create a new webscript and give it an address
2. Paste in the webscript from here (or this one if you don’t want/need the hipchat integration).
3. Create a new PagerDuty service, and add a webhook pointing at the webscript address.
Besides conference calls, webscripts can do a bunch of other useful things for PagerDuty customers:
Use it as a heartbeat monitor to let you know if a device or service hasn’t checked in in a while (example script).
Check the uptime of a website using cron jobs.
Call an on-call engineer into an existing conference.
Translate webhooks from a monitoring service into PagerDuty API calls.
Translate outgoing PagerDuty webhooks into email alerts using your Gmail credentials.
You can find script examples and additional tips for using webscripts in the pagerduty-webscripts repo on Github.
Thanks to Steve Marx (@smarx) and DH (@dhfromkorea) for their help in putting together this project, as well as the teams at Webscript.io and Plivo.
Find these scripts useful? Have your own way to get PagerDuty and other apps talking to each other? Leave a comment, drop us a line on twitter or submit a pull request.