POST /v1/routines/hooks/{hook_id}
The URL you give a provider for a routine's webhook trigger. The request is verified with the trigger's `verify` scheme (B3OS HMAC `B3OS-Signature: t=<unix>,v1=<hex>`, or the GitHub, Stripe, Slack or Standard Webhooks signature, or a generic HMAC header) with a ±5 minute timestamp window where the scheme has one, and deduplicated for 24 hours by the trigger's `dedupe` key (by default the provider's delivery ID: `X-GitHub-Delivery`, the Stripe event `id`, the Slack `event_id`, `webhook-id`, or for `b3os` the `Idempotency-Key` header, else the signature; `hmac_sha256` triggers must set `dedupe`); a duplicate answers 202 with `deduplicated: true` and the first delivery's run. No API key is used: the unguessable hook ID plus the signature authenticate it. When the trigger's `if` is false the delivery is acknowledged and starts nothing. If the node is down, the edge stores the delivery durably and replays it in order. On a replay the signed timestamp is checked against the time the edge received the delivery (the edge signs that time), so a delivery queued during an outage is not refused as stale. A 5xx answer means "retry later" and the edge keeps the delivery; 2xx and 4xx answers are final.

Path Parameters

hook_id string required path
The hook ID (`hk_…`).
Example: "hk_01m5t3r2qwz23751t0x74bhahz"

Header Parameters

B3OS-Signature string optional header
`t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">` for triggers verified with the `b3os` scheme.
Example: "t=1793001600,v1=8f2c6c0f0d7a3e4b5a6978c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f60718293a4b"

Request Body

application/json
unknown

Responses

202 The delivery was accepted (a run started, or it was a duplicate, or `if` was false).
application/json
object string REQUIRED
Enum: hook_delivery
hook_id string REQUIRED
delivery_id string REQUIRED
The provider's delivery ID when it sends one, otherwise a B3OS event ID.
run_id string | null REQUIRED
The run started (or the earlier run, for a duplicate); `null` when `if` was false.
deduplicated boolean REQUIRED
400 The request failed validation (`invalid_request`, `invalid_url`).
401 Verification failed (`webhook_signature_invalid`).
402 The organization has no credits left, or the key reached its spend cap.
404 No such hook (`hook_not_found`).
413 The request body exceeds this operation's limit.
415 The Content-Type is not accepted by this operation.
422 The webhook trigger's `with` failed to evaluate on this delivery (`expression_error`), or the input it produced does not match the routine's `inputs` schema (`run_input_invalid`). The edge does not retry a 4xx.
429 A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500 Something failed inside B3OS (`internal`). Retry with backoff.
503 The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X POST 'https://beta-api.b3os.org/v1/routines/hooks/hk_01m5t3r2qwz23751t0x74bhahz' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "action": "opened",  "number": 42}'
const response = await fetch('https://beta-api.b3os.org/v1/routines/hooks/hk_01m5t3r2qwz23751t0x74bhahz', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "action": "opened",    "number": 42  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/routines/hooks/hk_01m5t3r2qwz23751t0x74bhahz', headers=headers, json={  "action": "opened",  "number": 42})print(response.json())
202 Response
{  "object": "hook_delivery",  "hook_id": "hk_01m5t3r2qwz23751t0x74bhahz",  "delivery_id": "evt_01m5t4p5ycda35cq27epnbfqhe",  "run_id": "run_01m5t40dnvfxq40j1zrjj42gpg",  "deduplicated": false}
Ask a question... ⌘I