Create a webhook notifier

To configure a webhook notifier, enter a URL that specifies the endpoint to send HTTP POST requests to.

To create a webhook notifier:

  1. In the navigation menu select Alerting > Notifiers.

  2. Click Create Notifier.

  3. Enter a descriptive name for the notifier.

  4. Select Webhook as the type of notifier you want to create.

  5. In the URL field, enter a URL, which is called as a POST request. For example:

    https://webhook.site/3723e8cb-b1b4-4399-86b0-e37f36a2acc5
  6. Click Save.

Webhook notifier request body

The following example outlines the body for a POST request to a webhook. The request consists of one triggered alert called "test alert" that has several associated labels, such as component, instance, and job.

This example contains several notable sections:

  • commonLabels: contains labels that are common across all alerts in a notification display. Each alerting series includes the full list of labels. Any static labels that you define also display under commonLabels.

  • groupLabels: contains label values for the related signal display, in addition to a "severity" for the label.

  • fingerprint: a representation of an alerting series, expressed as a deterministic value based on the hash of the labels.

{
  "notifier": "test webhook",
  "status": "firing",
  "alerts": [
    {
      "status": "firing",
      "labels": {
        "alertname": "test alert",
        "component": "remote_write",
        "instance": "localhost:3030",
        "job": "collector_binary",
        "severity": "critical",
        "pod_name": "prom-74cbfb46c9-2ftk9"
      },
      "annotations": {
        "ruleid": "32bb3fbe-c10b-44bb-a4c0-3d053f4a08cd",
        "monitor_slug": "test-monitor",
        "notification_policy_slug": "test-policy"
      },
      "startsAt": "2020-05-19T13:57:21.68227886Z",
      "endsAt": "0001-01-01T00:00:00Z",
      "fingerprint": "7424223989b20025"
    }
  ],
  "groupLabels": {
    "alertname": "test alert",
    "severity": "critical"
  },
  "commonLabels": {
    "alertname": "test alert",
    "component": "remote_write",
    "instance": "localhost:3030",
    "job": "collector_binary",
    "severity": "critical",
    "pod_name": "prom-74cbfb46c9-2ftk9"
  },
  "commonAnnotations": {
    "ruleid": "32bb3fbe-c10b-44bb-a4c0-3d053f4a08cd",
    "monitor_slug": "test-monitor",
    "notification_policy_slug": "test-policy"
  },
  "version": "4"
}