Webhook

This topic helps you configure the Webhook notifier. It also discusses that WeCom contact points need a Webhook URL.

Example JSON body:

  1. {
  2. "receiver": "My Super Webhook",
  3. "status": "firing",
  4. "orgId": 1,
  5. "alerts": [
  6. {
  7. "status": "firing",
  8. "labels": {
  9. "alertname": "High memory usage",
  10. "team": "blue",
  11. "zone": "us-1"
  12. },
  13. "annotations": {
  14. "description": "The system has high memory usage",
  15. "runbook_url": "https://myrunbook.com/runbook/1234",
  16. "summary": "This alert was triggered for zone us-1"
  17. },
  18. "startsAt": "2021-10-12T09:51:03.157076+02:00",
  19. "endsAt": "0001-01-01T00:00:00Z",
  20. "generatorURL": "https://play.grafana.org/alerting/1afz29v7z/edit",
  21. "fingerprint": "c6eadffa33fcdf37",
  22. "silenceURL": "https://play.grafana.org/alerting/silence/new?alertmanager=grafana&matchers=alertname%3DT2%2Cteam%3Dblue%2Czone%3Dus-1",
  23. "dashboardURL": "",
  24. "panelURL": "",
  25. "valueString": "[ metric='' labels={} value=14151.331895396988 ]"
  26. },
  27. {
  28. "status": "firing",
  29. "labels": {
  30. "alertname": "High CPU usage",
  31. "team": "blue",
  32. "zone": "eu-1"
  33. },
  34. "annotations": {
  35. "description": "The system has high CPU usage",
  36. "runbook_url": "https://myrunbook.com/runbook/1234",
  37. "summary": "This alert was triggered for zone eu-1"
  38. },
  39. "startsAt": "2021-10-12T09:56:03.157076+02:00",
  40. "endsAt": "0001-01-01T00:00:00Z",
  41. "generatorURL": "https://play.grafana.org/alerting/d1rdpdv7k/edit",
  42. "fingerprint": "bc97ff14869b13e3",
  43. "silenceURL": "https://play.grafana.org/alerting/silence/new?alertmanager=grafana&matchers=alertname%3DT1%2Cteam%3Dblue%2Czone%3Deu-1",
  44. "dashboardURL": "",
  45. "panelURL": "",
  46. "valueString": "[ metric='' labels={} value=47043.702386305304 ]"
  47. }
  48. ],
  49. "groupLabels": {},
  50. "commonLabels": {
  51. "team": "blue"
  52. },
  53. "commonAnnotations": {},
  54. "externalURL": "https://play.grafana.org/",
  55. "version": "1",
  56. "groupKey": "{}:{}",
  57. "truncatedAlerts": 0,
  58. "title": "[FIRING:2] (blue)",
  59. "state": "alerting",
  60. "message": "**Firing**\n\nLabels:\n - alertname = T2\n - team = blue\n - zone = us-1\nAnnotations:\n - description = This is the alert rule checking the second system\n - runbook_url = https://myrunbook.com\n - summary = This is my summary\nSource: https://play.grafana.org/alerting/1afz29v7z/edit\nSilence: https://play.grafana.org/alerting/silence/new?alertmanager=grafana&matchers=alertname%3DT2%2Cteam%3Dblue%2Czone%3Dus-1\n\nLabels:\n - alertname = T1\n - team = blue\n - zone = eu-1\nAnnotations:\nSource: https://play.grafana.org/alerting/d1rdpdv7k/edit\nSilence: https://play.grafana.org/alerting/silence/new?alertmanager=grafana&matchers=alertname%3DT1%2Cteam%3Dblue%2Czone%3Deu-1\n"
  61. }

Webhook fields

Body

KeyTypeDescription
receiverstringName of the webhook
statusstringCurrent status of the alert, firing or resolved
orgIdnumberID of the organization related to the payload
alertsarray of alertsAlerts that are triggering
groupLabelsobjectLabels that are used for grouping, map of string keys to string values
commonLabelsobjectLabels that all alarms have in common, map of string keys to string values
commonAnnotationsobjectAnnotations that all alarms have in common, map of string keys to string values
externalURLstringExternal URL to the Grafana instance sending this webhook
versionstringVersion of the payload
groupKeystringKey that is used for grouping
truncatedAlertsnumberNumber of alerts that were truncated
titlestringWill be deprecated soon
statestringWill be deprecated soon
messagestringWill be deprecated soon

Alert

KeyTypeDescription
statusstringCurrent status of the alert, firing or resolved
labelsobjectLabels that are part of this alert, map of string keys to string values
annotationsobjectAnnotations that are part of this alert, map of string keys to string values
startsAtstringStart time of the alert
endsAtstringEnd time of the alert, default value when not resolved is 0001-01-01T00:00:00Z
valueStringstringValues that triggered the current status
generatorURLstringURL of the alert rule in the Grafana UI
fingerprintstringThe labels fingerprint, alarms with the same labels will have the same fingerprint
silenceURLstringURL to silence the alert rule in the Grafana UI
dashboardURLstringWill be deprecated soon
panelURLstringWill be deprecated soon

Alerts are not coupled to dashboards anymore therefore the fields related to dashboards dashboardId and panelId have been removed.

WeCom

WeCom contact points need a Webhook URL. These are obtained by setting up a WeCom robot on the corresponding group chat. To obtain a Webhook URL using the WeCom desktop Client please follow these steps:

  1. Click the “…” in the top right corner of a group chat that you want your alerts to be delivered to
  2. Click “Add Group Robot”, select “New Robot” and give your robot a name. Click “Add Robot”
  3. There should be a Webhook URL in the panel.
SettingDescription
UrlWeCom webhook URL.