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:
- In Grafana IRM, navigate to Integrations > Outgoing Webhooks
- Click + Create an Outgoing webhook
- 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
Setting | Description | Required |
---|---|---|
Name | Display name of the outgoing webhook | Yes |
Enabled | Controls whether the webhook will trigger | Yes (default: True) |
Assign to Team | Sets which team owns the webhook | No |
Trigger settings
Setting | Description | Required |
---|---|---|
Trigger Type | The event type that activates this webhook | Yes |
Integrations | Restricts webhook to specific integrations (empty = all) | No |
Trigger Template | Template to determine if webhook should execute | No |
Request settings
Setting | Description | Required | Template Support |
---|---|---|---|
HTTP Method | Method used for the request (GET, POST, etc.) | Yes (default: POST) | No |
Webhook URL | Destination URL for the webhook request | Yes | Yes |
Webhook Headers | Headers added to the request | No | Yes |
Data | Body content of the request | No | Yes |
Forward All | Send entire payload instead of using Data field | No (default: False) | No |
Authentication settings
Setting | Description | Required | Template Support |
---|---|---|---|
Username | Basic auth username | No | No |
Password | Basic auth password | No | No |
Authorization Header | Auth header value | No | No |
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 Type | Description | Event Value |
---|---|---|
Manual or Escalation Step | Triggers when included in an escalation chain or manually executed | escalation |
Alert Group Created | Triggers when a new alert group is created | alert group created |
Acknowledged | Triggers when an alert group is acknowledged | acknowledge |
Resolved | Triggers when an alert group is resolved | resolve |
Silenced | Triggers when an alert group is silenced | silence |
Unsilenced | Triggers when an alert group is unsilenced | unsilence |
Unresolved | Triggers when an alert group is unresolved | unresolve |
Unacknowledged | Triggers when an alert group is unacknowledged | unacknowledge |
Status Change | Triggers on any status change event | status 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
{
"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:
{
"labels": {{ alert_payload.labels | tojson() }}
}
Monitor webhook execution
To view webhook status and execution details:
- Go to the Outgoing Webhooks tab of the IRM integrations page.
- Review the Last event column for timestamp and status code
- 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: