APIWebhooks

Create a webhook

Create a webhook. Returns the signing secret (shown only here and on rotate).

POST
/webhooks

Create a webhook. Returns the signing secret (shown only here and on rotate).

Authorization

ApiKeyAuth
headerAuthorizationBearer <token>

Bearer token authentication. Send an API key (a saai_api_-prefixed token) as Authorization: Bearer <token>.

Required permission

manage_webhooks

Request Body

application/json
  1. body

Request body for creating a webhook.

name*string
Length1 <= length <= 255
url*string

HTTPS endpoint URL. Private, loopback, and cloud-metadata addresses are rejected. Treated as a credential and never returned.

Lengthlength <= 2048
events*array<string>

Audit actions to subscribe to, or ["*"] for all of them. An unknown action is rejected.

Items1 <= items
headers?

Custom request headers sent with every delivery. Signing and transport header names are reserved and rejected.

format?string

Defaults to single.

Value in"single""array""ndjson"
max_events?integer

How many events one delivery may bundle. Defaults to 1.

Formatint32
Range1 <= value <= 100
template?string

Go text/template for the delivered body. It must render valid JSON against vars, which is checked when you save. Empty means the default envelope.

Lengthlength <= 8192
condition?string

CEL expression an event must satisfy to be delivered, checked when you save against the payload fields of events. Empty delivers every subscribed event.

Lengthlength <= 1024
destination?string

The destination this webhook is set up for, such as slack. A label for display only.

Lengthlength <= 64
vars?

Template variables, read as {{ .Vars.<key> }}. Write-only; stored encrypted. Names must be non-empty and at most 64 characters.

Response Body

The request has succeeded and a new resource has been created as a result.

application/json
  1. response

Create/rotate response. secret is shown only once, here.

webhook*

A configured webhook. The signing secret, the endpoint URL, custom header values, and variable values are never returned.

secret*string

The whsec_ signing secret. Shown only once.

curl -X POST "https://example.com/webhooks" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "url": "string",    "events": [      "string"    ]  }'
{  "webhook": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "url_hint": "string",    "events": [      "string"    ],    "status": "active",    "disabled_reason": "circuit_breaker",    "failing_since": "2019-08-24T14:15:22Z",    "last_delivery_status": "pending",    "last_delivery_at": "2019-08-24T14:15:22Z",    "format": "single",    "max_events": 0,    "has_custom_headers": true,    "header_keys": [      "string"    ],    "template": "string",    "condition": "string",    "destination": "string",    "var_keys": [      "string"    ],    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "secret": "string"}