Inspiration

We live in Slack and we rely on PagerDuty to run our support. PagerDuty already has great Slack integration for receiving alerts and resolving them. However we often want to know who is the person rostered on for support right now when we need help, or who will be rostered on for support for a future event. So we built this Slack integration.

What it does

For the simplest use case, it will list which people are on call in PagerDuty right now for each escalation policy and level, along with the time that their shift will end, expressed in the time zone of the Slack user who requested the information.

It can also list the people on call for a given date and time in the future.

How I built it

It is simply node.js using the request node module to call the PagerDuty API and moment-timezone to translate schedules for the Slack user's timezone. serverless is used to deploy the code to AWS Lambda.

Challenges I ran into

Using AWS KMS to decrypt API tokens when the Lambda function first starts is often too slow for the Slack 3-second timeout.

Accomplishments that I'm proud of

It works!

What I learned

To use Slack delayed responses and perform tasks that take longer than 3-seconds involves calling another Lambda function to perform the extra work so the first function call can return within the limit.

What's next for PagerDuty OnCall Slack bot

Allowing users to request the PagerDuty schedule for only specific escalation policies or levels.

Built With

Share this project:

Updates