Incidents.IncomingWebhookIntegration
A webhook URL that opens incidents from the requests it receives. Better
Stack gives you a url (a secret, Redacted): point any tool that can
send an HTTP request at it. Fields you set pick values such as the cause
and title out of each request (causeField, titleField,
otherStartedFields, …), and rules decide whether a request opens
(startedRuleType + startedRules), acknowledges or resolves an incident.
Acknowledging and resolving by rule need alert id fields
(startedAlertIdField plus acknowledgedAlertIdField /
resolvedAlertIdField) so a later request finds its incident.
Every prop updates in place except teamId, which replaces the
integration (and gives it a new url). name defaults to a generated
unique name. Removing escalationPolicyId, teamWait, causeField,
titleField, an alert id field or an other*Fields list clears it;
removing the rule lists or metadata keeps what the integration has
(send [] / {} to clear them).
The API adds createdAt/updatedAt to every rule and returns every
member of a field (unset ones null, plus its role in specialType);
the attributes drop those, so they read like the props and an update
sends only what changed.
Opening and resolving incidents from a JSON payload
Section titled “Opening and resolving incidents from a JSON payload”status: "firing" opens, status: "resolved" resolves
const alertId: AlertField = { fieldTarget: "json", targetField: "alert.id", matchType: "match_everything" };const hook = yield* BetterStack.Incidents.IncomingWebhookIntegration("alerts", { name: "Alerts from CI", startedRuleType: "any", startedRules: [{ ruleTarget: "json", targetField: "status", matchType: "equals", content: "firing" }], resolvedRuleType: "any", resolvedRules: [{ ruleTarget: "json", targetField: "status", matchType: "equals", content: "resolved" }], startedAlertIdField: alertId, resolvedAlertIdField: alertId, causeField: { fieldTarget: "json", targetField: "message", matchType: "match_everything" }, titleField: { fieldTarget: "json", targetField: "title", matchType: "match_everything" },});Sending to the URL
Section titled “Sending to the URL”The request a CI job sends
const request = (url: string) => new Request(url, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ status: "firing", alert: { id: "deploy-42" }, title: "Deploy failed", message: "…" }), });const firing = request(Redacted.value(webhookUrl));acknowledgedAlertIdField CreateIncidentsIncomingWebhookIntegrationRequestAcknowledgedAlertIdField | null
How to extract the alert ID from a request that acknowledges an incident, with the same keys as cause_field. Required when acknowledged_rule_type isn't unused.
acknowledgedRules CreateIncidentsIncomingWebhookIntegrationRequestAcknowledgedRulesItem[]
The conditions acknowledged_rule_type checks, with the same keys as started_rules. At least one is required when the type is any or all.
acknowledgedRuleType "any" | "all" | "unused" | string
When requests acknowledge an incident. Any value other than unused needs started_alert_id_field, acknowledged_alert_id_field and at least one rule.
call boolean
Whether to call the on-call person. Ignored while an escalation policy is set.
causeField CreateIncidentsIncomingWebhookIntegrationRequestCauseField | null
How to extract the incident cause from the request that starts an incident. When it's missing or extracts nothing, the cause is Unknown cause.
criticalAlert boolean
Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.
email boolean
Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.
escalationPolicyId string | null
ID of the escalation policy for alerts, or null to alert the current on-call person directly. Returned as a string.
metadata CreateIncidentsIncomingWebhookIntegrationRequestMetadataMap
Custom metadata. Each key holds a list of values. A value is a string, written as {type: "String", value}, or a catalog reference, written as {type, item_id, name, email}. User references are returned as u123 and team references as t123. Get a user's ID via List team members, and a team's ID via List teams. A key accepts a single value or a list. Values under one key must all be the same type and can't repeat. An update replaces all of the integration's metadata with the object, {} removes it all, and leaving metadata out keeps it.
name string
The name shown in the dashboard. Defaults to a unique name generated from the stack, stage and logical id.
otherAcknowledgedFields CreateIncidentsIncomingWebhookIntegrationRequestOtherAcknowledgedFieldsItem[] | null
Custom fields extracted from a request that acknowledges an incident.
otherResolvedFields CreateIncidentsIncomingWebhookIntegrationRequestOtherResolvedFieldsItem[] | null
Custom fields extracted from a request that resolves an incident.
otherStartedFields CreateIncidentsIncomingWebhookIntegrationRequestOtherStartedFieldsItem[] | null
Custom fields extracted from the request that opens an incident, saved as incident metadata.
paused boolean
Whether the integration is paused. A paused integration opens no incidents.
push boolean
Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.
recoveryPeriod 0 | 60 | 180 | 300 | 900 | 1800 | 3600 | 7200 | number
How long to wait after a resolving request before the incident resolves, in seconds. A new alert during the wait keeps the incident open. Applies only while resolved_rule_type isn't unused.
resolvedAlertIdField CreateIncidentsIncomingWebhookIntegrationRequestResolvedAlertIdField | null
How to extract the alert ID from a request that resolves an incident, with the same keys as cause_field. Required when resolved_rule_type isn't unused.
resolvedRules CreateIncidentsIncomingWebhookIntegrationRequestResolvedRulesItem[]
The conditions resolved_rule_type checks, with the same keys as started_rules. At least one is required when the type is any or all.
resolvedRuleType "any" | "all" | "unused" | string
When requests resolve an incident. Any value other than unused needs started_alert_id_field, resolved_alert_id_field and at least one rule. Each request is checked against the resolve rules first, then the acknowledge rules, then the open rules. A request that matches no open incident can still open one.
sms boolean
Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.
startedAlertIdField CreateIncidentsIncomingWebhookIntegrationRequestStartedAlertIdField | null
How to extract the alert ID from the request that starts an incident, with the same keys as cause_field. Later requests acknowledge or resolve the open incident with the same alert ID. Required when acknowledged_rule_type or resolved_rule_type isn't unused.
startedRules CreateIncidentsIncomingWebhookIntegrationRequestStartedRulesItem[]
The conditions started_rule_type checks. At least one rule is required when the type is any or all.
startedRuleType "any" | "all" | "unused" | string
When requests open an incident. Every value other than unused needs at least one rule. When started_alert_id_field finds an alert ID that matches an open incident, the request goes to that incident instead of opening a new one.
teamId string
Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.
teamWait number | null
Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.
titleField CreateIncidentsIncomingWebhookIntegrationRequestTitleField | null
Field that extracts the incident title, with the same keys as cause_field.
Attributes
Section titled “Attributes”id string always set
The incidents_incoming_webhook_integration's id.
acknowledgedAlertIdField IncidentsIncomingWebhookIntegrationAcknowledgedAlertIdField | null
How to extract the alert ID from a request that acknowledges an incident, with the same keys as cause_field. Required when acknowledged_rule_type isn't unused.
acknowledgedRules IncidentsIncomingWebhookIntegrationAcknowledgedRulesItem[]
The conditions acknowledged_rule_type checks, with the same keys as started_rules. At least one is required when the type is any or all.
acknowledgedRuleType "any" | "all" | "unused"
When requests acknowledge an incident. Any value other than unused needs started_alert_id_field, acknowledged_alert_id_field and at least one rule.
call boolean
Whether to call the on-call person. Ignored while an escalation policy is set.
causeField IncidentsIncomingWebhookIntegrationCauseField | null
How to extract the incident cause from the request that starts an incident. When it's missing or extracts nothing, the cause is Unknown cause.
createdAt string
When the integration was created.
criticalAlert boolean
Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.
email boolean
Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.
escalationPolicyId string | null
ID of the escalation policy for alerts, or null to alert the current on-call person directly. Returned as a string.
metadata IncidentsIncomingWebhookIntegrationMetadataMap
Custom metadata. Each key holds a list of values. A value is a string, written as {type: "String", value}, or a catalog reference, written as {type, item_id, name, email}. User references are returned as u123 and team references as t123. Get a user's ID via List team members, and a team's ID via List teams. A key accepts a single value or a list. Values under one key must all be the same type and can't repeat.
name string | null
The name of the incoming webhook shown in the dashboard.
otherAcknowledgedFields IncidentsIncomingWebhookIntegrationOtherAcknowledgedFieldsItem[] | null
Custom fields extracted from a request that acknowledges an incident.
otherResolvedFields IncidentsIncomingWebhookIntegrationOtherResolvedFieldsItem[] | null
Custom fields extracted from a request that resolves an incident.
otherStartedFields IncidentsIncomingWebhookIntegrationOtherStartedFieldsItem[] | null
Custom fields extracted from the request that opens an incident, saved as incident metadata.
paused boolean
Whether the integration is paused. A paused integration opens no incidents.
push boolean
Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.
recoveryPeriod 0 | 60 | 180 | 300 | 900 | 1800 | 3600 | 7200
How long to wait after a resolving request before the incident resolves, in seconds. A new alert during the wait keeps the incident open. Applies only while resolved_rule_type isn't unused.
resolvedAlertIdField IncidentsIncomingWebhookIntegrationResolvedAlertIdField | null
How to extract the alert ID from a request that resolves an incident, with the same keys as cause_field. Required when resolved_rule_type isn't unused.
resolvedRules IncidentsIncomingWebhookIntegrationResolvedRulesItem[]
The conditions resolved_rule_type checks, with the same keys as started_rules. At least one is required when the type is any or all.
resolvedRuleType "any" | "all" | "unused"
When requests resolve an incident. Any value other than unused needs started_alert_id_field, resolved_alert_id_field and at least one rule. Each request is checked against the resolve rules first, then the acknowledge rules, then the open rules. A request that matches no open incident can still open one.
sampleBody string | null
The body of the sample request saved in the dashboard to preview extraction.
sampleHeaders string | null
The headers of the sample request saved in the dashboard to preview extraction.
sampleQueryString string | null
The query string of the sample request saved in the dashboard to preview extraction.
sms boolean
Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.
startedAlertIdField IncidentsIncomingWebhookIntegrationStartedAlertIdField | null
How to extract the alert ID from the request that starts an incident, with the same keys as cause_field. Later requests acknowledge or resolve the open incident with the same alert ID. Required when acknowledged_rule_type or resolved_rule_type isn't unused.
startedRules IncidentsIncomingWebhookIntegrationStartedRulesItem[]
The conditions started_rule_type checks. At least one rule is required when the type is any or all.
startedRuleType "any" | "all" | "unused"
When requests open an incident. Every value other than unused needs at least one rule. When started_alert_id_field finds an alert ID that matches an open incident, the request goes to that incident instead of opening a new one.
teamId string
Team that owns this integration, such as t123.
teamName string
Name of the team that owns this integration.
teamWait number | null
Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.
titleField IncidentsIncomingWebhookIntegrationTitleField | null
Field that extracts the incident title, with the same keys as cause_field.
updatedAt string
When the integration was last updated.
url string | Redacted<string>
The URL that receives your webhooks.
Lookup
Section titled “Lookup”IncomingWebhookIntegration.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.
teamId string
Team that owns it, such as t123. Defaults to the credentials' team.