Grafana Alerting
Grafana Alerting’s webhook contact point supports a fully customizable payload using Grafana’s Go-template notification engine.
See API Overview for authentication and finding your Account ID/Team ID.
Configure the Webhook in Grafana
Section titled “Configure the Webhook in Grafana”- In Grafana, go to Alerting → Contact points → + Add contact point.
- Choose integration type Webhook.
- Set the URL to
https://api.opsfusion.cloud/v1/account/YOUR_ACCOUNT_ID/push/alert. - Add an HTTP header:
Authorization: YOUR_API_KEY. - Enable Custom Payload and enter the template below (this replaces the default Title/Message fields entirely).
Payload Template
Section titled “Payload Template”{{ $severityMap := coll.Dict "critical" 1 "warning" 2 "info" 3 }}{{ $sev := .CommonLabels.severity }}{ "teamId": YOUR_TEAM_ID, "title": "{{ .CommonLabels.alertname }}", "description": "{{ .CommonAnnotations.summary }}", "severity": {{ if $sev }}{{ index $severityMap $sev }}{{ else }}3{{ end }}, "status": {{ if eq .Status "firing" }}1{{ else }}3{{ end }}, "labels": {{ data.ToJSON .CommonLabels }}}Unlike most of the other tools in this section, Grafana’s templating language has real conditional logic and a coll.Dict/index lookup pattern, so both status and severity can be computed inline from the alert’s own data rather than hardcoded or needing separate contact points per state. status comes from .Status (firing/resolved) directly; severity looks up a severity label (set on your alert rule, e.g. severity: critical) against the map, falling back to 3 if the label isn’t set.
Field Mapping
Section titled “Field Mapping”| OpsFusion field | Grafana source |
|---|---|
teamId | Hardcoded per contact point |
title | .CommonLabels.alertname |
description | .CommonAnnotations.summary (or .CommonAnnotations.description) |
severity | .CommonLabels.severity, looked up against $severityMap (falls back to 3 if unset) |
status | .Status (firing → 1, resolved → 3), computed inline with {{ if }} |
labels | data.ToJSON .CommonLabels |
Troubleshooting
Section titled “Troubleshooting”- Template fails to save or compile: Grafana’s Custom Payload templating has had rough edges in some versions — simplify the template to isolate which function/expression is failing, and check your Grafana version’s release notes for known templating issues.
labelsisn’t valid JSON:data.ToJSONshould handle escaping automatically — if you’re building the labels object by hand instead, make sure any string values are wrapped in{{ ... | printf "%q" }}style escaping.- Custom Payload option missing: confirm you’re on self-managed or Enterprise Grafana; it’s not yet available on Grafana Cloud.
Support
Section titled “Support”For integration support:
- Email: support@opsfusion.cloud
- See Send Alerts for the full API reference