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/load-alert-group-data.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/platform/workflows/load-alert-group-data/. 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.
Load alert group data
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.
Alert group resources let workflows load full alert group data from Grafana IRM and reference individual fields in step inputs. Workflows loads alert groups when a run starts, before any steps run.
Workflows loads alert groups in two ways:
- Automatically for workflows triggered by alert group events
- Explicitly through the
resources.alertgroupssection of the workflow definition
Automatic loading for alert group events
When a workflow triggers on an alert group event (any event matching grafana_irm_app.alertgroup.*), Workflows
loads the full alert group and makes it available under the key event:
spec:
name: Respond to alert group
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.alertgroup\\..*"
steps:
- id: notify
type: slack.message.post
inputs:
channelID: "C0123456789"
messageText: "Alert group ${resources.alertgroup.event.title} is ${resources.alertgroup.event.state}"You don’t need to configure anything. Workflows reads the alert group ID from the event and loads the current alert group from Grafana IRM.
Automatic loading doesn’t apply when you test a workflow with Run. For details, refer to Test with alert group data.
Declare alert group resources explicitly
To load alert groups that aren’t part of the triggering event, declare them in the resources.alertgroups section. Each
entry maps a reference name to an alert group URI using the alertgroup://id/ scheme:
spec:
resources:
alertgroups:
related: "alertgroup://id/IXXDXP5KHEGRY"
current: "alertgroup://id/${inputs.data.alertGroupID}"Each value must use the alertgroup://id/ prefix followed by the alert group ID. The id/ segment is required.
You can use CEL expressions in the path:
- Literal URIs: A constant alert group URI such as
"alertgroup://id/IXXDXP5KHEGRY". - CEL expressions in the URI: Use
${expression}in the path, for example,"alertgroup://id/${inputs.data.alertGroupID}"to pull the ID from the triggering event data.
Reference alert group fields in step inputs
To use an alert group field in a step input, write ${resources.alertgroup.<KEY>.<FIELD>}:
steps:
- id: post-summary
type: slack.message.post
inputs:
channelID: "C0123456789"
messageText: |
Alert Group: ${resources.alertgroup.event.title}
State: ${resources.alertgroup.event.state}
Alerts: ${resources.alertgroup.event.alerts_count}Available fields
The alert group object contains the fields that the Grafana IRM alert groups API returns. Common fields include:
| Field | Type | Description |
|---|---|---|
id | string | The alert group identifier. |
title | string | The alert group title. |
state | string | Current state, for example, firing or resolved. |
alerts_count | int | Number of alerts in the group. |
created_at | string | When the alert group was created (RFC 3339). |
resolved_at | string | When the alert group was resolved (RFC 3339). |
acknowledged_at | string | When the alert group was acknowledged (RFC 3339). |
silenced_at | string | When the alert group was silenced (RFC 3339). |
The exact fields available depend on the API response. For the complete schema, refer to the Grafana IRM alert groups API.
Combine automatic and explicit resources
A workflow can use both automatic and explicit alert group resources. When a workflow triggers on an alert group event and also
declares explicit resources, both are available. If an explicit entry uses the key event, it overrides the
auto-loaded alert group:
spec:
startWhen:
matchingRules:
- eventNameRegex: "grafana_irm_app\\.alertgroup\\.updated"
resources:
alertgroups:
related: "alertgroup://id/IXXDXP5KHEGRY"
steps:
- id: compare
type: transform
inputs:
template: "Event alert group: ${resources.alertgroup.event.title}, Related: ${resources.alertgroup.related.title}"In this example, resources.alertgroup.event is auto-loaded from the triggering alert group event, and
resources.alertgroup.related is loaded from the explicitly declared ID.
Test with alert group data
When a Grafana IRM event triggers a workflow, Workflows loads the alert group automatically. When you test with Run, it doesn’t, and trigger filters don’t apply. To test a workflow that uses alert group data, add the resource yourself:
- Open the More menu, select Settings, and select the Resources tab.
- Click Add Resource.
- Set Type to Alert Group, Name to
event, and URI toalertgroup://id/${inputs.data.alertGroupID}. - Click Save.
Make sure the event data uses the ID of a real alert group in your stack.
You can keep the resource after you finish testing. When a real event triggers the workflow, it loads the same alert group.
Error handling
If Workflows can’t load an alert group, for example, because the ID doesn’t exist, the run fails before any steps run. This applies to both auto-loaded and explicitly declared alert groups.
Next steps
Was this page helpful?
Related resources from Grafana Labs


