Docs menu

    Webhook alerts

    POST a signed JSON body to your own URL when an alert is sent.

    Add a webhook

    A webhook is an https or http POST to a URL you run. The body is JSON. Greenbar signs it so you can check it came from this channel. Leave Signing secret blank and one is generated, or paste your own.

    1. Open Alerts. Under Add channel, set Type to Webhook.
    2. Enter the URL. Leave Signing secret blank to generate one, or paste a secret.
    3. Choose Add channel.
    4. Copy the signing secret from the banner. It is shown once.
    A webhook on example.com. Leave the secret blank to have one generated.
    The Add channel form with Type set to Webhook, Webhook URL set to https://example.com/greenbar-alerts, and Signing secret empty so its placeholder says Leave blank to generate one. On a paid plan, the SMS (Coming soon) question is under Type, and Add channel is at the bottom.The Add channel form with Type set to Webhook, Webhook URL set to https://example.com/greenbar-alerts, and Signing secret empty so its placeholder says Leave blank to generate one. On a paid plan, the SMS (Coming soon) question is under Type, and Add channel is at the bottom.

    The banner says Webhook signing secret: copy it now. Greenbar won't show it again. The button is Copy signing secret. If the plan doesn't include webhooks, Type shows Webhook (paid plans).

    The URL has to be a public http or https address. A private or local address is refused, and the check runs again when the alert is sent. A secret you type has to be at least as long as the message below says. The generated secret is longer.

    What is posted

    The body is JSON. Check the header X-Greenbar-Signature, which is sha256= followed by the lowercase hex of the HMAC-SHA256 of the raw body, using the current secret. After you rotate, the previous secret also signs X-Greenbar-Signature-Previous for 24 hours. Rotating again during that window drops the older secret at once.

    {
      "event": "incident.opened",
      "incident": { "id": "", "title": "", "status": "", "startedAt": "", "resolvedAt": null },
      "monitor": { "id": "", "name": "", "url": "" },
      "project": { "id": "", "name": "", "statusPageUrl": "" },
      "sentAt": "",
      "error": null,
      "durationSec": null
    }

    event is incident.opened, incident.resolved, monitor.degraded, monitor.slow or test. The keys are always there. incident is null for a degraded or slow alert, and monitor is null for a test. error and durationSec are null when there is nothing to report. detail is left out unless the alert has one. A test alert carries a placeholder incident with the id test, the title Test alert and the status investigating.

    Choose Rotate secret, then Rotate now. The banner then says New signing secret. Cancel closes the confirm without rotating. Send test is described on How alerts work.

    When it fails

    • Invalid URL

      Why: The value is not a URL. The field is a URL input, so the browser usually stops this before the form is sent.

      What to change: Enter an http or https URL.

    • Webhook URL is required

      Why: The value is a URL but it does not start with http, such as ftp.

      What to change: Enter an http or https URL.

    • The message starts with Webhook URL rejected:

      Why: The host is not a public address.

      What to change: Use a public URL.

    • Webhook secret must be at least 8 characters

      Why: The secret you typed is shorter than that.

      What to change: Use a longer secret, or leave the field blank.

    • The current signing secret can't be read, so it can't be rotated. Delete this channel and add it again to get a new secret.

      Why: The stored secret can't be opened.

      What to change: Delete the channel and add it again.

    • The secret was just rotated somewhere else. Reload and try again.

      Why: A rotation landed first.

      What to change: Reload, then rotate if you still need to.

    • Could not rotate the secret. Try again.

      Why: The rotation did not finish.

      What to change: Try again.

    Reminder events

    Available on Paid plans

    A reminder is sent with event incident.reminder and an incident like an opened alert.