Skip to content
Star33Playground

Webhook channel (HTTP)

Last updated 2026-11-17 · c98e90871

Accept HMAC-signed HTTP requests as channel messages with WebhookChannelAdapter. Part of Messaging channels.

Requests are accepted only when signed:

x-channels-timestamp: <epoch seconds or milliseconds>
x-channels-signature: hex(HMAC-SHA256(secret, "<timestamp>.<body>"))

Per-caller limits. A webhook route has no default per-sender cap (messaging channels default to 6 turns per sender per hour), because most webhook callers send no sender identity and would all share one bucket. The route-level caps (maxCostPerDayUsd, maxTurnsPerHour) always apply. To limit each caller, put senderId (or from_id) in the JSON body and set maxTurnsPerSenderPerHour on the route; each senderId then gets its own hourly budget. Requests without a senderId share one bucket under that cap.

A timestamp outside replayWindowMs (default 5 minutes) is rejected, and a repeated message id is delivered once. With no secret, every request is rejected (missing_secret) unless you pass allowUnsigned: true, which is for local development only. secret accepts a plain string or an Effect Redacted. Before anything consumes inbound (start() or a legacy onMessage handler), a request fails with not_started instead of being dropped.

Connection info and signing helper. webhook.connectionInfo({ baseUrl }) returns how to call the channel, generated from the same constants verification uses: { method: "POST", path: "/channels/<id>", url?, contentType, signature: { header, algorithm, encoding, signedPayload, timestampHeader, timestamp, replayWindowMs, replay }, examples: { curl, node, openssl } }. The pure webhookConnectionInfo({ baseUrl?, channelId?, replayWindowMs? }) gives the same without an adapter. signRequest(secret, body, { nowMs? }) returns { headers, timestamp, signature }: the exact headers a sender must attach (the body must be sent byte-for-byte as signed). Examples use the placeholder $WEBHOOK_SECRET.

Install

Bun (recommended)bun add reactive-agents
Node 22.5+npm install reactive-agents

Get notified on new releases