Code Samples

Code written with the PagerDuty API

PagerDuty has a very active developer community, and we've gathered some of the best tools here to share:

Type
Description

Libraries in Python, Ruby or JavaScript to get your project started

A selection of finished tools for chat integration, reporting or scheduling PagerDuty. Also includes 2-way integrations.

Looking to try out our API? Here are some code samples to get started with:

Name
Description
API Version

Comprehensive API examples in Ruby by the PagerDuty support team.

v1 & v2

Comprehensive API examples in Python by the PagerDuty support team.

v1 & v2

Comprehensive API examples in PHP by the PagerDuty support team.

v1 & v2

PHP examples for parsing webhooks.

Webhooks

Code to display an iframe with who's on call and their contact information. Live demo

v1

Minimal example to display who is on call using PDJS.

v1

Minimal example of using our REST API with the Ruby gem HTTParty.

v2

An AngularJS script for filtering and modifying PagerDuty incidents.

v2

A winner of the Hack the North hackathon in Waterloo, alerts on Bloomberg stock movements in Python.

Events

A node.js client for PagerDuty.

Events

Like Zapier for coders. Make conference calls, set up heartbeat monitoring, ping HipChat, and more.

v2

Generate report of PagerDuty activity for a specific time range.

v2

A quick command-line to get the incident volume assigned to an escalation policy broken down by week.

v2

How to determine who is on-call using Ruby and the PagerDuty API. For IRC.

v2

A Resque failure backend for triggering incidents in Pagerduty.

Events

How much time am I on call?

v2

PagerDutySays catches a PagerDuty webhook (triggered incident) and sends the event description to a Text To Speech Program.

Webhooks

Grappling is a hacky domain specific language for working with PagerDuty's webhooks.

Webhooks

This is a set of Bash and Ruby scripts that can be customized to automate the escalation of particular JIRA issues matching a JQL query to PagerDuty.

Events

Get details about a specific incident or range of incidents including the incident body.

v2

Use slash commands in Slack to find out who is on-call.

v2

Please review the disclaimer prior to downloading sample code.

Code Samples