> ## Documentation Index
> Fetch the complete documentation index at: https://snapr.seshuk.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook

> Send an HTTP request with a JSON run summary to any URL after a snapr job finishes.

`type: webhook` sends an HTTP request with the run summary as a JSON body.

## Options

| Option    | Type      | Required | Default | Description                                |
| --------- | --------- | -------- | ------- | ------------------------------------------ |
| `type`    | `webhook` | Yes      | —       |                                            |
| `url`     | string    | Yes      | —       | Target URL.                                |
| `method`  | string    | No       | `POST`  | HTTP method: `POST`, `PUT`, and so on.     |
| `headers` | map       | No       | —       | Extra HTTP headers. Use `env:` for tokens. |

Plus the [common fields](/configuration/notifiers/overview) (`name`, `onSuccess`, `onFailure`).

## Payload

snapr sends the request with `Content-Type: application/json` and this body:

```json theme={null}
{
  "job": "nightly",
  "success": false,
  "duration": "1m32s",
  "error": "pg_dump: connection refused"
}
```

| Field      | Type   | Description                                        |
| ---------- | ------ | -------------------------------------------------- |
| `job`      | string | Name of the job that ran.                          |
| `success`  | bool   | Whether the run succeeded.                         |
| `duration` | string | Human-readable run duration.                       |
| `error`    | string | Error message on failure; empty string on success. |

Any response with a status code outside the `2xx` range is treated as a delivery failure and logged. The request times out after 30 seconds.

## Example

```yaml snapr.yaml theme={null}
notifiers:
  - type: webhook
    name: ops
    url: https://hooks.example.com/services/abc123
    method: POST
    headers:
      Authorization: env:WEBHOOK_TOKEN
      X-App: snapr
    onSuccess: true
    onFailure: true
```
