Menu
Grafana Cloud

Configure OnCall outgoing webhooks

OnCall outgoing webhooks allow Grafana IRM to send alert data to external systems. You can configure these webhooks to trigger on specific events and customize the data sent to match your requirements.

Outgoing webhooks are used by Grafana OnCall to send data to a URL in a flexible way. These webhooks can be triggered from a variety of event types and make use of Jinja2 to transform data into the format required at the destination URL. Each outgoing webhook receives contextual data when executed which can be processed by Jinja2 templates to customize the request being sent.

About OnCall outgoing webhooks

Outgoing webhooks send data to external URLs when specific events occur in Grafana IRM. Each webhook:

  • Triggers based on configurable event types
  • Uses Jinja2 templates to format data for the destination
  • Receives contextual data when executed
  • Can be included as a step in escalation chains

Create an outgoing webhook

To create an outgoing webhook:

  1. In Grafana IRM, navigate to Integrations > Outgoing Webhooks
  2. Click + Create an Outgoing webhook
  3. Select a preset based on your needs:
    • Simple webhook - POST alert group data with basic configuration
    • Advanced webhook - Full customization of all webhook parameters

Configure webhook settings

Basic settings

SettingDescriptionRequired
NameDisplay name of the outgoing webhookYes
EnabledControls whether the webhook will triggerYes (default: True)
Assign to TeamSets which team owns the webhookNo

Trigger settings

SettingDescriptionRequired
Trigger TypeThe event type that activates this webhookYes
IntegrationsRestricts webhook to specific integrations (empty = all)No
Trigger TemplateTemplate to determine if webhook should executeNo

Request settings

SettingDescriptionRequiredTemplate Support
HTTP MethodMethod used for the request (GET, POST, etc.)Yes (default: POST)No
Webhook URLDestination URL for the webhook requestYesYes
Webhook HeadersHeaders added to the requestNoYes
DataBody content of the requestNoYes
Forward AllSend entire payload instead of using Data fieldNo (default: False)No

Authentication settings

SettingDescriptionRequiredTemplate Support
UsernameBasic auth usernameNoNo
PasswordBasic auth passwordNoNo
Authorization HeaderAuth header valueNoNo

Note: The destination server must respond within 4 seconds or the request will time out.

Event types

Outgoing webhooks can be triggered by the following event types:

Event TypeDescriptionEvent Value
Manual or Escalation StepTriggers when included in an escalation chain or manually executedescalation
Alert Group CreatedTriggers when a new alert group is createdalert group created
AcknowledgedTriggers when an alert group is acknowledgedacknowledge
ResolvedTriggers when an alert group is resolvedresolve
SilencedTriggers when an alert group is silencedsilence
UnsilencedTriggers when an alert group is unsilencedunsilence
UnresolvedTriggers when an alert group is unresolvedunresolve
UnacknowledgedTriggers when an alert group is unacknowledgedunacknowledge
Status ChangeTriggers on any status change eventstatus change

Use webhook templates

Outgoing webhooks support Jinja2 templates to customize the data sent to external systems. Templates have access to context data from the triggering event.

Available data fields

The following data is available to templates when a webhook executes:

Event information

  • {{ event.type }} - Type of event that triggered the webhook
  • {{ event.time }} - Timestamp when the event occurred

User information

Available when the event was triggered by a user action:

  • {{ user.id }} - User ID
  • {{ user.username }} - Username
  • {{ user.email }} - Email address

Alert group information

  • {{ alert_group.id }} - Alert group ID
  • {{ alert_group.integration_id }} - Integration ID
  • {{ alert_group.route_id }} - Route ID
  • {{ alert_group.alerts_count }} - Number of alerts in the group
  • {{ alert_group.state }} - Current state
  • {{ alert_group.created_at }} - Creation timestamp
  • {{ alert_group.resolved_at }} - Resolution timestamp
  • {{ alert_group.acknowledged_at }} - Acknowledgment timestamp
  • {{ alert_group.title }} - Alert group title
  • {{ alert_group.permalinks }} - Links to the alert group
  • {{ alert_group.labels }} - Alert group labels

Alert information

  • {{ alert_payload }} - Content of the first alert in the group

Integration information

  • {{ integration.id }} - Integration ID
  • {{ integration.type }} - Integration type
  • {{ integration.name }} - Integration name
  • {{ integration.team }} - Team the integration belongs to
  • {{ integration.labels }} - Integration labels

User action information

  • {{ alert_group_acknowledged_by }} - User who acknowledged the alert
  • {{ alert_group_resolved_by }} - User who resolved the alert

Notification information

  • {{ notified_users }} - Array of users who received notifications
  • {{ users_to_notify }} - Array of users who will be notified next

Webhook information

  • {{ webhook.id }} - Webhook ID
  • {{ webhook.name }} - Webhook name
  • {{ webhook.labels }} - Webhook labels

Previous webhook responses

  • {{ responses }} - Responses from other webhooks for this alert group

Template examples

Basic JSON data example

json
{
  "name": "{{ alert_payload.labels.alertname }}",
  "message": "{{ alert_payload.annotations.description }}"
}

URL parameter example

https://example.com/tickets?assignee={{ user.email }}

Formatting JSON correctly

When using objects in templates, use the tojson() filter to ensure proper JSON formatting:

json
{
  "labels": {{ alert_payload.labels | tojson() }}
}

Monitor webhook execution

To view webhook status and execution details:

  1. Go to the Outgoing Webhooks tab of the IRM integrations page.
  2. Review the Last event column for timestamp and status code
  3. Click the View icon to open event details from the last execution:
    • Webhook details
    • Request URL, headers, and body
    • Response code and body
    • Template evaluation results

Advanced usage

Conditional execution

Use the Trigger Template field to control when a webhook executes. The webhook will run only if the template evaluates to an empty string, True, or 1.

Example to trigger only for high-severity alerts:

{% if alert_payload.labels.severity == "high" %}true{% endif %}

Using response data from other webhooks

You can access the responses from other webhooks that have run for the same alert group using the responses object:

{{ responses["WEBHOOK_ID"].content.ticket_id }}

This is useful for workflows that need to reference IDs or data created by previous webhook actions.

Examples and integrations

For example configurations of common integrations, see: