Public preview Grafana Cloud
Last reviewed: October 13, 2026

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.alertgroups section 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:

YAML
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:

YAML
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>}:

YAML
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:

FieldTypeDescription
idstringThe alert group identifier.
titlestringThe alert group title.
statestringCurrent state, for example, firing or resolved.
alerts_countintNumber of alerts in the group.
created_atstringWhen the alert group was created (RFC 3339).
resolved_atstringWhen the alert group was resolved (RFC 3339).
acknowledged_atstringWhen the alert group was acknowledged (RFC 3339).
silenced_atstringWhen 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:

YAML
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:

  1. Open the More menu, select Settings, and select the Resources tab.
  2. Click Add Resource.
  3. Set Type to Alert Group, Name to event, and URI to alertgroup://id/${inputs.data.alertGroupID}.
  4. 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