---
agent:
  instructions: "Search Greenbar's public pages and docs by keyword. A result has every word you give. Results are returned in Markdown."
  endpoint: "https://usegreenbar.com/.well-known/search?q={query}"
  method: "GET"
---

# 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.

![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.](https://usegreenbar.com/docs/screenshots/alerts-add-webhook-light.png?v=7e173cd7565d)

*A webhook on example.com. Leave the secret blank to have one generated.*

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.

```text
{
  "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

**What you see if a webhook cannot be saved or rotated**

| What you see | Why | What to change |
| --- | --- | --- |
| `Invalid URL` | The value is not a URL. The field is a URL input, so the browser usually stops this before the form is sent. | Enter an http or https URL. |
| `Webhook URL is required` | The value is a URL but it does not start with http, such as ftp. | Enter an http or https URL. |
| The message starts with `Webhook URL rejected:` | The host is not a public address. | Use a public URL. |
| `Webhook secret must be at least 8 characters` | The secret you typed is shorter than that. | 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.` | The stored secret can't be opened. | Delete the channel and add it again. |
| `The secret was just rotated somewhere else. Reload and try again.` | A rotation landed first. | Reload, then rotate if you still need to. |
| `Could not rotate the secret. Try again.` | The rotation did not finish. | Try again. |

## Reminder events

*Available on Paid plans*

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