Incidents.EscalationPolicy
A Better Stack escalation policy: decides who is notified about an
incident, in what order, and how long to wait between steps. Monitors and
heartbeats use it through their escalationPolicyId.
steps is an ordered list. escalation steps notify stepMembers
(current_on_call with an OnCallSchedule id, entire_team, a
user, another policy, or integrations) with the alert channels of their
Severity; time_branching and metadata_branching steps act only
in a time window or for matching incident metadata; instructions posts a
note into the incident timeline; resolve_remove resolves or removes the
incident, or hands it to another policy (actionType: "escalate_to_policy"
with escalationPolicyId).
Every prop updates in place; teamId replaces the policy. name defaults
to a generated unique name. steps sent on update replaces every step;
removing steps from the config keeps the current ones. Removing
escalationPolicyGroupId or fallbackEscalationPolicyId clears it.
Escalation policies need a paid plan: on a plan without them every create
fails with a typed Forbidden (“Cannot create escalation policy. Please
upgrade your account to use escalation policies.”).
Paging the on-call schedule
Section titled “Paging the on-call schedule”The on-call person first, the whole team after 10 minutes
const schedule = yield* BetterStack.Incidents.OnCallSchedule("primary", { name: "Primary on-call",});const high = yield* BetterStack.Incidents.Severity("high", { name: "High", call: true, push: true });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" }], }, ],});Handing over to another policy
Section titled “Handing over to another policy”Post instructions, then escalate to the platform policy
const platform = yield* BetterStack.Incidents.EscalationPolicy("platform", { name: "Platform on-call", steps: [{ type: "escalation", waitBefore: 0, stepMembers: [{ type: "current_on_call" }] }],});yield* BetterStack.Incidents.EscalationPolicy("checkout", { name: "Checkout", fallbackEscalationPolicyId: platform.id, steps: [ { type: "instructions", waitBefore: 0, instructionsComment: "Check the payments dashboard." }, { type: "resolve_remove", waitBefore: 300, actionType: "escalate_to_policy", escalationPolicyId: platform.id, }, ],});escalationPolicyGroupId string | null
The ID of the escalation policy group this policy is in, or null when it's in none. Send null to remove it from its group.
fallbackEscalationPolicyId string | null
Escalation policy to escalate to after these steps and repeats run out. Must belong to the same organization.
name string
Policy name. Defaults to a unique name generated from the stack, stage and logical id.
repeatCount number
How many times the whole policy repeats if nobody acknowledges the incident.
repeatDelay number
Seconds until the steps repeat.
steps CreateEscalationPolicyRequestStepsItem[]
Ordered escalation steps. An update with steps replaces the whole list. An empty list makes a silent policy that only collects incidents. Every step has a type, a wait set by wait_before or by wait_until_time and wait_until_timezone, and the keys its type uses.
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.
Attributes
Section titled “Attributes”id string always set
The escalation_policy's id.
escalationPolicyGroupId string | null
The ID of the escalation policy group this policy is in, or null when it's in none.
fallbackEscalationPolicyId string | null
Escalation policy to escalate to after these steps and repeats run out. Must belong to the same organization.
incidentToken string | Redacted<string>
The secret token in the link to the policy's incident report form, used to open incidents on this policy.
name string
Policy name.
repeatCount number
How many times the whole policy repeats if nobody acknowledges the incident.
repeatDelay number
Seconds until the steps repeat.
steps EscalationPolicyStepsItem[]
Ordered escalation steps. An update with steps replaces the whole list. An empty list makes a silent policy that only collects incidents. Every step has a type, a wait set by wait_before or by wait_until_time and wait_until_timezone, and the keys its type uses.
teamId string
Team that owns this policy, such as t123.
teamName string
Name of the team that owns this policy.
Lookup
Section titled “Lookup”EscalationPolicy.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.