Skip to content

Webhooks

A webhook destination tells your own endpoint what a schedule did. Each time one of the schedules that tells it has news, Belay sends one HTTPS POST with a JSON body to the address you gave, signed so your endpoint can check it came from Belay. This page is for the developer who writes that endpoint.

Add a webhook on the organization’s Notifications page: choose Webhook, name it, and give the endpoint’s address. Belay shows the webhook’s secret once, right after you add it. Copy it then; New secret…, under the webhook’s Edit, makes another and the old one stops working at once. Then pick the webhook under Notifications in a schedule, and when to tell it.

event When
batch_finished A schedule’s batch finished, and the schedule’s choice of when to tell this webhook holds (when something stops passing or everything passes again; every time something doesn’t pass; or every time).
schedule_not_started A schedule’s time came and it could not start its batch. Sent when the reason is new, or every time to a webhook told every time.
schedule_skipped A schedule’s time came while its last batch was still running, so the time was skipped. Sent only to a webhook told every time.
test Someone pressed Send a test on the Notifications page. Nothing ran.

Each batch makes at most one message for a webhook. That message can still arrive more than once; see the retries.

POST /your/path HTTP/1.1
Content-Type: application/json; charset=utf-8
User-Agent: Belay-Webhooks/1
webhook-id: 3f6c1a52-8a3e-4b5e-9d0a-2b7f4c1e9a10
webhook-timestamp: 1794389400
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
Header What it is
webhook-id This message’s id. It is the same on every try of the same message, so use it to ignore a message you already handled. It equals the body’s id.
webhook-timestamp When this try was sent, in whole seconds since 1970-01-01 UTC. Each try has its own.
webhook-signature v1, and the signature of this try (below).

A JSON object. A member with no value is left out rather than sent as null.

{
"version": 1,
"id": "3f6c1a52-8a3e-4b5e-9d0a-2b7f4c1e9a10",
"event": "batch_finished",
"organization": "Acme",
"project": "Storefront",
"schedule": "Nightly smoke",
"environment": "staging",
"at": "2026-11-11T09:30:00Z",
"batch": {
"batchId": "batch-0b6e2c1a-5d7f-4c1e-9a3b-2f8d4e6a7c10",
"result": "failed",
"ran": "Tag smoke",
"counts": { "workflows": 40, "passed": 37, "notPassed": 2, "notStarted": 1, "cancelled": 0, "interrupted": 0 },
"sinceLastBatch": { "stoppedPassing": 2, "stillNotPassing": 0, "passingAgain": 0, "stillPassing": 37, "newNotPassing": 0, "newPassing": 0 },
"notPassing": [
{
"workflow": "Checkout with a saved card",
"outcome": "Failed",
"step": "Check that the Cart panel shows \"Order placed\".",
"why": "Not in the Cart panel. It appears once elsewhere, in the header.",
"url": "https://app.belayqa.com/projects/…/runs/…",
"change": "stopped_passing"
},
{
"workflow": "Gift card balance",
"outcome": "Can't run",
"why": "It needs a change before it can run. Open it to see why.",
"url": "https://app.belayqa.com/projects/…/workflows/…"
}
],
"more": 0
},
"url": "https://app.belayqa.com/projects/…/batches/batch-0b6e2c1a-5d7f-4c1e-9a3b-2f8d4e6a7c10"
}
Member Type What it is
version number The body’s version, 1.
id string This message’s id, the same as the webhook-id header.
event string One of the events above.
organization string Your organization’s name.
project string The project’s name. Not on test.
schedule string The schedule’s name. Not on test.
environment string The environment the schedule runs on. Not on test.
at string When the event happened, ISO 8601 in UTC.
batch object On batch_finished only; below.
said string On schedule_not_started and schedule_skipped: what the schedule recorded, in a sentence, such as “The last batch was still running, so this time was skipped.”
url string Where to read more in Belay: the batch’s page, the project’s schedules, or the Notifications page for a test.

batch:

Member Type What it is
batchId string The batch’s id in Belay.
result string passed, failed (a run failed, ended in error, or stopped because a step needs a change), or incomplete (nothing failed, but not everything passed: a run was interrupted or cancelled, a workflow could not run, or a step could not be verified).
ran string What the schedule runs: Tag smoke, Folder Checkout, or All workflows.
counts object workflows in the batch; of them passed, notPassed, notStarted (it could not start: a step needs a change, or a variable it uses has no value on this environment), and cancelled; and interrupted, runs Belay itself could not finish, which say nothing about your application and never count as not passing.
sinceLastBatch object Compared workflow by workflow with the last batch of the same selection on the same environment: stoppedPassing, stillNotPassing, passingAgain, stillPassing, newNotPassing and newPassing (no earlier result). Absent on a schedule’s first batch.
notPassing array The first five workflows that did not pass or could not run, in the batch’s order: workflow (its name), outcome (a short phrase for people, such as Failed, Not found, Needs a change, Can't run; show it, don’t branch on it), step (the sentence of the step it stopped at, when there is one), why (what that step found, in a sentence), url (the run’s page, or the workflow’s when it could not run), and change (stopped_passing, still_not_passing, or new when the workflow has no earlier result; left out when the workflow could not run or its run has no result to compare).
more number How many more did not pass than are listed.

The body only ever gains members. A member is never renamed, removed, or given another type within version 1, so ignore members you don’t know rather than refusing them. A change that is not an addition would be a new version, announced first.

Belay signs as the Standard Webhooks specification says, so any of its libraries verifies a Belay webhook with the secret you copied: standardwebhooks for JavaScript, Python, Go, Java, Ruby, PHP, Rust, C#, and others (the list). Pass it the raw body exactly as received, before any JSON parsing, and the three headers.

import { Webhook } from "standardwebhooks";
const wh = new Webhook(process.env.BELAY_WEBHOOK_SECRET); // "whsec_..."
const event = wh.verify(rawBody, request.headers); // throws if the signature or the timestamp is wrong

To check by hand:

  1. Take the secret after whsec_ and base64-decode it: those bytes are the key.
  2. Build the signed content: webhook-id, a full stop, webhook-timestamp, a full stop, and the raw body’s bytes.
  3. Compute HMAC-SHA256 of the content under the key, and base64-encode it.
  4. Compare it, in constant time, with the part after v1, in webhook-signature. The header may one day hold more than one signature, separated by spaces; accept the request when any v1 one matches.
  5. Refuse a webhook-timestamp more than five minutes from your clock, so an old request replayed later is refused.
  • Answer with any 2xx status within ten seconds, and the message is received. Do slow work after answering.
  • A 408, a 429, a 5xx, a connection that fails, or no answer within ten seconds is tried again, after 1, 5, 15, and 60 minutes, then every hour, until six hours after the first try. Each try has the same webhook-id and body, and its own timestamp and signature.
  • Any other answer (a 3xx, a 400, a 401, a 404, a 410, …) ends it: the message is not sent again, and the Notifications page and the batch’s page say what your endpoint answered. Belay does not follow redirects, so give the address that answers.
  • Because a message can arrive again after your endpoint handled it (your answer was lost on the way back, say), use webhook-id to handle each message once.
  • While a message waits for its next try, the Notifications page and the batch’s page say what the last try met, such as “The endpoint answered 500.”, and the Notifications page says when the next try is.

The Notifications page shows each webhook’s last message as it was sent: Show, in its Message row, opens the body and the webhook-id it went with. The body is indented there, and not on the wire. After Send a test it is the test event’s body; after a schedule’s batch, the batch_finished one.

Under the form that adds a destination, Message format is a short form of this page: the events, the headers, an example body, the rules a body keeps, how to verify a message, and what each answer does. Its example body is built by the same code that builds the real ones.

  • It must be https, and reachable from the internet: Belay does not send to a private, loopback, or link-local address, and refuses one when the webhook is added and again when it sends.
  • Leave any name and password out of the address; check the signature instead.