Webhooks from Stripe and GitHub
Another service's events — Stripe's payments, GitHub's pushes, the events of any sender signing as Standard Webhooks does — taken by a statement, with no code of your own between the sender and the rows.
A statement defined on hook <name> takes the events
sent to POST /_hooks/<name>. The server checks each
event's signature before it reads anything of it, binds the values the
statement names from the event's body to typed parameters, and runs the
statement. The writes and the event's key land as one block, so a sender's
retry, a duplicate delivery and a crash between the write and its answer
never take one event twice. The sender is told 200 only once
the event is on disk.
Webhooks are taken by a file's server (fennec-server --file)
given a hooks file (--hooks), and by
each tenant of a node of tenants at
POST /t/<tenant>/_hooks/<name>, its secrets set
through the admin routes. For reacting to a write of your own — calling a
URL when a row changes — see Functions and
webhooks.
A payment from Stripe
An order is paid when Stripe says its payment intent succeeded. Put the endpoint's signing secret in a file only the server's user reads, and name it in a hooks file:
# /etc/fennec/hooks: a hook a line
stripe stripe /run/secrets/stripe-livefennec-server --file shop.fennec --http 0.0.0.0:8080 \
--http-token "$TOKEN" --hooks /etc/fennec/hooksThen define the statement that takes the hook's events, with the server's token:
create statement stripe_paid(
$intent text from event.data.object.id,
$order text from event.data.object.metadata.order,
$amount int from event.data.object.amount_received,
$paid timestamp from hook.at)
on hook stripe
where event.type = 'payment_intent.succeeded' and event.livemode = true
as set orders {status: 'paid', intent: $intent, amount: $amount, paid_at: $paid}
where ref = $order and (status = 'open' or intent = $intent)
require 1 else 'no open order for this payment yet'In Stripe's Dashboard, add an event destination: a webhook endpoint at
https://db.example.com/_hooks/stripe, the events
payment_intent.succeeded, and the Snapshot
payload style. A thin event carries no data.object; fennecdb
never calls Stripe's API to fetch it, so a statement reading
data.object.* refuses a thin event with a 400 naming the
path, which shows in Stripe's delivery log.
Three things in that statement are Stripe's, and worth copying:
- A mode is a hook. Test mode and live mode sign with
secrets of their own at endpoints of their own: name a hook for each
(
stripe,stripe_test), and have the live hook's statements readevent.livemode = true, so a test secret set on the live hook by mistake writes nothing. - Its guard is idempotent by the object's id. Stripe may
send two events for one change, each with an
idof its own, so both are taken.status = 'open' or intent = $intenttakes the second as a write over the row it already paid; a guard ofstatus = 'open'alone would refuse it (412) for the three days Stripe retries. Aput ... if absentover a@uniquefield holding the object's id is the other way. requiresays not yet. Stripe does not promise to deliver events in order: a payment may come before the order's row. The guard refuses it (412, itsreasonin Stripe's log), and Stripe sends it again until the row is there. Awherewith norequirewould take it as a write of no row and answer 200, and Stripe would never send it again.
Stripe's times are seconds since 1970. A timestamp
parameter reads a number as milliseconds, so $created timestamp from
event.created would be an instant in January 1970. Read it as an
int and multiply:
create collection refunds (charge text @unique, at timestamp)
create statement stripe_refunded(
$charge text from event.data.object.id,
$created int from event.created)
on hook stripe
where event.type = 'charge.refunded'
as put refunds {charge: $charge, at: $created * 1000} if absenthook.at, the time the signature covers, is a
timestamp already.
Pushes from GitHub
github github /run/secrets/github-webhookGitHub takes whatever secret you type: make it long enough not to be
guessed from one event it signed, openssl rand -hex 32 >
/run/secrets/github-webhook. A secret shorter than 32 bytes is taken,
and warned of.
create statement pushed(
$repo text from event.repository.full_name,
$branch text from event.ref,
$sha text from event.after,
$kind text from hook.event)
on hook github
where hook.event = 'push'
as insert pushes {repo: $repo, branch: $branch, sha: $sha, kind: $kind}In the repository's or organization's settings, add a webhook: the
payload URL https://db.example.com/_hooks/github, the content
type application/json (GitHub's default,
application/x-www-form-urlencoded, is refused 415 with the
type to set), the secret in the file, and the events to send.
hook.event is GitHub's X-GitHub-Event header; a
condition reads it beside the body. GitHub sends a ping when a
webhook is made: no condition takes it, so it is answered
200, {"taken":0}, and nothing is written.
GitHub's signature covers the body alone, not
X-GitHub-Event. Whoever holds one signed body can send it
again under another event's name: the copy is answered from its key while
it is kept, and taken again once keep has passed. A condition
on hook.event alone can then take an event its statement was
never meant for. Write the
condition on fields of the signed body as well, which tell one kind of
event from another — event.ref for a push,
event.action for a pull request: where hook.event =
'push' and event.ref = 'refs/heads/main'.
GitHub's signature covers the body alone, so an event's key is its
body's SHA-256. A copy of the body is taken once, whatever headers it comes
with — another X-GitHub-Delivery, another
X-GitHub-Event — while its key is kept, and a redelivery from
GitHub's log is answered from it. Two events whose bodies are the same
byte for byte are one: a repository_dispatch or
workflow_dispatch sent twice with one payload, the repository
unchanged between them, is taken once. Give each dispatch an id of its own,
in client_payload or the workflow's inputs.
key delivery, which 0.2.0 took, is refused at the start,
and a tenant's hook naming it at its PUT (400): GitHub does
not sign X-GitHub-Delivery, so whoever held one signed body
could send it again under a new delivery id and have it taken again.
Remove it from the line (key body may stay). GitHub signs no
time either: once keep (7 days unless the line says
otherwise) has passed, a captured body can be sent again and is taken
again. Where that matters, keep keys longer (keep 90d).
A tenant's hook set with key delivery
before the upgrade is kept, not lost: its node reads the tenant's set as
it was, every secret in it, and the tenant's other hooks go on taking
their events. That hook's events are refused: one whose signature
verifies is answered 409, saying to set the hook again with
key body, and runs nothing; a forged one is the
401 any forged event is. The node logs each such hook as it
starts, and again as its tenant opens where a statement takes it. Its
set's listing, GET
/_shard/tenants/<tenant>/hooks, says
"key":"delivery", the secret being held; statements,
describe statement and /_schema list each
statement taking it "armed":false, as its events are not
taken, and fennec studio not armed. Set it again
with the same secret and key body, or no key,
and redeliver from GitHub's log what was refused meanwhile:
curl -X PUT https://router.example.com/_shard/tenants/acme/hooks/pushes \
-H "Authorization: Bearer $ROUTER_TOKEN" \
-d '{"scheme": "github", "secrets": ["..."], "key": "body"}'Until then the set moves, fails over and is copied with its tenant as it was. An event taken before under its delivery id is keyed by its body from then on, so a redelivery of one taken before the upgrade is taken once more.
Any sender of Standard Webhooks
Senders that sign as Standard
Webhooks says — Svix and the services that send through it, among them
Clerk and Resend — take the scheme standard. Their headers are
webhook-id, webhook-timestamp and
webhook-signature, or Svix's names for the same three,
svix-id, svix-timestamp and
svix-signature, which Clerk and Resend send; an event carrying
both sets is refused. Its secret file holds the secret as the sender shows
it, whsec_ and base64; a file holding anything else is refused
at the start.
clerk standard /run/secrets/clerk-webhookcreate collection users (clerk_id text @unique, email text)
create statement user_created(
$id text from event.data.id,
$email text from event.data.email_addresses."0".email_address)
on hook clerk
where event.type = 'user.created'
as put users {clerk_id: $id, email: $email} if absentAn event's key is its webhook-id (or
svix-id). "0" is the
first element of a list: a key of digits reads a list by its place, and a
key that is no word, such as "order-id", is quoted.
The hooks file
A line a hook, read once as the server starts; # starts a
comment. Anything wrong is refused at the start, naming the line and what
to write, never the secret's value.
<name> <scheme> <secret file> [<secret file>] [keep <d>] [tolerance <d>] [key body] [max-body <size>]| Part | What it says |
|---|---|
| name | the path's last segment, /_hooks/<name>, and what a statement's on hook names: a word, as a statement's name is |
| scheme | stripe (Stripe-Signature), github (X-Hub-Signature-256) or standard (webhook-id, webhook-timestamp, webhook-signature, or Svix's svix-id, svix-timestamp, svix-signature) |
| secret files | one, or two while a secret rolls: an event verifies under either. The file's trailing newline is not the secret's. An empty file is refused: it would make every signature anyone can compute verify. One shorter than 32 bytes as written is taken, and warned of: at the start where --http is past loopback (a token that short is refused there: token length), and on loopback at the first request a proxy or a router sends, as a short token is (behind a proxy) |
keep | how long an event's key is kept: 30 days for stripe (Stripe retries for three), 7 for the others. A day at least, and more than twice the tolerance and a minute |
tolerance | how far the signed time may be from the server's clock either way: 5 minutes, Stripe's libraries' default; from a second to an hour. github signs no time, and is held to none |
key | github alone, and body alone: an event is keyed by its body, which its signature covers. delivery is refused (above); a tenant's hook set with it before is kept, its events refused (above) |
max-body | the largest body taken: 1 MiB unless given (64k, 4m), or the server's --max-body where that is lower; at most --max-body |
The secrets are the deployment's, as the server's token is: never in the
database, an archive, a log line, a trace or an answer. A server with no
hooks file has no /_hooks/ route: a request there asks for a
token as any unknown path does. A secret changes at a restart: name the
new one second, restart, change it at the sender, then drop the old one at
the next restart.
The server says at its start what does not meet: a hook of the file no statement takes (its events answered 409), and a statement taking a hook the file does not name (its events answered 401). Each is a line of its log.
On a node of tenants
Each tenant of a node (fennec-server --dir) takes its own
events at POST /t/<tenant>/_hooks/<name>, verified
against that tenant's secrets alone: one tenant's secret signs no event
another takes. Behind the router and
the global entry, the sender is told
https://<entry>/t/acme/_hooks/stripe. A node takes no
hooks file: a tenant's secrets are set through the admin routes, with the
same parts as a hooks file's line, the secrets' values in place of their
files.
curl -X PUT https://router.example.com/_shard/tenants/acme/hooks/stripe \
-H "Authorization: Bearer $ROUTER_TOKEN" \
-d '{"scheme": "stripe", "secrets": ["whsec_..."], "tolerance": "5m"}'
{"tenant":"acme","hook":"stripe","version":"9c1f04e2b7a35d60","behind":[]}| Field | What it says |
|---|---|
scheme | stripe, github or standard |
secrets | one, or two while a secret rolls; an empty one, or a standard one not whsec_ and base64, refused (400) naming the field, never its value; one shorter than 32 bytes taken, and said in the node's log, naming the tenant and the hook |
keep, tolerance, key, max_body | as in a hooks file, held to the same bounds |
A PUT sets one hook and a DELETE takes it away;
GET /_shard/tenants/<tenant>/hooks lists each hook's
scheme, bounds and when it was set — never a secret. A tenant's set lives
beside its file on its node, in <tenant>.hooks, readable
by the node's user alone (mode 0600, on Windows an ACL granting
that user alone), and never in the database, its archive or the
router's directory, which keeps each tenant's hook names and a version.
The router sends the set to every copy a failover could promote — a pair's
standby and the tenant's --replicas copy — before it answers:
a copy that did not take it is named in behind and counted
until the router's repair copies it, which also asks each copy the
version it holds and finds one that lost its set unseen. A move takes the
set to the target before the tenant goes there, across regions too, router
to router as plainly as their link carries it (give region routers
https:// URLs); a failover's promoted copy holds it already.
A PUT while the tenant moves is refused (409): send it again
once the move is done. A tenant holds 64 hooks at most, its set 32 KiB
written out. Without the router, a node's own PUT
/_admin/tenants/<tenant>/hooks/<name> takes the same
body, with the node's admin token, refused (409) while the tenant is
frozen for a move.
A tenant's set belongs to its file. Its <tenant>.hooks
goes with the file at a delete, and a create, a follow or a restore of the
tenant puts away a set left beside the place, so a set never arms a later
tenant of the name. The set names its file by device and inode, and by its
birth time where the node that wrote the set and the node reading it both
read one: a node moved between a release's Linux binary, which reads none,
and a build of your own keeps its tenants' sets. A set the node has set aside (below)
is not its set and stays. A restore brings the statements back and no secret:
the tenant's hooks are answered 401 until their secrets are set again —
one put in place under a running node too, whose set in memory the
tenant's next open puts away, an event verified against it before that
answered 401 — which the node logs as the tenant opens
(tenant `acme`'s hook `stripe`: consumed by 1 statement, no
secret). On Windows, a fennec restore,
unseal or backup --force over a tenant's file run
by another account than the node's must be able to delete
<tenant>.hooks, whose ACL grants the node's user alone:
it needs Full Control of the folder (a folder's Modify does not let a file
the folder's rules do not reach be deleted) or the node's account, and is
refused otherwise, where on Linux and macOS the folder's write permission
is enough.
A set the node cannot read as it starts is set aside,
never removed: the router keeps no copy of a secret, so the file may hold
the only one. That is a <tenant>.hooks cut short or
changed by hand, one a later version wrote, met after a downgrade, and one
whose tenant's file the node could not look at for another reason than
its not being there — a directory on its way the node may not search, an
I/O error. Only a tenant's file that is not there makes its set one to put
away. The node renames the set to <tenant>.hooks.unread
(.unread.2 and on where one is there), never writing over one,
and logs where (tenant `acme`'s hook secrets ...: set aside as
.../acme.hooks.unread, which nothing reads); the tenant's hooks are
answered 401 until they are set again, and a PUT writes a set
of its own beside it. The file holds the secrets, mode 0600 as
the set's (on Windows the same ACL). Nothing reads it, so it arms nothing,
and nothing of fennecdb removes it: it stays through a delete of the
tenant and a create of one of its name, and on the node a move takes the
tenant off, where it is not carried. Read the secrets from it, set the
hooks again through the router, and remove it by hand.
An event is verified against the secrets in the node's memory before its tenant is looked up, so a forged one opens no tenant. A verified one is held to its tenant's quota and its node's lease as any write is (below). The router and the global entry send an event again on another connection, or to the next router, where one was cut after it was sent: the node takes it once by its key and answers the second try from it.
Taken once
An event's key is id in a Stripe event's body,
webhook-id (or svix-id) for a Standard Webhooks
sender, and for GitHub what
its hook's key says. The key is kept in
_hook_events for the hook's keep, in the same
block as the statements' writes. A copy of the event while its key is kept
— a retry, a duplicate delivery, Stripe sending again after a slow answer
— runs nothing and is answered as the first was, marked
Idempotent-Replayed: true, once the first's block is as
durable as its answer was to be. A second body under a key that is kept
is answered the same, never run, and logged.
The keys cost a little of the file: a row an event, given back by compaction once its keep
has passed. An event sent again after its key was let go is taken again, as
a new one: keep is what tells a retry from a new event, so
keep it longer than the sender's retries and your own redeliveries from
its log. A statement whose guard is idempotent by the object's id takes a
late copy as a write of what is already there.
Where a hook has several statements, an event runs every one whose condition takes it, in their names' order, in one block: all of them and the key, or none. A refusal by any is the event's answer.
What a sender is told
A sender is told a 2xx once its event is taken and on disk, or when
sending it again could change nothing. Every other answer is the refusal's
status, so the sender's retries are the queue: Stripe retries for three
days, Standard Webhooks senders on their own schedules, and GitHub
redelivers from its log when asked. A sender is told what a scoped token would be: the status, a guard's
reason and the bound a refusal names — never a statement's
name or a value from the database, which the server's log line holds under
the request id beside the event's key.
| Answer | Status |
|---|---|
not a POST | 405, Allow: POST |
| anything before a verified signature (below) | 401 the event does not verify |
| verified, not JSON's content type | 415, naming the type to set |
| a read-only server or a replica | 403 |
the body not a JSON object; no key, a key past 255 bytes or holding a control character; Fennec-Wait | 400 |
| the key kept: a retry, a duplicate, another body | as the first was answered, Idempotent-Replayed: true |
no statement takes the hook; a statement of the hook that cannot run; a tenant's hook kept from 0.2.0 with key delivery (above) | 409 |
| no condition takes the event | 200, {"taken":0}, no key kept |
a parameter missing or of another type; check false | 400, naming the parameter and its path |
require unmet | 412, its reason |
insert over a taken id, a @unique value taken | 409 |
past --call-max-rows | 400, naming the bound |
| a statement bound to the writes refusing | its status, its reason |
above --max-memory, statements that insert or set | 507 |
| a tenant's: past its quota's bytes or rows; its rate | 507, naming the bound; 429 |
| a tenant's: being moved, or its node's lease lapsed before it ran | 503, Retry-After |
| taken, but no replica a promotion could take it from holds it yet (below) | 503, Retry-After |
| a tenant's: its node's lease lapsed after its block landed | 500, "outcome":"unknown"; the sender's retry is answered from its key, or takes it once where it never landed |
| a storage error | 500 |
| taken | 200, {"event":"<key>","taken":<statements>}, Fennec-Seq |
Never a 410, which tells a Standard Webhooks sender to disable the endpoint, and never a redirect, which Stripe counts as a failure.
One 401 for everything before the signature
The route is the one that runs a statement without a token, so nothing
of an event is read before its signature verifies: the scheme is read from
the headers present, each of which must come once; the hook is looked up;
the signed time must be within the tolerance; the body must be within the
hook's max-body; and two HMAC-SHA256s are computed, always,
under the hook's secrets — a random key of the process's own standing in
for one that is not there, which never verifies — each compared in
constant time with every v1 signature sent. They cover the
body up to the largest max-body of any hook, whichever hook
the path names. Stripe's v0 and Standard Webhooks'
v1a are not read. Every failure is the same 401 after the
same work, so an answer's time tells no one whether a hook exists, or what
its max-body is.
Which check failed is said where only you read it: the server's log
(hook `stripe`: an event from 203.0.113.9 did not verify (stale):
answered 401, hook `?` for a path naming no hook's
name), the audit log's
refused line and fennec_hook_unverified_total{check}
— header, scheme, stale,
size, hook or signature. A
stale run from one sender is a clock to set right; a
signature one a secret rolled at one end only. Refusals from
one address wait longer each time, as a refused token's do, by a count of
the hooks' own, kept by the address and the hook's name:
/_hooks/%73tripe counts as /_hooks/stripe, and
every path naming no hook's name shares one count. A forged event raises no
token's wait, and a verified event clears no token's.
On disk before the 2xx
A client told a buffered write landed can read it back and write it
again; a sender told 2xx never sends the event again. So an event's block
is fsynced before it is answered, as a write under --sync
always is, whatever --sync says for the server's other
writes: a crash a moment after a buffered 200 would lose a payment no one
sends again. An event no condition takes writes nothing and waits for
nothing. Events arriving together share one fsync. On a server under
--sync 250 each event is one more fsync among its buffered
writes; the buffered writers beside it go on into memory while it runs.
Where the server feeds a replica a
promotion could take the event from, the 2xx waits too for that replica's
stream to have sent the block, up to the time a durable write waits for
its replicas. Past it the answer is 503 with Retry-After: the
event is taken and on disk, and the sender's next try is answered from its
key once the replica holds it. An archiver's stream is no replica a
promotion takes over, and is not waited for. On a node of tenants the
replica waited for is the tenant's own: its pair's standby, or its
--replicas copy — never a read replica, which no failover
promotes.
Who defines and calls one
The server's token defines a hook's statement, as it makes any schema
change, and the audit log's schema line names its hook. The
statement runs with its own text's authority, as every named statement does: its writes
wake the statements bound to them and are held to
--call-max-rows. The server's token may call one
to try it, with an event as its argument —
call stripe_paid {type: 'payment_intent.succeeded', data: {...}}
— which runs it as an event would and keeps no key; hook.id,
hook.at and hook.event are null
there. To every scoped token a hook's statement is the 404 a missing
statement is, at /query, /batch and
/_call, whatever its policy's call lines say; it
is in none of their listings, and an agent gets no MCP tool for it.
A synced replica, the browser module and the native library take no definition: nothing of theirs receives a sender's request. What an event writes reaches them as any write does.
Senders' addresses
The signature is what proves an event is the sender's; fennecdb keeps no
list of addresses. Stripe also advises accepting its events only from the addresses it sends from; a
firewall in front of the server may hold /_hooks/stripe to
them. Behind Cloudflare's proxy the server sees Cloudflare's addresses, so
the rule is Cloudflare's: a WAF custom rule blocking
http.request.uri.path eq "/_hooks/stripe" and not ip.src in
{...}, the list Stripe publishes.
Watching them
/_metrics
counts each event once by its outcome in
fennec_hook_events_total{outcome} — taken,
ignored (no condition took it), replayed,
conflict (another body under a kept key),
refused, deferred (a 429, 500, 503 or 507 the
sender's retry may meet otherwise) and unknown — and the
refusals before the signature in
fennec_hook_unverified_total{check}. No label names a hook. A
server with no hooks file writes neither family. The router counts the
tenants a copy of which lacks their current set in
fennec_router_tenants_hooks_behind. Each refused event, and
each copy that came with another body, is a line of the server's log
naming the hook, the event's key, GitHub's delivery and why — what the
sender was not told — under the request's id; never the body, a signature
or a secret.
Where each hook stands is in the listings, to the server's token alone.
statements and describe statement give a webhook
consumer two columns after held: hook, the hook it
takes, and armed, whether this server takes its events: it
holds a secret for it — a line of the hooks file naming it, or on a tenant
node the tenant's set — asked as the listing is written, so a
PUT or DELETE through the router changes it while
the tenant is open. false means the hook's events are answered
401, whoever sends them: the hooks file does not name the hook, or the
tenant's secrets were never set (a restore brings none back). It is
false too for a tenant's hook kept from 0.2.0 with key
delivery (above), whose secret is
held but whose verified events are answered 409 until it is set again.
null is a statement that takes no hook. The
shell and the native library take no event, and say false for
one that does. A
scoped token's statements is 403 as before.
{"name":"stripe_paid","version":[0,4],"signature":"($intent text from event.data.object.id, $order text from event.data.object.metadata.order)","writes":true,"comment":null,"broken":null,"after":null,"schedule":null,"next":null,"last":null,"held":null,"hook":"stripe","armed":true}describe statement adds the condition as the text
writes it, event.type = 'payment_intent.succeeded' and event.livemode =
true, and its signature names where each parameter reads
from: from event.data.object.id, from event for
the whole body, from hook.id, hook.at or
hook.event. A quoted key is shown as the event's JSON names it,
event.metadata.order-id. GET /_schema lists each
hook beside the scheduled statements as hooks
([{"name", "hook", "text", "armed"}], never a secret), and
?as=fennecql writes their definitions (HTTP reference, Webhook consumers).
/_stats/statements
counts each statement an event ran as a shape of its own, hook
stripe_paid: its calls the events it ran for, its rows what its
body's last statement answered, its errors the events it refused. The
request's own shape, POST /_hooks/stripe, holds the time. On a
tenant node the shape is the tenant's, at
/t/<tenant>/_stats/statements. An event answered from its
key, or taken by no condition, runs no statement and counts none.
An event past --slow-ms writes the usual slow line, its statement
POST /_hooks/stripe, with a hook field: the hook
and each statement that ran, with its version and the rows its last
statement answered. Never the event's key, its body or a secret.
An event is its request's trace.
Its server span carries fennec.hook and
fennec.outcome, one of the outcomes above, and each statement
it ran is a child span, hook stripe_paid, with the rows its last
statement answered. A statement that refused the event is marked failed with
its status and the reason its else wrote, as 412 no open
order of that total. No span holds the event's key or a value of its
body.
Datadog's monitors hold four of these to account: events that do not verify, events a statement refused, events held back by a quota, a lease or the disk, and a tenant's copy that lacks its hook secrets, which a failover onto that copy would turn into 401s. The dashboard has a group for webhooks.
In fennec studio, the SDKs and the shell
fennec studio lists each webhook
consumer among the named statements by its hook, on hook stripe,
armed or not armed — the second a hook whose every event is
answered 401 until its secret is set, or a tenant's hook kept with
key delivery, refused until it is set again. Its Test event opens the event
as JSON, begun from the paths the statement's parameters read and the values
its condition compares, and runs the call below in the query editor; its
definition opens as create or replace statement .... Its editor
colours hook, and event where a path into the event
follows it.
The test event is the server's token's call, the event its one
argument, which any client sends:
call stripe_refunded $1
-- $1 = {"type": "charge.refunded", "created": 1711627200,
-- "data": {"object": {"id": "ch_1"}}}It runs the statement as a delivery would — its condition asked, each
parameter read from the event and typed, its body run, waking the bindings
its writes reach — but alone, not beside the hook's other statements, with
no signature asked and no key kept, so it can be sent again. It holds no
hook.id, hook.at or hook.event: a
parameter reading one is refused (400, naming it) unless it has a default —
stripe_paid above, whose $paid reads
hook.at, takes no test event — and a condition asking
hook.event = '…' passes none; the studio's dialog says both
before anything is sent. An event the condition passes over is
refused in words (400), as is one missing a path a parameter reads.
Every SDK's statements() reads the two columns into its
NamedStatement — hook and armed, Go's
and .NET's Hook and Armed — and its
call sends the test event (every SDK's):
const db = connect('https://db.example.com', { token });
const unarmed = (await db.statements()).filter((s) => s.armed === false);
await db.call('stripe_refunded', { type: 'charge.refunded', created: 1711627200,
data: { object: { id: 'ch_1' } } });The shell's .help gives the form. The shell, the browser
module and the native library take no event: a server's file opened in them
keeps its webhook consumers for the server that next serves it.