Skip to main content

Catalogue sync

The event table must mirror the generated catalogue before subscribers can pick events. Two mechanisms keep it that way: Verify with:
missing_internals lists events present in code but not yet in the database; stale_internals lists database rows no route produces anymore (they stay subscribable until an operator deactivates them). The sync also carries a rename: an event whose name changed is found by its method and route and renamed in place, so the webhooks subscribed to it stay subscribed under the new name. System events have no method or route and are matched by name. Events of routes that left the catalogue are deactivated.

Test deliveries

Test any event your webhook subscribes to before a real one happens. Each test delivery has the exact structure of a real one with generated data that respects real values: valid Chilean RUTs, amounts in CLP, consistent dates and the same catalogue codes (status, currency, billing_cycle…) production sends, in the state the event names (payment-intent.authorized arrives with status: "authorized").
  • In Horizon Enterprise, Send test on the webhook detail opens the test console: pick a subscribed event, review the exact body and headers, Regenerate data or copy the body, then send it, or Send all to queue one test per subscribed event (up to 100).
  • Through the API:
The response carries dispatch_id and dispatch_ids; follow them on GET /api/v3/webhook/dispatch/{dispatch_id} or in Deliveries, where test deliveries show a Test tag and can be filtered. How to recognise one: the body has "test": true (real deliveries carry "test": false) and the request has the header x-bbrands-test: 1. The signature is computed exactly as for a real delivery.
  • data.object has the keys of the real object. An event whose real deliveries carry data.object: null keeps it null in the test too.
  • data.account is the real owner on an account-scoped webhook (the console masks its document; the delivery includes it over HTTPS, as a real one does) and a generated owner on a global webhook. An event with no owner has data.account: null.
  • Ids are new UUIDs on every test: never act on them against the API.
  • A test delivery is posted once. If your endpoint fails, it stays in error until you replay it; it never counts toward the automatic disable and stays out of the dashboard counters.
Test deliveries reach production endpoints too. Check test (or the x-bbrands-test header) and skip business side effects for test events.

Development sink

POST /api/v3/webhook/sink is a built-in subscriber endpoint mounted only when APP_ENV is development or certification and WEBHOOK_SINK_SECRET is set. It verifies the signature with that secret, logs Webhook sink delivery accepted with the event, the delivery id and a summary of the shape of the body, and answers 200 with the same summary, so a dispatch row flips to success without any external system. The summary holds key names and booleans, never a value of the body.
1

Create a webhook pointing at the sink

url = https://<api host>/api/v3/webhook/sink, is_global = true. Copy the returned whsec_… secret.
2

Share the secret with the API

Set WEBHOOK_SINK_SECRET to that value in the tier’s environment and redeploy (or restart locally).
3

Send a test

POST /api/v3/webhook/webhook/{id}/test, then check the dispatch row and the API logs.
Production never mounts the sink: the route answers 404 there regardless of the variable.

Verify a delivery with the sink

The sink proves that an event is published, scoped to the right owner and delivered with a valid signature and the 2026-11-15 body. It never logs or echoes the body, because the body carries the identity document of the owner. You inspect two things: the shape summary the sink logs, and the ledger row.
1

Subscribe the sink webhook to the event

Use an account-scoped webhook (is_global = false, account = a test account) to check owner resolution, or a global one to check an event with no owner. Add the events with PUT /api/v3/webhook/webhook/{id}/events.
2

Cause the event

Call the route (a PATCH, a delete, a purge, an action), or trigger the fact in the provider sandbox for a system event such as payment-intent.authorized. Publishing must be on (platform-webhook-out-publishing); a new subscription can take up to 30 seconds to be seen.
3

Read the ledger row

GET /api/v3/webhook/dispatch?filters=webhook|eq|{id}&order_by=created_at:desc. The row must reach status = success and show:
  • account — the owner that was resolved (the test account);
  • resource_id and resource_type — the record of the event;
  • payload.object — the data.object that was delivered;
  • payload.account_snapshot — type, country and document type of the owner, and no dni;
  • payload.route — null for a system event;
  • source_event_id — webhook-out:<event>:<record id> for a system event.
4

Check idempotency of a system event

Redeliver the same queue message or provider notification. The ledger must still hold one row for that webhook and source_event_id.
5

Check the logs

The API log shows Webhook sink delivery accepted with the event, the delivery id and shape. For a test account with a Chilean RUT expect the five account_keys, dni_present: true, dni_matches_rut_format: true and type_dni_internal: "CHL_RUT"; for a system event, route_is_null: true; for a resource type with an object, its object_keys. Then search the same window for the identity document of the test account: it must not appear.
To look at the values of a delivered body, including data.account.dni, point a second webhook at an HTTPS endpoint you control. An http:// endpoint (development only) receives the same body with dni: null.

Dashboard and health

Environment variables

The signature tolerance (300 s), the backoff schedule, the attempt cap (5) and the auto-disable threshold (20) are code constants in lib/webhook/outbound/webhook-out.constants.ts and webhook-signature.ts, not environment variables — they are part of the public contract and change only with a release.

Permissions

All webhook permissions are granted to the administrator role only in this release. Tokens for automation must carry the specific internals:

Known limits

  • No fixed egress IP. Deliveries originate from the API’s serverless runtime; allow-list by signature, not by address.
  • The body is personal data. It names the owning account with its identity document. It is delivered over HTTPS only and never stored in the ledger or the logs of the platform; handle it the same way on your side.
  • data.object is not live. It is the record when the event was routed, and it is null for resource types without an object and on *.purged. Read the API when you need the latest state.
  • data.account is live. It is read on every attempt, so a retry or a replay shows the owner as it is at that moment.
  • System events are at most once per fact. There is no outbox: an event is lost if the process stops between the change and its publication. Reconcile critical flows through the API.
  • A fact can produce two events. When it can also happen through the REST API you receive the route event and the system event if you subscribed to both.
  • At-least-once per delivery. Retries and replays may repeat a delivery; deduplicate on id.
  • No ordering guarantee across events, even for the same resource.
  • Secret rotation has no overlap window.
  • Purge events carry the id of the record and its owner, and reach the owner’s webhook like any other event; data.object is null because the record is gone. Reading the owner can add up to 1.5 seconds to a purge while a webhook is subscribed to it.
  • Records with no owner (reference data, platform configuration, batch triggers, internal staff records) carry data.account = null and only reach global subscribers.
  • Internal runbook for the first rollout (per-tier steps, rollback, day-2 signals): docs/initiatives/webhook/outbound/11-rollout-and-operations.md in the monorepo.
  • API reference: Webhook, Webhook Event, Webhook Dispatch, Event.