Skip to main content
Brussle pushes each event, signed, to an HTTPS URL of yours as a POST request, so your system learns when an answer changes without polling. Events include a document entering or leaving a subscription, a job finishing, judging pausing at a budget, a fan-out deferred past a judgment’s rolling limit, a tenant summary that could not be written, an engine changing its behaviour, the fit that a judgment with features reads changing, and an alternatives run waiting for your confirm or finding a better alternative. The events feed lists each type and when Brussle sends it. Your endpoint receives each event as signed JSON, so you can check that a request came from Brussle. Brussle retries when your endpoint is slow or down. Each event is also in the events feed, for receivers that prefer to pull.

Set up an endpoint

Create an endpoint with its URL and the platform events it receives, given as patterns (job.* or namespace.budget_paused, for example). A subscription names its own endpoint, so an endpoint with no events receives only what its subscriptions send to it.
  • The secret. Brussle returns the secret when you create the endpoint and when you rotate the secret, and keeps it encrypted. A read_write key that manages the endpoint can read the secret again with a get, but lists and PATCH responses never show it.
  • namespace_prefix limits the endpoint to the events of namespaces under the prefix (acme/staging/ for a staging receiver, for example). It takes the same forms as a key scope: *, a prefix such as acme/staging/, acme/*, or one namespace. The default is your key’s scope, and a prefix outside your key’s scope is forbidden. A key scoped to a prefix sees and manages only the endpoints inside its scope.
  • events are platform event types or patterns (job.*, for example). Brussle refuses a pattern that matches only subscription events or webhook.test, because a subscription names its own endpoint.
  • description has a maximum of 256 characters.
  • max_per_second sets a maximum delivery rate (see retries).
  • A get shows:
    • the endpoint’s status: active, failing or disabled
    • failing_since
    • previous_secret_expires_at, during a rotation
    • stats: deliveries_24h (the deliveries whose latest attempt was in the last day), success_rate_24h and last_delivery_at
  • A delete removes the endpoint’s pending deliveries and its log, so the subscriptions that name the endpoint then send their events only to the events feed.
  • A retry with an Idempotency-Key is safe. If you send a create, a rotation, a recover or a redeliver again with the same key, you get the result of the first request and nothing changes again (for a create or a rotation, the result includes the secret that the first request made). The other endpoint requests are safe to send again without a key (see idempotency keys).
  • A test send delivers webhook.test to this endpoint only, or a sample of an event type when you give type. Both have "test": true, and the feed never lists them.
  • How many. Developer has 2 endpoints, Team has 20 and Scale has 100 (pricing). Brussle refuses one more with plan_required, and its details name the plan that allows more. After a downgrade, endpoints over the new limit continue to deliver. Brussle never bills deliveries.
  • unavailable (503) means Brussle cannot make a secret for a create or a rotation now. Nothing changed, so send the request again.

Manage endpoints in the dashboard

You can do all of this in the dashboard too. Admins and owners make changes, and every member can look.
  • Webhooks lists your endpoints with their status, namespaces, last delivery and deliveries of the last day, and shows how many endpoints your plan allows. When you create an endpoint, the page shows its secret one time, with a copy button. Copy the secret then, because the dashboard never shows it again. At your plan’s limit, the page offers the plan with more endpoints.
  • An endpoint’s page lets you:
    • rotate the secret, and choose how long the old secret continues to sign
    • send a test event of any type
    • disable and enable the endpoint
    • delete the endpoint
  • The delivery log on the endpoint’s page shows the status, attempts, response code, latency and next retry of each delivery, and you can filter it by status. Each row has Redeliver, and Recover since… queues again each delivery that failed or was skipped since a time.
  • A namespace’s Subscriptions tab lists its subscriptions and creates them. On the Documents tab, Subscribe to this filter opens the create form with the query’s filter in it, or tells you why you cannot subscribe to the filter. A template’s page lists and creates the template’s subscriptions.
  • Events is the feed, oldest events first, which you can filter by type and namespace prefix. It opens the JSON of each event and its deliveries.

What your endpoint receives

Each delivery is one event as JSON, signed with your endpoint’s secret, with headers that follow the Standard Webhooks specification:
  • webhook-id is the event’s id. Each retry, redelivery and replay of an event has the same webhook-id, so use it to remove duplicates.
  • webhook-timestamp is the time Brussle signed this attempt, in Unix seconds.
  • webhook-signature is v1, followed by a base64 HMAC-SHA256. During a secret rotation, it holds two signatures, separated by a space.
  • user-agent names Brussle and links to this page.
  • The body is at most 64 KB. When the full body of a subscription event would be more than 63 KB, Brussle leaves out its attributes and answers and sets truncated to true, and you use url with your own key to get the rest.

Verify the signature

Check each delivery before you trust it. The SDKs do the check in one call:
  • TypeScript: verifyWebhook(payload, headers, secret)
  • Python: verify_webhook(payload, headers, secret)
The call:
  • checks the signature and the timestamp
  • accepts either signature during a rotation
  • compares in constant time
  • returns the event, typed by its type
The Python call needs only the SDK, and the TypeScript call needs only WebCrypto, so it also runs on edge runtimes.
  • A request that fails a check raises WebhookVerificationError, whose reason is headers, timestamp or signature. Answer the request with 400.
  • secret can be a list.
  • You can change the timestamp tolerance (tolerance in Python, toleranceSeconds in TypeScript).
  • An empty or malformed secret, or an empty list, is a bug in your code rather than a bad request. The call raises an ordinary error instead of WebhookVerificationError before it checks the request, and never verifies anything.
SDKs has Express and FastAPI versions, and shows how to narrow the event by its type. You can also verify a delivery without the SDK. The check is the Standard Webhooks check, so any Standard Webhooks library can verify Brussle’s deliveries. To write the check yourself:
  1. Read the body as raw bytes, before any JSON parsing.
  2. Refuse a webhook-timestamp more than 5 minutes from your clock, so that nobody can replay a captured request later.
  3. Take the bytes of the secret after whsec_ and base64-decode them to get the key.
  4. Calculate the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body} with that key.
  5. Compare the result, in constant time, with each v1, entry in webhook-signature (one entry for each signing secret, separated by spaces).
  6. Accept the request if the result is equal to one of the entries.

Rotate the secret

When you rotate an endpoint’s secret, Brussle returns the new secret, and the old secret continues to sign beside the new one for previous_valid_for:
  • The default is 24 hours.
  • The maximum is 7 days.
  • 0s ends the old secret immediately.
Each delivery has both signatures while both secrets are valid, so you can deploy the new secret to your receiver at any time in that period. At most two secrets sign at the same time, so if you rotate again during the period, the older secret ends immediately.

Answer 2xx, fast

A delivery succeeds when your endpoint answers with any 2xx status within 15 seconds, of which the connection can use at most 5 seconds. Every other result is a failure (a timeout, a refused connection, a TLS error or any other status), and Brussle sends the delivery again. A 3xx status is also a failure, because Brussle does not follow redirects.
  • Queue the work, then answer. Store the event or push it onto your own queue, then return 200 before you do slow work, since a receiver that does its work before it answers is the usual cause of timeouts and duplicate deliveries.
  • Remove duplicates by webhook-id. Brussle delivers each event at least once, so if your 2xx response is lost (because of a timeout, for example), Brussle sends the event again.
  • Do not rely on the order. A retried event can arrive after a later event. subscription.entered and subscription.exited events have sequence, which increases with each change in the namespace, so for one subscription and one document you keep the highest sequence you saw.
The endpoint’s delivery log keeps the first 1 KB of your response, the status code and the latency. On a failure, it also keeps the reason: timeout, dns, tls, connect, blocked_address or http_status.

Retries

Brussle sends a failed delivery again on this schedule: The schedule makes 9 attempts in about 3 days. Each wait can change by up to 20% in either direction, so the retries from one outage do not all arrive at the same time. After the ninth attempt, the delivery is failed and stays in the delivery log for 30 days, and you can send it again from the dashboard or with the API:
  • The delivery log. GET /webhook-endpoints/{id}/deliveries lists deliveries, newest first, 100 on each page, and you can filter them by status (pending, succeeded, failed or skipped). For each delivery, it shows:
    • its event’s id and type
    • its number of attempts
    • next_attempt_at, while it waits for a retry
    • the time, status code, latency, error and first 1 KB of response of its latest attempt
    The log keeps only the latest attempt of each delivery.
  • Redeliver one event. POST /events/{id}/redeliver with the endpoint queues a new delivery with the same webhook-id, whatever happened to the earlier deliveries. The endpoint must include the event’s namespace, and a test send goes again only to the endpoint it tested.
  • Recover since a time. POST /webhook-endpoints/{id}/recover with since queues again each failed or skipped delivery to the endpoint since that time. It goes back at most 30 days, so an older since counts as 30 days ago. Each delivery gets its full retry schedule again, and the response tells how many deliveries it queued. Brussle resets each delivery in place, so its earlier attempts leave the log and a second call queues nothing twice.
  • A disabled endpoint refuses redeliver and recover with conflict, so enable the endpoint first.
You can slow Brussle down. Answer 429 or 503 with a Retry-After header (in seconds or as an HTTP date), and Brussle pauses all deliveries to that endpoint for that time, up to 5 minutes. Brussle also waits at least that time before it sends that delivery again, up to the next step in the schedule. Without Retry-After, the pause is 5 seconds. Brussle never has more than 16 deliveries in progress to one endpoint. An endpoint can also set max_per_second to limit its rate, to any positive number (0.5 for one delivery every 2 seconds, for example), and null removes the limit.

Failing and disabled endpoints

Brussle counts both states from the first failed attempt after the endpoint’s last success, and checks them at each attempt.
  • Failing. An endpoint becomes failing when nothing reached it for 24 hours and at least 10 attempts failed. Your organization’s owners and admins get an email, and deliveries and retries continue.
  • Disabled. After 5 days with no successful delivery, the endpoint becomes disabled, even if it was not failing first, and the owners and admins get an email. Brussle sends nothing more to the endpoint, and its pending deliveries become skipped. Brussle still records new events and the events feed lists them, so you lose nothing.
  • Active again. Any successful delivery makes a failing endpoint active again.
To make a disabled endpoint active again:
  1. Fix the receiver.
  2. Enable the endpoint with PATCH /webhook-endpoints/{id} and {"enabled": true}, which also clears its failure count.
  3. Recover the deliveries it missed since it started to fail.
To disable an endpoint yourself, send {"enabled": false}.

Allow our egress address

Each delivery comes from a fixed address, so you can allow it in a firewall:
  • 35.225.20.104
We publish this address as a list, so a new address for a new region is not a breaking change. Allow each address in the list.

HTTPS only

An endpoint URL must:
  • start with https://
  • have a certificate from a public certificate authority
  • have no user name or password in it
Brussle resolves the host before each new connection. If any of its addresses is not public, Brussle does not send, and the delivery fails with blocked_address. Addresses that are not public include:
  • loopback
  • RFC 1918
  • carrier-grade NAT
  • link-local
  • multicast
  • the other reserved ranges
  • the IPv6 equivalents of these ranges
  • IPv6 addresses that contain a private IPv4 address
Brussle then connects to the address it checked, so an endpoint cannot use DNS to point Brussle at your internal network, or at ours. Brussle looks up each name as written and never adds a local domain to it. When you create or update an endpoint, Brussle refuses a URL whose host is clearly private with invalid_request. These hosts include an address in the ranges above, localhost, a name with no dot, and a name under a private-use suffix (.internal, .local or .home.arpa, for example). The delivery log says only that a host is not public, and never shows the address the host resolved to.

Pull instead of push

Each event is also in the events feed (GET /events) for 30 days, in the order Brussle recorded it.
  • A receiver that was down can read the feed from the last event it handled, without waiting for retries. An event’s id works as a cursor, and it is also the webhook-id of the event’s deliveries.
  • A receiver that cannot accept requests from outside can poll the feed, and needs no endpoint.