Schedule icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon
Labels icon

PagerDuty On-Call Shift Handover Digest

Compiles PagerDuty on-call shift incident digests and escalation metrics via REST API, delivering structured transition summaries to Slack channels.

Categories
CoreInfrastructure

This blueprint automates Site Reliability Engineering (SRE) on-call shift transitions by integrating PagerDuty with Slack. Scheduled daily at shift handover intervals (09:00 UTC), it queries the PagerDuty REST API v2 to compile unresolved incidents, escalation statuses, and urgency levels, broadcasting a concise transition brief to engineering channels before incoming on-call engineers assume primary responsibilities.

How it works

  1. Scheduled Handover Trigger: The daily_shift_handover_schedule trigger (io.kestra.plugin.core.trigger.Schedule) executes at 09:00 UTC daily to align with shift rotations.
  2. PagerDuty Incident Ingestion: The fetch_pagerduty_shift_metrics task (io.kestra.plugin.scripts.python.Script) interrogates PagerDuty /incidents, parsing active triggered and acknowledged items for the target technical service.
  3. Handover Severity Gate: The check_unresolved_incidents flowable task (io.kestra.plugin.core.flow.If) evaluates whether any open incidents require acknowledgment during the transition.
  4. Slack Handover Card Dispatch: When active incidents exist, notify_slack_shift_handover (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) delivers an incident briefing card to the on-call channel.
  5. Clean Transition Confirmation: When zero unresolved incidents exist, log_clean_shift_transition records an all-clear message.
  6. Manifest Export: The export_shift_manifest task tags the execution with searchable status labels.

Architecture diagram

flowchart TD
    A[Schedule: Daily at 09:00 UTC] --> B[fetch_pagerduty_shift_metrics: Query PagerDuty REST API]
    B --> C{Active Incidents Exist?}
    C -- Yes --> D[notify_slack_shift_handover: Slack Webhook]
    C -- No --> E[log_clean_shift_transition: Log All Clear]
    D --> F[export_shift_manifest: Execution Labels]
    E --> F

Use cases

  • Eliminate Lost Incident Transitions: Prevent critical incidents acknowledged by the outgoing on-call engineer from falling through the cracks during shift handovers.
  • Cross-Timezone Shift Synchronization: Provide global distributed engineering teams (US, EMEA, APAC) with standardized context when passing on-call responsibility.
  • Operational Fatigue Reduction: Give incoming engineers an immediate, automated summary of overnight incident volume and service stability.

Inputs

Name Type Default Description
pagerduty_service_id STRING P123ABC Target PagerDuty technical service identifier for incident digest compilation.
slack_channel STRING #oncall-shift-handover Slack channel destination for on-call transition and incident digest cards.
alert_on_unresolved_incidents BOOL true Whether to emphasize active triggered incidents requiring immediate shift transition handover.

Expected outputs

  • {{ outputs.fetch_pagerduty_shift_metrics.vars.unresolved_incident_count }}: Count of active triggered and acknowledged incidents.
  • {{ outputs.fetch_pagerduty_shift_metrics.vars.high_urgency_incident_count }}: Number of unresolved incidents marked as high urgency.
  • {{ outputs.fetch_pagerduty_shift_metrics.vars.has_unresolved_incidents }}: Boolean flag indicating if any open incidents exist.
  • {{ outputs.fetch_pagerduty_shift_metrics.outputFiles['pagerduty_handover_report.json'] }}: Structured JSON report detailing incident titles and urgency levels.

Prerequisites

  • PagerDuty technical service configured with on-call escalation policies.
  • PagerDuty REST API Token with read access to incidents and on-call schedules.
  • Slack Incoming Webhook endpoint URL.

Secrets

  • PAGERDUTY_API_TOKEN: PagerDuty REST API v2 authentication token.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL.

Quick start

  1. Configure PAGERDUTY_API_TOKEN and SLACK_WEBHOOK_URL in your Kestra namespace secrets.
  2. Import this flow YAML into your Kestra workspace.
  3. Specify your PagerDuty service identifier in pagerduty_service_id.
  4. Click Execute in the UI to perform an immediate shift handover incident digest compilation.

Common pitfalls and troubleshooting

  • API Token Scopes: Ensure the token is a General Access REST API key rather than a Personal Access Token tied to an individual user account.
  • Service ID Format: PagerDuty service IDs begin with a capital letter (e.g. PABC123) and can be retrieved from the URL of the service page in the PagerDuty web application.
  • Rate Limiting Handling: PagerDuty REST API limits standard requests to 900 requests per minute; batch service IDs if monitoring hundreds of microservices.

How to extend

  • Query PagerDuty /oncalls to dynamically mention the incoming engineer's Slack user ID (<@U12345>) in the notification payload.
  • Include incident resolution time (MTTR) metrics for the concluding 24-hour shift cycle.
  • Automatically create a handover meeting task in Notion or Jira Service Management.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.