Skip to main content

Plans and notification groups

This page shows how to change existing plans and notification groups with the API. To run the examples, use the Playground or send them as described in Usage. Replace the <...> placeholders with your own IDs.

How update mutations work​

The updatePlan and updateNotificationGroup mutations normally change only what you send:

  • Fields you leave out stay unchanged.
  • Lists of nested items (plan actions, batches, notification configurations, channels):
    • an item without id is added;
    • an item with id updates that existing item.
  • Lists ending with ToDelete (for example planActionsToDelete) remove the items with the given IDs.
  • Some fields replace everything that was there before: metadata, scheduleExecutionDates and inputParameters. Always send the full list.

There are a few exceptions, described in the sections below:

  • Changing executionPolicy to ANYWAY or SUCCESS_OR_APPROVAL also sets approvalMode back to AS_SCHEDULED.
  • For a plan action or batch action notification configuration, sending a different notificationGroupId under the same id can add a new configuration instead of changing the existing one.
  • Updating a channel of a notification group requires type and all required fields in typeProperties.
caution

A plan notification configuration is not the same as a notification group. The configuration connects a notification group to a plan, plan action or batch action, together with a trigger. To update or remove a configuration, use its own id (for example planActions.notificationGroups.id), not notificationGroup.id.

1. Get plan details​

Before you change a plan, get the IDs of its plan actions and notification configurations:

query getPlan($id: UUID!) {
plan(id: $id) {
id
name
enabled
scheduleCron
scheduleTimezone
scheduleExecutionDates
scheduleOffset
planActions {
id
name
order
executionPolicy
inputParameters {
key
value
}
resourceGroups {
id
name
}
notificationGroups {
id
scope
triggerEvent
inAdvance
notificationGroup {
id
name
}
}
}
planActionBatches {
id
name
order
}
notificationGroups {
id
triggerEvent
inAdvance
notificationGroup {
id
name
}
}
}
}
{ "id": "<PLAN ID>" }

The examples below return only id and the changed fields. You can request any other fields of the plan in the mutation result.

2. Edit a plan​

Change the name and disable the plan​

mutation updatePlan($input: UpdatePlanInput!) {
updatePlan(input: $input) {
id
name
enabled
}
}
{
"input": {
"id": "<PLAN ID>",
"name": "Monthly patching - production",
"enabled": false
}
}

A disabled plan is not scheduled and cannot be triggered manually.

Change the schedule​

To run the plan every Sunday at 02:00 in Berlin time, set a cron expression and a time zone:

{
"input": {
"id": "<PLAN ID>",
"scheduleCron": "0 2 * * SUN",
"scheduleTimezone": "Europe/Berlin"
}
}

To run the plan on specific dates instead, remove the cron expression and provide the dates:

{
"input": {
"id": "<PLAN ID>",
"scheduleCron": null,
"scheduleOffset": 0,
"scheduleTimezone": "UTC",
"scheduleExecutionDates": ["2026-11-01T02:00:00Z", "2026-12-06T02:00:00Z"]
}
}

Keep in mind:

  • A time zone is required when the plan has a cron expression or execution dates.
  • Execution dates must be in UTC, at least three hours apart, and newly added dates must be in the future. Up to 50 dates can be set.
  • A plan cannot have both a cron expression and execution dates. When switching from a cron expression to dates, set scheduleCron to null and scheduleOffset to 0. When switching from dates to a cron expression, set scheduleExecutionDates to [].
  • To make the plan on demand, set scheduleCron to null and scheduleExecutionDates to [].

3. Add or remove a plan action​

Add a plan action​

Add an item without id to planActions. The new plan action needs action, order, windowDuration, skipWindow and executionPolicy. The example adds the REBOOT system action as the third step of the plan:

mutation addPlanAction($input: UpdatePlanInput!) {
updatePlan(input: $input) {
id
planActions {
id
name
order
}
}
}
{
"input": {
"id": "<PLAN ID>",
"planActions": [
{
"action": { "actionId": "<REBOOT SYSTEM ACTION ID>", "actionType": "SYSTEM" },
"name": "Reboot after patching",
"order": 3,
"windowDuration": 60,
"skipWindow": "ON_SUCCESS",
"executionPolicy": "ANYWAY",
"resourceGroupIds": ["<RESOURCE GROUP ID>"]
}
]
}
}
  • To find system action IDs, see Get system action details. For a custom action, use the actions query and set actionType to CUSTOM.
  • If name is not provided, the name of the action is used.
  • order must be unique across all plan actions and batches of the plan.
  • The first plan action or batch of the plan cannot use the SUCCESS_OR_APPROVAL execution policy.
  • If the action has required parameters, provide them in inputParameters. You can check them in the action's parameterDefinitions.

Remove a plan action​

Pass the plan action ID in planActionsToDelete. Its notification configurations are removed with it.

{
"input": {
"id": "<PLAN ID>",
"planActionsToDelete": ["<PLAN ACTION ID>"]
}
}

To remove an action that is part of a batch, use batchActionsToDelete in planActionBatches instead:

{
"input": {
"id": "<PLAN ID>",
"planActionBatches": [{ "id": "<BATCH ID>", "batchActionsToDelete": ["<BATCH ACTION ID>"] }]
}
}
info

You cannot change which action an existing plan action runs. To use a different action, remove the plan action and add a new one in the same request.

4. Edit a plan action​

Add an item with id to planActions. Only the fields you send are changed. The example changes the window, requires approval, and replaces one resource group with another:

{
"input": {
"id": "<PLAN ID>",
"planActions": [
{
"id": "<PLAN ACTION ID>",
"windowDuration": 120,
"executionPolicy": "APPROVAL",
"approvalMode": "WHENEVER",
"resourceGroupIds": ["<NEW RESOURCE GROUP ID>"],
"resourceGroupIdsToDelete": ["<OLD RESOURCE GROUP ID>"]
}
]
}
}
  • resourceGroupIds and resourceIds add to the groups and resources already in the plan action. Use resourceGroupIdsToDelete and resourceIdsToDelete to remove them.
  • inputParameters replaces all parameters of the plan action. Send the full list, including required parameters.
  • WHENEVER approval mode can be used only with the APPROVAL execution policy. If you change the execution policy to ANYWAY or SUCCESS_OR_APPROVAL, the approval mode is set back to AS_SCHEDULED.

Add, edit or remove plan action notifications​

Notifications of a plan action are set in its notificationGroups list. The example does three things at once:

  • adds a notification to a notification group when the action fails;
  • changes an existing notification to be sent 30 minutes before the action is expected to start;
  • removes another notification.
{
"input": {
"id": "<PLAN ID>",
"planActions": [
{
"id": "<PLAN ACTION ID>",
"notificationGroups": [
{
"notificationGroupId": "<NOTIFICATION GROUP ID>",
"scope": "ACTION",
"triggerEvent": "FAILED"
},
{
"id": "<NOTIFICATION CONFIGURATION ID>",
"triggerEvent": "UPCOMING",
"inAdvance": 30
}
],
"notificationGroupsToDelete": ["<OTHER NOTIFICATION CONFIGURATION ID>"]
}
]
}
}
  • A new notification needs notificationGroupId, scope and triggerEvent.
  • When you update an existing notification, send its id and triggerEvent. Fields you leave out stay unchanged.
  • ACTION scope can be used with UPCOMING, NOT_APPROVED, START, SUCCESSFUL, FAILED and PARTIALLY_SUCCESSFUL. RESOURCE scope can be used with the RESOURCES_* trigger events.
  • inAdvance is the number of minutes before the expected start of the action. It must be greater than 0 for UPCOMING and NOT_APPROVED, and 0 for other trigger events. If you change an existing notification from UPCOMING or NOT_APPROVED to another trigger event, also set inAdvance to 0.
  • notificationGroupsToDelete takes notification configuration IDs (planActions.notificationGroups.id). The notification group itself is not removed.
tip

To send an existing notification to a different notification group, remove the notification configuration and add a new one with the other notificationGroupId.

Actions in a batch use the same notificationGroups and notificationGroupsToDelete fields in planActionBatches.batchActions.

Plan notifications​

Notifications about the whole plan are set in notificationGroups of the plan itself:

{
"input": {
"id": "<PLAN ID>",
"notificationGroups": [
{ "notificationGroupId": "<NOTIFICATION GROUP ID>", "triggerEvent": "UPCOMING", "inAdvance": 60 }
],
"notificationGroupsToDelete": ["<PLAN NOTIFICATION CONFIGURATION ID>"]
}
}

For plan notifications, inAdvance must be greater than 0 for UPCOMING and 0 for other trigger events.

5. Create, edit or remove a notification group​

Create a notification group​

mutation createNotificationGroup($input: CreateNotificationGroupInput!) {
createNotificationGroup(input: $input) {
id
name
}
}
{
"input": {
"name": "Operations team",
"description": "Patching notifications for the operations team",
"channels": [
{
"type": "EMAIL",
"typeProperties": { "email": { "email": "ops@example.com" } }
},
{
"type": "WEBHOOK",
"typeProperties": {
"webhook": { "url": "https://hooks.slack.com/services/<WEBHOOK PATH>", "method": "POST", "type": "SLACK" }
}
}
]
}
}

Use the returned id as notificationGroupId when you add notifications to a plan or plan action.

Edit a notification group​

The example renames a notification group, adds an email address, changes a Slack webhook URL and removes another channel:

mutation updateNotificationGroup($input: UpdateNotificationGroupInput!) {
updateNotificationGroup(input: $input) {
id
name
channels {
id
typeProperties {
... on EmailChannel {
email
}
... on WebhookChannel {
url
type
method
}
}
}
}
}
{
"input": {
"id": "<NOTIFICATION GROUP ID>",
"name": "Operations on-call",
"channels": [
{
"type": "EMAIL",
"typeProperties": { "email": { "email": "ops@example.com" } }
},
{
"id": "<SLACK CHANNEL ID>",
"type": "WEBHOOK",
"typeProperties": {
"webhook": { "url": "https://hooks.slack.com/services/<NEW WEBHOOK PATH>", "method": "POST", "type": "SLACK" }
}
}
],
"channelsToDelete": ["<CHANNEL ID>"]
}
}
  • To get the channel IDs, query notificationGroup(id: ...) with channels { id }.
  • When you update an existing channel, you must provide type and all required fields in typeProperties, even if they do not change.
  • For PAGER_DUTY webhooks, provide the routing key in payload, for example "payload": "{\"routing_key\": \"<ROUTING KEY>\"}". For SLACK webhooks, payload is not used.

Remove a notification group​

mutation removeNotificationGroup($id: UUID!) {
removeNotificationGroup(id: $id)
}
{ "id": "<NOTIFICATION GROUP ID>" }
caution

Removing a notification group also removes all plan, plan action and batch action notifications that use it. To see which plans use the notification group, query notificationGroup(id: ...) with plans { id name }.

6. Send a test notification​

To check a plan action notification, send a test notification for its notification configuration. The triggerEvent must match the trigger event of the configuration:

mutation sendTest($input: SendTestPlanActionNotificationInput!) {
sendTestPlanActionNotification(input: $input)
}
{
"input": {
"planId": "<PLAN ID>",
"planActionId": "<PLAN ACTION ID>",
"planActionNotificationGroupId": "<NOTIFICATION CONFIGURATION ID>",
"triggerEvent": "FAILED"
}
}

For plan notifications, use sendTestPlanNotification with planId, planNotificationGroupId and triggerEvent. For more information about test notifications, see Send Test Notifications.