Who is on-call? PagerDuty on-call schedule on Slack

Oguzhan
2 min readJan 24, 2023

--

PagerDuty and Slack on-call schedule informer

On-call needs more responsibility. Also, On-call is a little bit tedious, anyway, now we talk about the on-call timetables on slack. this case is essential for developers. In this case, there are many ways possible for an on-call schedule on Slack, but someways need more configuration or someways need more protection, et cetera.

I shared my source code of the on-call informer on slack. Also, I experienced golang.

How to work?

When you create this slash command, you can see your slack’ slash command list /oncall .

slack slash command

and \oncall command return current on-call shift information like this,

slack slash command response

Installation

First, you need a PagerDuty API token. You can find this argument in main.go variables block.

var (
apiKey = kmsDecrypt(os.Getenv("apikey"))
...
)

and also apikey must be encrypted via KMS service, it is an optional but recommended way. Sensitive values should be encrypted.

      Environment:
Variables:
apikey: KMSENCRYPTEDAPIKEY
pd_schedule_id: PZXYWD #you can find this on your pagerduty schedule page

On the slack side, first, create a slash command.

slack api setup for slash command

Then, create a slash command like this,

slack slash command setup

When you create an on-call application via AWS SAM, you have an API endpoint, and you can put this endpoint on your slash command request path.

Also, you can find your pagerduty API key on your Pagerduty account’s Developer Tools.

pagerduty api key

--

--

Oguzhan

Solutions Architect, #AWS, food, chess, books and cheese lover. Philosophy 101.