@bijectionhq/app-webhooks to publish public events to registered
HTTPS receivers. Each endpoint has its own signing key. For an external
effect that needs durable acceptance or exclusion, use the fixed
strict HTTPS receiver.
To publish from a transactional event log, install a
public event follower and use
toWebhooks with the mounted entry. It keeps the event’s minted ID as
the Webhooks publication key.
Install outbound delivery
app.ts
webhooks(settings) returns the app to place at a path of your tree.
Your code reaches only the exported functions of the apps it mounts, so
events.publish allows the roles you pass in publishers: your caller’s
clerk grant admits the call. access.grantOperator and access.revoke
allow those you pass in administrators.
Your admin role includes the mount’s operator role and carries issue: true,
so an admin grants it with ctx.grant, a grave act bijection check lists for addOperator. A holder of the mount’s operator role calls
webhooks.endpoints.register({ endpoint, url, events }), then seals the
endpoint’s whsec_ signing key with webhooks.endpoints.rotate, called under
the label identified by the opaque member from register or get.
Until then its attempts refuse
SigningKeyMissing. The URL must use a public hostname over HTTPS on port
443. Verify the webhook-id, webhook-timestamp and webhook-signature
headers with a Standard Webhooks verifier. See the
Webhooks package API.
Public event data and a stable (type, key) identify a publication.
Retries can reach the receiver more than once, so deduplicate using the
envelope’s idempotency_key. There are at most 64 endpoints per event
type and 64 types per endpoint. The default retry policy allows eight
attempts. A single delivery with a continuation has a deadline of at most three
days. Retirement fences deliveries under the old endpoint revision and
retains the key’s revision record. Endpoint listing uses a page cursor
with up to 64 results. Delivery exposes no event stream cursor.
Receiver delivery
HTTP sends carryBijection-Fencing-Token and the stable idempotency key.
Use the key to deduplicate effects at the receiver. The default header is
Idempotency-Key. For a command whose reply can be lost, expose a separate
read-only operation that reports the original attempt’s result. See
Reconcile external results.
A receiver of a request carrying closable units declares requests: { erase }
or requests: { retain, message }. The named erase operation is a fixed
HTTP POST or DELETE. It receives { disclosures: string[] } and confirms
deletion of those copies. A retention declaration records the finite duration
the provider accepts and the reviewed reason for relying on it.
Wake a REST source from a provider webhook
The REST mount carries verified notification routes of its own: itswakes
subtree, built with webhookWakes from @bijectionhq/app-webhooks/wake.
Each provider has a route.post("/webhooks/<provider>", providerVerifier) reaction under the
mount’s data label, and the mount declares each provider’s verifying
secret at <mount>.wakes.secrets.<provider>. No separate Webhooks mount is
needed for incoming notifications.
For a REST mount at source, configure the provider to send HTTPS POSTs to
/source/webhooks/<provider> and set that provider’s secret, bound to the
mount’s route as the mount declares it. The following command reads the
Stripe signing secret from piped stdin.
HubSpot requires a v3 signature and a fixed route URL without query parameters
or percent escapes. Slack signs its Events API verification request. The
route answers the bounded URL verification challenge separately from wakes.
Signed timestamps must be within five minutes. The HTTP site accepts up to
128 KiB of notification bytes per request.
The verified request can bring forward the next poll for the matching
provider on that mount. It changes a due time or records one pending wake
during an existing poll. The source respects its active state, pause,
continuity gaps and failure backoff. Each poll reads from the same retained
position and lands data using the same record, edge or event keys.
Notification bodies, provider IDs and cursors never enter the guest, and
requests with repeated signatures can only schedule more polling. Ordinary
polls continue on schedule when notifications are missed. Each source’s
polling scope, visibility delays, deletion rules and retention still apply.