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 Libraries in Python, Ruby or JavaScript to get your project started
Tools 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
Ruby Examples Comprehensive API examples in Ruby by the PagerDuty support team. v1 & v2
Python Examples Comprehensive API examples in Python by the PagerDuty support team. v1 & v2
PHP Examples Comprehensive API examples in PHP by the PagerDuty support team. v1 & v2
PagerDutyWebhookToEmail.php PHP examples for parsing webhooks. Webhooks
Embeddable On-Call Widget Code to display an iframe with who's on call and their contact information. Live demo v1
On-Call Example Minimal example to display who is on call using PDJS. v1
Ruby/HTTParty Minimal example of using our REST API with the Ruby gem HTTParty. v2
pagerduty-angular An AngularJS script for filtering and modifying PagerDuty incidents. v2
Bloombuzz A winner of the Hack the North hackathon in Waterloo, alerts on Bloomberg stock movements in Python. Events
Twilio and PagerDuty A step by step tutorial to set up a phone number, via Twilio that when called will set off a PagerDuty event. Events
node-pagerduty A node.js client for PagerDuty. Events
PagerDuty Webscripts Like Zapier for coders. Make conference calls, set up heartbeat monitoring, ping HipChat, and more. v2
Off-Call - PagerDuty Utilities Generate report of PagerDuty activity for a specific time range. v2
pagerduty-alert-volume A quick command-line to get the incident volume assigned to an escalation policy broken down by week. v2
pagerduty_oncall How to determine who is on-call using Ruby and the PagerDuty API. For IRC. v2
resque-pagerduty A Resque failure backend for triggering incidents in Pagerduty. Events
Time On-Call How much time am I on call? v2
pagerdutysays PagerDutySays catches a PagerDuty webhook (triggered incident) and sends the event description to a Text To Speech Program. Webhooks
Grappling Grappling is a hacky domain specific language for working with PagerDuty's webhooks. Webhooks
jira-pagerduty-escalation_scripts 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 Incidents with Body Get details about a specific incident or range of incidents including the incident body. v2
PagerDuty On-call Slack Bot Use slash commands in Slack to find out who is on-call. v2

Please review the Disclaimer prior to downloading sample code.

What are you building?

Have you made a library or tool that we should know about? Let us know here!

Have more questions? Submit a request