by vend



Scrutinizer Code Quality Build Status


This is a Twilio Twimlet designed to be hosted on Heroku. It will query PagerDuty to find the currently on-call engineer and forward the inbound call to them.

It needs a few environment variables defined to work:


Those names should be fairly self-explanatory. The domain is the piece of your PagerDuty URL that is specific to you i.e. https://[PAGERDUTY_DOMAIN]

You can also optionally set PHONEDUTY_ANNOUNCE_TIME, which if set to a TRUEish value will include the current time of the engineer being called as part of the answering message. This may help raise awareness that you are potentially getting somebody out of bed, so be gentle :D


  • Configure your on-call schedule in PagerDuty
  • Ensure your rostered staff have a 'phone' contact method defined
  • Note the schedule ID of the roster you wish to use.
  • Create and note an API key in PagerDuty
  • Deploy this app to Heroku.
  • Configure the relevant environment variables above in Heroku
  • Buy a phone number from Twilio
  • Add the generated Heroku URL as a "Request URL" for the Voice property of this Twilio number
  • Call the external Twilio number. You should get a voice prompt telling you who is on call, what time it is in their timezone currently, and then you will get connected to the rostered engineer.

Relevant Reading


Twilio TwiML reference

Some sample Twimlets:


PagerDuty API


Setting up and deploying PHP apps on Heroku