PagerDuty Integration
Prerequisites
| Requirement | Details |
|---|---|
| PagerDuty account | Admin role to generate API keys and create integrations |
| PagerDuty plan | Professional or Enterprise (Events API v2 required) |
| StackFlow role | super_admin or itsm_manager |
Step 1: Generate PagerDuty API Key
- Log into PagerDuty and go to Integrations → API Access Keys
- Click Create New API Key
- Name it StackFlow Integration and select Read/Write
- Copy the generated API key — it is shown only once
API Key Security: StackFlow stores this key in AWS Secrets Manager (
stackflow/integrations/pagerduty/api-key) encrypted with KMS CMK mrk-bd842691514c4d74a02992b8dc11fe16. Never paste it into plain text files or chat.
Step 2: Create a Service Integration
- In PagerDuty, go to Services → Service Directory → [your service] → Integrations → Add Integration
- Search for Events API v2 and add it
- Copy the Integration Key (routing key) for this service
- Repeat for each PagerDuty service you want to map to StackFlow assignment groups
Step 3: Configure Service Mapping
Map PagerDuty services to StackFlow assignment groups so incidents route correctly:
{
"service_mapping": [
{
"pagerduty_service_id": "P1234AB",
"pagerduty_service_name": "Production API",
"stackflow_assignment_group": "Platform Engineering",
"stackflow_category": "api",
"integration_key": "abc123def456..."
},
{
"pagerduty_service_id": "P5678CD",
"pagerduty_service_name": "Database Service",
"stackflow_assignment_group": "Database Reliability",
"stackflow_category": "database",
"integration_key": "xyz789..."
}
]
}
Step 4: Connect in StackFlow
- Navigate to Admin → Integration Hub → PagerDuty → Configure
- Paste your PagerDuty API Key
- Enter your PagerDuty subdomain (e.g.,
your-orgfromyour-org.pagerduty.com) - Configure the service mapping table
- Enable Bidirectional Sync and enter the StackFlow webhook URL as a PagerDuty webhook extension
- Click Save & Test
Bidirectional Sync
With bidirectional sync enabled, incidents created in StackFlow automatically trigger PagerDuty alerts, and PagerDuty incidents create StackFlow records. State changes sync in both directions:
| StackFlow Event | PagerDuty Action |
|---|---|
| Incident created (P1/P2) | Trigger alert via Events API v2 |
| Incident resolved | Resolve PagerDuty incident |
| Incident assigned | Acknowledge PagerDuty incident |
| PagerDuty alert triggered | Create StackFlow incident |
| PagerDuty incident acknowledged | Set StackFlow incident to in_progress |
| PagerDuty incident resolved | Set StackFlow incident to resolved |
Escalation Policy Mapping
Map PagerDuty escalation policies to StackFlow SLA breach escalation rules. When a StackFlow SLA is breached at 100%, the integration can trigger the associated PagerDuty escalation policy.
{
"escalation_mapping": [
{
"stackflow_sla_policy": "P1-Response-SLA",
"pagerduty_escalation_policy_id": "PXXXXXX",
"trigger_on": "sla_breach"
}
]
}
Field Reference
| Field | Required | Description |
|---|---|---|
| API Key | Yes | PagerDuty REST API key (Read/Write) |
| Subdomain | Yes | PagerDuty subdomain (e.g., acme) |
| Service Mapping | Yes | Map PagerDuty services to StackFlow groups |
| Bidirectional Sync | No | Enable two-way incident state sync (default: true) |
| Priority Threshold | No | Minimum priority to send to PagerDuty (default: P2) |
| Auto-Acknowledge | No | Acknowledge PD incident when SF incident assigned (default: true) |
Testing the Integration
- In StackFlow, go to Admin → Integration Hub → PagerDuty → Test
- Click Send Test Event — a test alert should appear in PagerDuty
- Acknowledge the PagerDuty incident and verify the StackFlow incident state changes to
in_progress - Resolve the PagerDuty incident and verify the StackFlow incident moves to
resolved
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
| Events not reaching PagerDuty | Integration key invalid | Re-copy the Integration Key from PagerDuty service → Integrations |
| 401 on API calls | API key expired or revoked | Generate a new API key in PagerDuty and update in Secrets Manager |
| Duplicate incidents | Both directions triggering simultaneously | Enable dedup key in Integration Hub settings; check webhook filter conditions |
| Wrong assignment group | Service mapping misconfigured | Review service mapping in Integration Hub; verify PagerDuty service IDs |