Execution hooks send B3OS run and node execution events to your backend. Use them for observability, audit logs, customer notifications, billing sync, support workflows, and downstream orchestration.

Execution hook delivery
eventsigned POST2xx after enqueuefailed or manual redeliverysame validation path Workflow run Run and node lifecycle events Execution hook Event filter, signing secret, delivery policy Your receiver Verify signature and enqueue work Queue or log Idempotency, audit, downstream jobs Retry / replay Recover delivery or backfill systems

Event Model

Event familyExamples
Run lifecycleRun started, waiting, succeeded, failed, cancelled
Node lifecycleExecution pending, running, succeeded, failed, skipped, waiting, scheduled
Delivery lifecycleHook delivery attempts, retries, replay, and delivery status

Hook Receiver Requirements

urlstringrequiredpath

HTTPS endpoint that accepts signed JSON POST requests from B3OS.

eventsstring[]requiredpath

Event types the hook should receive.

secretstringrequiredpath

Shared secret used to verify delivery signatures. Store it as a backend secret.

enabledbooleanpathdefault: true

Whether B3OS should deliver events to the hook.

Example Receiver

javascript
import crypto from "node:crypto";import express from "express";const app = express();app.use(express.raw({ type: "application/json" }));app.post("/b3os/hooks", (req, res) => {const signature = req.header("x-b3os-signature");const expected = crypto.createHmac("sha256", process.env.B3OS_WEBHOOK_SECRET).update(req.body).digest("hex");if (signature !== expected) {return res.status(401).send("invalid signature");}const event = JSON.parse(req.body.toString("utf8"));queueEventForProcessing(event);res.status(204).send();});

Check the API reference and hook configuration response for the exact signature headers your deployment emits.

Idempotency

Execution hook receivers should be idempotent. Store a unique event ID, run ID plus event type, or execution ID plus event type before doing side effects.

sql
create table b3os_hook_events ( event_id text primary key, received_at timestamptz not null default now(), payload jsonb not null);

Delivery Behavior

BehaviorRecommendation
2xx responseTreat as accepted and process asynchronously if work is slow
Non-2xx responseB3OS may retry according to delivery policy
TimeoutKeep receiver fast and move heavy work to a queue
Duplicate eventUse idempotency keys
ReplayHandle replayed events the same way as first delivery

Always verify hook signatures before processing. Do not allow hook events to trigger wallet, payment, or privileged operations without verification and policy checks.

Replay Versus Retry

Retry is automatic delivery recovery after a failed attempt. Replay is intentional redelivery for debugging, audit backfill, or resyncing your external system.

Webhooks and executions

Conceptual overview of incoming webhooks, execution hooks, and streams.

Learn More
Security

Credential, signature, public route, and workflow safety guidance.

Learn More
Ask a question... ⌘I