Escalation policies
An EscalationPolicy decides who is
notified about an incident, in what order, and how long Better Stack waits
between steps. Monitors, heartbeats and incoming integrations use a policy
through their escalationPolicyId.
Escalation policies need a paid plan: on a plan without them every create fails
with a typed Forbidden. The live test is gated for that reason; see
Compatibility.
- checkoutescalates via →on-call
- on-callsteps page →Primary on-call
Page the on-call person, then the team
Section titled “Page the on-call person, then the team”steps is an ordered list. An escalation step notifies its stepMembers
with the alert channels of its severity, after
waitBefore seconds:
const schedule = yield* BetterStack.Incidents.OnCallSchedule("primary", { name: "Primary on-call",});const high = yield* BetterStack.Incidents.Severity("high", { name: "High", call: true, push: true,});const onCall = yield* BetterStack.Incidents.EscalationPolicy("on-call", { name: "On-call, then the whole team", repeatCount: 3, repeatDelay: 300, steps: [ { type: "escalation", waitBefore: 0, severityId: high.id, stepMembers: [{ type: "current_on_call", id: schedule.id }], }, { type: "escalation", waitBefore: 600, severityId: high.id, stepMembers: [{ type: "entire_team" }], }, ],});A step member is current_on_call (with an on-call schedule’s id),
entire_team, a user, another policy, or an integration. Other step types
act only in a time window (time_branching), only for matching incident
metadata (metadata_branching), post a note into the incident timeline
(instructions), or resolve, remove or hand over the incident
(resolve_remove).
Attach a policy to what you monitor
Section titled “Attach a policy to what you monitor”yield* BetterStack.Incidents.Monitor("checkout", { url: "https://checkout.example.com/health", monitorType: "status", escalationPolicyId: onCall.id,});Group policies
Section titled “Group policies”An EscalationPolicyGroup keeps
related policies together:
const payments = yield* BetterStack.Incidents.EscalationPolicyGroup("payments", { name: "Payments",});yield* BetterStack.Incidents.EscalationPolicy("payments-on-call", { name: "Payments on-call", escalationPolicyGroupId: payments.id, steps: [{ type: "escalation", waitBefore: 0, stepMembers: [{ type: "current_on_call" }] }],});Updates and deletes
Section titled “Updates and deletes”Every prop updates in place; teamId replaces the policy. steps sent on
update replaces every step, and removing steps from the config keeps the
current ones. A severity a step uses can’t be deleted while the step uses it,
so Alchemy deletes the policy first when it references severity.id.
Where next
Section titled “Where next”- On-call schedules: who
current_on_callpages. - Severities & metadata: how each step alerts people.
- Reference:
EscalationPolicy,EscalationPolicyGroup. - Better Stack: Escalation policies (API).