Skip to content
  • There are no suggestions because the search field is empty.

Workflows, Outbound Integrations and Maintenance Windows with the AlertOps SDKs

Build AlertOps workflows that react to alerts, connect outbound integrations to your ticketing and chat tools, and schedule maintenance windows from code with the AlertOps SDKs.

Overview

Relevant for Developers automating what happens after an alert arrives

Workflows are rules that react to alerts, messages and notification deliveries: when their conditions match, they run actions such as changing priority, updating status, sending a message or calling a webhook. Outbound integrations define the calls AlertOps makes to your other systems, and maintenance windows quiet alerts from chosen integrations during planned work. The AlertOps SDKs let you manage all three as code.

Key benefits:

  • One-call workflow build — workflows.build creates a workflow with its conditions and actions, and can enable it.
  • Name-based lookups — catalog helpers turn condition and action names into the ids AlertOps uses.
  • Safe outbound edits — outbound.update_settings changes names or credentials and keeps every method.
  • Simple scheduling — maintenance_windows.schedule builds a window from start and end date-times.

Build a workflow

Relevant for Developers creating automation rules

Workflow typeFires onTypical actions
AlertAlerts of the escalation policies it is attached toUpdate Priority, Update Status, SendMessage, Send Webhook
MessageAlert messagesCancelDeliveries
NotificationNotification deliveriesCancelUserDeliveries

Each workflow has start conditions, such as "alert status is On Hold", and actions. Recurring workflows run again on an interval until a stop condition matches, for example "lower the priority every hour until the alert closes".

Example: lower the priority when an alert is put on hold

This builds and enables an Alert workflow with the escalation policy's alert type, then attaches it to the policy.

Python

ep = ao.escalation_policies.get_basic(ep_id)
wf = ao.workflows.build("Hold to Low priority", "Alert", alert_type=ep["alert_type_id"], enabled=True,
conditions=[{"name": "AlertStatus", "operator": "is", "value": "On Hold"}],
actions=[{"name": "Update Priority", "value": "Low"}])
ao.escalation_policies.workflows.add(ep_id, [{"workflow_id": wf["workflow_id"]}])

TypeScript

const ep = await ao.escalationPolicies.getBasic(epId);
const wf = await ao.workflows.build("Hold to Low priority", "Alert", {
alert_type: ep.alert_type_id, enabled: true,
conditions: [{ name: "AlertStatus", operator: "is", value: "On Hold" }],
actions: [{ name: "Update Priority", value: "Low" }],
});
await ao.escalationPolicies.workflows.add(epId, [{ workflow_id: wf.workflow_id }]);

Go

ep, err := ao.EscalationPolicies.GetBasic(ctx, epID, nil)
if err != nil {
return err
}
wf, err := ao.Workflows.Build(ctx, "Hold to Low priority", "Alert", alertops.M{
"alert_type": alertops.Get(ep, "alert_type_id"), "enabled": true,
"conditions": []any{alertops.M{"name": "AlertStatus", "operator": "is", "value": "On Hold"}},
"actions": []any{alertops.M{"name": "Update Priority", "value": "Low"}},
})
if err != nil {
return err
}
_, err = ao.EscalationPolicies.Workflows.Add(ctx, epID,
&alertops.Request{Body: []any{alertops.M{"workflow_id": alertops.Get(wf, "workflow_id")}}})

Java

JsonNode ep = ao.escalationPolicies().getBasic(epId);
JsonNode wf = ao.workflows().build("Hold to Low priority", "Alert", Map.of(
"alert_type", ep.get("alert_type_id"), "enabled", true,
"conditions", List.of(Map.of("name", "AlertStatus", "operator", "is", "value", "On Hold")),
"actions", List.of(Map.of("name", "Update Priority", "value", "Low"))));
ao.escalationPolicies().workflows().add(epId, List.of(Map.of("workflow_id", wf.get("workflow_id"))));

.NET

var ep = await ao.EscalationPolicies.GetBasicAsync(epId);
var wf = await ao.Workflows.BuildAsync("Hold to Low priority", "Alert", new Kwargs
{
["alert_type"] = ep?["alert_type_id"], ["enabled"] = true,
["conditions"] = new JsonArray(new JsonObject { ["name"] = "AlertStatus", ["operator"] = "is", ["value"] = "On Hold" }),
["actions"] = new JsonArray(new JsonObject { ["name"] = "Update Priority", ["value"] = "Low" }),
});
await ao.EscalationPolicies.Workflows.AddAsync(epId,
Kwargs.Body(new JsonArray(new JsonObject { ["workflow_id"] = wf?["workflow_id"]?.DeepClone() })));

When an alert of that policy is put On Hold, its priority changes to Low within seconds.

The workflow builder showing an SDK-built workflow

Figure 1. The "Hold to Low priority" workflow built with workflows.build, in the workflow builder: one Match All condition (Alert Status is On Hold) and one action (Update Priority to Low).

Use workflows.catalog to look up the available conditions, actions and values, escalation_policies.workflows.available to list the workflows you can attach to a policy, and workflows.usage to see where a workflow is used.

Outbound integrations

Relevant for Developers connecting AlertOps to ticketing, chat and other systems

An outbound integration holds the connection and security settings and one or more methods, such as a REST call that opens a ticket. Workflows and escalation policies use those methods to call out.

TaskOperation
Create an outbound integrationoutbound.create
Add a REST/JSON methodoutbound.methods.add_rest
Rename it or change credentialsoutbound.update_settings
Clone or update a methodoutbound.methods.clone, outbound.methods.update
See where it is usedoutbound.usage

Maintenance windows

Relevant for On-call admins quieting alerts during planned work

A maintenance window suppresses alerts from the inbound integrations it lists, once or on a daily, weekly or monthly schedule. maintenance_windows.schedule(description, integration_ids, start, end) creates a window from date-times in your account's time zone; pass recurrence and days for a repeating window, such as weekly Thursday deploys.

TaskOperation
Schedule a windowmaintenance_windows.schedule
List current, planned or past windowsmaintenance_windows.list
Find a window by descriptionmaintenance_windows.find
Change or remove a windowmaintenance_windows.update, maintenance_windows.delete

Best Practices

Relevant for Teams automating incident response

  • Use the policy's alert type when you build Alert workflows, as in the example above.
  • Name workflows by what they do, such as "Hold to Low priority", so they are easy to find in the app.
  • Schedule maintenance in advance so planned work never pages anyone.

Related Articles

Need help?

Email support@alertops.com or contact your AlertOps representative.