Test webhooks on localhost
te webhooks listen streams your application's webhook events to a URL on your own machine. There is no tunnel to set up and no public address to expose: the CLI makes one outbound HTTPS connection to TenancyEngine, so it works behind a router, a corporate NAT or a hotel network.
te login
te webhooks listen --app my-app --forward-to http://localhost:3000/hooksListening for my-app (Development) events, forwarding to http://localhost:3000/hooks
Signing secret for this session (set it as your webhook secret): whsec_3f9c...
18:04:11 tenant.updated -> 200 34 ms
18:04:40 usage.threshold_reached failed: ECONNREFUSED (is localhost:3000 running?)What your receiver sees
Each event is a POST with the same headers as a real delivery:
| Header | Value |
|---|---|
X-TE-Event | The event type, for example tenant.updated. |
X-TE-Signature | t={unix seconds},v1={HMAC-SHA256} over "{t}.{body}", using the session secret. |
X-TE-Delivery-Id | Stable id of the event. |
X-TE-Relay | 1, so you can tell a relayed event from a real delivery. |
The body is the event's JSON payload, as described in Webhook events and redelivery. Because the signature scheme is identical, the verifier you already wrote for production verifies relayed events too: just give it the session secret the CLI printed instead of your endpoint's secret. TenancyEngine's own signing secrets never leave the platform on this path.
Keep the same secret across restarts with --secret whsec_... (or the TE_WEBHOOK_SESSION_SECRET environment variable).
Options
| Option | Meaning |
|---|---|
--app <id|slug> | The application whose events to stream. Required. |
--forward-to <url> | Where to send events. Must be on this machine unless you add --allow-remote-target. Required. |
--environment Development|Staging | Default Development. |
--events a,b | Forward only these event types. Default: all. |
--max-events n | Stop after n events, for scripts and CI. |
--json | One JSON object per line (ready, then one event per forward with status and latencyMs). |
Rules
- Development and Staging only. Asking for Production is refused (
relay_not_allowed_in_production); production events go to your registered endpoints. - Needs an organization API key with the
webhooks.managescope, for an application in your own organization. A key never receives another organization's events. - At most 5 sessions per application at the same time. A connection lasts up to an hour; the CLI reconnects by itself.
- Events are streamed live. Events that happened while the CLI was not running are not replayed; use the delivery log and Redeliver for your registered endpoints.