Blog

Hack Your On-Call Status with PagerDuty's API

by Clay Smith March 12, 2014 | 2 min read

Knowing your on-call status is more important than knowing if it’s raining outside. Unlike dealing with the drizzle that’s passed over San Francisco recently, if I’m on-call you need leave the house with more than an umbrella.

Your on-call status is an integral part of PagerDuty’s iOS and Android apps. We’ve also created a few new endpoints on our REST API that make getting your current on-call status more straightforward. Full documentation of these new endpoints, as always, is on our developer documentation site.

To stayed informed of my current on-call status, I’ve hammered out a couple shell script one-liners and a JavaScript bookmarklet. You will need a PagerDuty API key to try the scripts out. These were written for a Mac OS X environment with node installed, but can be easily modified to run in other environments.

Send an Inspiration Email Reminder

Sometimes it’s useful to treat an escalation policy as a mailing list. For a particularly rough on-call rotation, this script will send an inspirational email to everyone on-call for a particular escalation policy. Animal videos are always appreciated.

A Pleasant Voice Reminder

amioncall_terminal

When you have over 50 tabs open in Chrome, more text on the screen is the last thing you need. I’ve created an alias of this script so when I type “amioncall” in the terminal Mac OS X will speak my on-call status in a pleasant voice.

Bookmarklet for your Toolbar

javascript_toolbar

I have on-call handoff notifications configured for all of my accounts, but sometimes it’s useful to know how long you have left until your shift ends. I wrote a tiny JavaScript bookmarklet that’s in my toolbar that pops up my on-call status on any page.

Hooking it All Up!

https://gist.github.com/smithclay/5299ba54285398ecd583