Grafana Cloud
Last reviewed: April 28, 2026

Load alert group data

Note

Grafana Workflows is currently in private preview. Grafana Labs offers support on a best-effort basis, and breaking changes might occur prior to the feature being made generally available.

Alert group resources let workflows load full Grafana IRM alert group data and reference individual fields in step inputs. The engine fetches alert groups at the start of workflow execution, before any steps run.

There are two ways alert groups are loaded:

  • 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.*), the engine automatically fetches 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}"

No configuration is required. The engine detects the alert group event, extracts the alert group ID from the event payload, and fetches the current alert group data from the Grafana OnCall API.

Declare alert group resources explicitly

To load alert groups that are not 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.alertGroupID}"

Values must use the alertgroup://id/ URI prefix followed by the alert group ID. The id/ path segment distinguishes ID lookups from future URI types. CEL expressions are supported in the path and are evaluated before the URI is parsed:

  • 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.alertGroupID}" to pull the ID from the triggering event data.

Reference alert group fields in step inputs

Access alert group fields using ${resources.alertgroup.<key>.<field>} syntax in step inputs:

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 fields from the Grafana OnCall API. 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 OnCall API response. Refer to the Grafana OnCall API documentation for the complete schema.

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.

Error handling

If any alert group fails to load (invalid ID, API unreachable, or authentication failure), the workflow fails immediately before any steps execute. This applies to both auto-loaded and explicitly declared alert groups.

Next steps