Webhooks
Overview
StackFlow supports both inbound webhooks (receiving alerts and events from external systems) and outbound webhooks (notifying external systems of StackFlow events). All webhook payloads are JSON. Outbound webhooks are signed with HMAC-SHA256 using a shared secret stored in AWS Secrets Manager.
Inbound Webhooks
Inbound webhooks allow external systems (monitoring tools, CI/CD pipelines, cloud providers) to push events into StackFlow. Each inbound webhook is assigned a unique URL and an optional secret for signature verification.
# Create an inbound webhook endpoint
curl -X POST https://your-instance.stackflow-tech.com/prod/api/webhooks/inbound -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{
"name": "Datadog Alerts",
"description": "Receive Datadog monitor alerts and create incidents",
"action": "create_incident",
"field_mapping": {
"short_description": "{{alert.title}}",
"priority": "{{priority_map[alert.priority]}}",
"category": "monitoring"
},
"filters": [
{"field": "alert.status", "operator": "eq", "value": "triggered"}
],
"secret_enabled": true
}'
{
"id": "wh_in_abc123",
"url": "https://your-instance.stackflow-tech.com/prod/api/webhooks/inbound/wh_in_abc123",
"secret": "whsec_XXXXXXXXXXXXXXXX",
"name": "Datadog Alerts",
"action": "create_incident",
"created_at": "2026-05-19T15:00:00Z"
}
mrk-bd842691514c4d74a02992b8dc11fe16 and cannot be retrieved after creation.
Outbound Webhooks
Outbound webhooks fire when StackFlow events occur and POST to external URLs. Configure them in Admin → Integrations → Outbound Webhooks or via the API.
# Create an outbound webhook
curl -X POST https://your-instance.stackflow-tech.com/prod/api/webhooks/outbound -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{
"name": "Notify PagerDuty on P1 Incident",
"url": "https://events.pagerduty.com/v2/enqueue",
"events": ["incident.created", "incident.priority_changed"],
"filters": [{"field": "incident.priority", "operator": "eq", "value": "P1"}],
"headers": {"Content-Type": "application/json"},
"sign_payloads": true,
"active": true
}'
Outbound webhook payload shape:
{
"event": "incident.created",
"timestamp": "2026-05-19T15:05:00Z",
"stackflow_instance": "your-instance",
"data": {
"id": "INC0001235",
"short_description": "API gateway 502 errors spike",
"priority": "P1",
"state": "new",
"url": "https://your-instance.stackflow-tech.com/incidents/INC0001235"
}
}
Payload Signing & Verification
When sign_payloads: true, StackFlow adds an X-StackFlow-Signature header to every outbound request. Verify it on the receiving end:
import hmac
import hashlib
def verify_webhook(payload_bytes: bytes, signature_header: str, secret: str) -> bool:
expected = hmac.new(
secret.encode(),
payload_bytes,
hashlib.sha256
).hexdigest()
actual = signature_header.replace("sha256=", "")
return hmac.compare_digest(expected, actual)
# Usage
is_valid = verify_webhook(
request.body,
request.headers["X-StackFlow-Signature"],
"your_webhook_secret"
)
Retry Logic
Outbound webhooks are delivered with exponential backoff retry logic. Failed deliveries (non-2xx response or timeout) are retried up to 5 times:
| Attempt | Delay | Total Wait |
|---|---|---|
| 1 (initial) | — | 0s |
| 2 | 30s | 30s |
| 3 | 2 min | 2m 30s |
| 4 | 10 min | 12m 30s |
| 5 | 30 min | 42m 30s |
After 5 failures, the webhook delivery is marked as failed and an alert is sent to the webhook owner. Failed deliveries can be replayed from the webhook dashboard.
Webhook Event Types
| Event | Trigger |
|---|---|
incident.created | New incident created |
incident.updated | Any incident field changes |
incident.resolved | Incident state changed to resolved |
incident.priority_changed | Priority level changed |
change.submitted | Change request submitted for review |
change.approved | Change approved by CAB |
change.rejected | Change rejected by CAB |
request.submitted | Service request submitted |
request.approved | Service request approved |
sla.breach_warning | SLA at 75% of breach threshold |
sla.breached | SLA breached |
ci.discovered | New CI found during discovery |
Field Reference
| Field | Type | Description |
|---|---|---|
url | string | Target URL for outbound webhook (HTTPS required) |
events | array | List of event types to subscribe to |
filters | array | Conditional filters on event payload fields |
sign_payloads | boolean | Add HMAC-SHA256 signature header |
active | boolean | Enable/disable webhook without deleting |
timeout_seconds | integer | Request timeout (default 10, max 30) |