Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/platform/workflows/reference/blueprints/invite-on-call-from-alert-group-label.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/platform/workflows/reference/blueprints/invite-on-call-from-alert-group-label/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Invite on-call from alert group label
Note
Grafana Workflows is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.
When someone adds a team label to an alert group, invite that team’s current on-call engineer to the alert group.
This Grafana Workflows blueprint is in the Alerts category of the Blueprints library.
Before you begin
To use this blueprint, you need:
- Grafana IRM set up on your stack.
Steps
Steps run in order from first to last. A step inside a switch branch runs only when Workflows chooses that branch.
| Step | ID | Type | Description |
|---|---|---|---|
| Find the team’s on-call | get-team-on-call | irm.team-current-oncall | Looks up who is on call for the IRM team named by the label value. No changes needed. |
| Invite the on-call engineer | invite-on-call | irm.invite-user-to-alert-group | Invites the team’s first on-call user to the alert group. Critical alert groups are sent as important. No changes needed. |
For the inputs and outputs of each step type, refer to Step and trigger types reference.
Before you turn on the workflow, customize any steps that need input from you, such as a channel ID or a schedule name. Each step’s description says what to set.
Workflow definition
Save this definition as a YAML file to create the workflow with gcx, the Workflows API, or Terraform, or give it to a coding agent as an example.
Replace FOLDER_UID with the UID of the folder for the workflow.
Blueprints start disabled, so finish customizing the steps before you set enabled to true.
For details, refer to Manage workflows as code.
apiVersion: workflows.ext.grafana.app/v1alpha1
kind: Definition
metadata:
name: invite-on-call-from-alert-group-label
annotations:
grafana.app/folder: <FOLDER_UID>
spec:
name: Invite on-call from alert group label
enabled: false
startWhen:
matchingRules:
- eventNameRegex: 'grafana_irm_app\.alertgroup\.updated'
filter: "inputs.data.eventKind == 'label_added' && inputs.data.label.key.name == 'team' && resources.alertgroup.event.state != 'resolved'"
schedules: []
steps:
- id: get-team-on-call
type: irm.team-current-oncall
name: Find the team's on-call
description: Looks up who is on call for the IRM team named by the label value. No changes needed.
inputs:
teamIdentifier: '${inputs.data.label.value.name}'
identifierType: 'name'
- id: invite-on-call
type: irm.invite-user-to-alert-group
name: Invite the on-call engineer
description: Invites the team's first on-call user to the alert group. Critical alert groups are sent as important. No changes needed.
inputs:
userID: "${steps['get-team-on-call'].outputs.users[0].email}"
alertGroupID: '${inputs.data.alertGroupID}'
important: "${resources.alertgroup.event.labels.exists(l, l.key.name == 'severity' && l.value.name.matches('(?i)^critical$'))}"How it works
This section explains when the workflow runs and how its steps work together.
When it runs
This blueprint starts on the grafana_irm_app.alertgroup.updated event.
Its trigger filter starts a run only when this CEL expression is true:
inputs.data.eventKind == 'label_added' && inputs.data.label.key.name == 'team' && resources.alertgroup.event.state != 'resolved'How the steps fit together
These notes cover how the steps connect and which Workflows behaviors the blueprint relies on.
- The alert group counterpart of Invite on-call from incident label.
- Triggers on
eventKindlabel_added, which IRM sends when someone adds a label to an alert group in the UI or API (not for labels set when the alert arrives). - The event carries the added label as
inputs.data.label, shaped {key: {name}, value: {name}}. - The trigger filter keeps only labels with the key team on alert groups that are not resolved.
- The label value is used as the IRM team name, so label values must match IRM team names exactly.
irm.page-teamcan only attach a page to an incident, so this workflow looks up the team’s current on-call withirm.team-current-oncalland invites the first on-call user withirm.invite-user-to-alert-group.- If nobody is on call, the invite step fails and the run shows as failed.
- The important flag is true when the alert group has a
severity=criticallabel. - Customize the label key in the trigger filter.
Next steps
Was this page helpful?
Related resources from Grafana Labs


