Webhook map
incidentsacknowledged(incidents.acknowledged)assigned(incidents.assigned)resolved(incidents.resolved)triggered(incidents.triggered)
HTTP handler setup
app/api/webhook/route.ts
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";
export async function POST(request: Request) {
const headers = Object.fromEntries(request.headers);
// With multiTenancy, give each tenant its own URL (/api/webhook?tenantId=acme):
// the query says whose account, secret and hooks handle the delivery.
const query = Object.fromEntries(new URL(request.url).searchParams);
// The raw text, not request.json(): signatures are checked over the exact bytes sent.
const body = await request.text();
const result = await processWebhook(corsair, headers, body, query);
if (!result.plugin) {
return Response.json({ success: false }, { status: 404 });
}
// A refusal (bad signature) carries no status and answers 400; a handler
// that threw comes back with 500, so the sender retries it.
const status =
result.response?.success === false ? (result.response.statusCode ?? 400) : 200;
return Response.json(result.response ?? { success: true }, {
status,
headers: result.responseHeaders,
});
}
Events
Incidents
Acknowledged
incidents.acknowledged
An incident was acknowledged
Payload
| Name | Type | Required | Description |
|---|---|---|---|
event | object | Yes | — |
event full type
event full type
{
id: string,
event_type: incident.triggered,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.acknowledged,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.resolved,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.assigned,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: string,
resource_type: string,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: Record<string, any>
}
Response data full type
Response data full type
{
id: string,
event_type: incident.acknowledged,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
}
webhookHooks example
pagerduty({
webhookHooks: {
incidents: {
acknowledged: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})
Assigned
incidents.assigned
An incident was assigned to a user or escalation policy
Payload
| Name | Type | Required | Description |
|---|---|---|---|
event | object | Yes | — |
event full type
event full type
{
id: string,
event_type: incident.triggered,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.acknowledged,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.resolved,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.assigned,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: string,
resource_type: string,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: Record<string, any>
}
Response data full type
Response data full type
{
id: string,
event_type: incident.assigned,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
}
webhookHooks example
pagerduty({
webhookHooks: {
incidents: {
assigned: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})
Resolved
incidents.resolved
An incident was resolved
Payload
| Name | Type | Required | Description |
|---|---|---|---|
event | object | Yes | — |
event full type
event full type
{
id: string,
event_type: incident.triggered,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.acknowledged,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.resolved,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.assigned,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: string,
resource_type: string,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: Record<string, any>
}
Response data full type
Response data full type
{
id: string,
event_type: incident.resolved,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
}
webhookHooks example
pagerduty({
webhookHooks: {
incidents: {
resolved: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})
Triggered
incidents.triggered
An incident was triggered (created)
Payload
| Name | Type | Required | Description |
|---|---|---|---|
event | object | Yes | — |
event full type
event full type
{
id: string,
event_type: incident.triggered,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.acknowledged,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.resolved,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: incident.assigned,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
} | {
id: string,
event_type: string,
resource_type: string,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: Record<string, any>
}
Response data full type
Response data full type
{
id: string,
event_type: incident.triggered,
resource_type: incident,
occurred_at: string,
agent?: {
id?: string,
type?: string,
summary?: string,
html_url?: string | null
},
client?: {
name?: string
} | null,
data: {
id: string,
type: incident,
incident_number?: number,
title?: string,
status?: triggered | acknowledged | resolved,
urgency?: high | low,
html_url?: string,
created_at?: string,
updated_at?: string,
resolved_at?: string | null,
service?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
escalation_policy?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
},
teams?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[],
assignees?: {
id: string,
type: string,
summary?: string,
html_url?: string | null
}[]
}
}
webhookHooks example
pagerduty({
webhookHooks: {
incidents: {
triggered: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})