Webhook tester
Developer webhook tester with endpoint validation, event type selector, masked signing secret, syntax-tinted JSON editor, browser HMAC SHA-256 signing, three-step delivery timeline, tabbed response inspector, and retryable recent deliveries.
import { WebhookTester } from '@uthereal/ui/webhook-tester'Webhook tester playground
Webhook tester
Signed test events from Stripe
- SignedHMAC SHA-256
- SentPOST
- 200 OK184 ms
{ "received": true }
Recent deliveries
Overview
WebhookTester provides a self-contained Test endpoint card for products that deliver signed webhooks. On the request side, developers enter an https:// (or http://localhost) endpoint URL, choose an event type to seed the syntax-tinted JSON payload editor, optionally reveal or copy the signing secret, format valid JSON, and send a test event.
Pressing Send test event (or Mod+Enter) computes a real HMAC SHA-256 signature over ${timestamp}.${body} using Web Crypto, advances the three-step request timeline (Signed → Sent → status), displays the response body, headers, and exact signed HTTP request in a tabbed inspector, and prepends the attempt to Recent deliveries with a one-click Retry control on failed or timed-out rows.
Use WebhookTester on developer settings pages, integration onboarding flows, and internal replay tools. For managing environment secrets across Deployment stages, use Environment variables. For third-party OAuth connections and sync schedules, use Integrations.
Usage
'use client'
import { WebhookTester } from '@uthereal/ui/webhook-tester'
export function EndpointTest({
endpointId,
signingSecret,
}: {
endpointId: string
signingSecret: string
}) {
return (
<WebhookTester
defaultEndpoint="https://api.acme.example/webhooks/billing"
secret={signingSecret}
sourceName="Acme"
signatureHeader="x-acme-signature"
onSend={async (request, signal) => {
const res = await fetch(`/api/endpoints/${endpointId}/test`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(request),
signal,
})
return res.json()
}}
/>
)
}Omit onSend to run the built-in local simulator (nothing leaves the browser: localhost endpoints simulate a refused connection, and all other valid URLs return 200 OK with realistic latencies). Never post directly from the browser to a customer webhook URL—forward request through your backend so your server performs the real POST.
Examples
Custom provider and events
Replace sourceName, signatureHeader, events, and defaultDeliveries to match any product’s webhook format, such as CI deployment hooks with a 422 Unprocessable failure ready to retry.
Webhook tester
Signed test events from Northwind CI
- SignedHMAC SHA-256
- SentPOST
- 422 Unprocessable148 ms
{ "error": "invalid_schema", "message": "Missing required field \"commit\" in deploy payload" }
Recent deliveries
Fresh endpoint onboarding
Pass an empty defaultDeliveries array for a newly created endpoint awaiting its first test event, or point defaultEndpoint at http://localhost to test the local refusal error state.
Webhook tester
Signed test events from Acme Billing
- SignHMAC SHA-256
- SendPOST
- ResponseNot sent yet
Recent deliveries
Signing and delivery lifecycle
Request timeline stages
| Stage | Meta | States |
|---|---|---|
| Sign | HMAC SHA-256 | Signs ${timestamp}.${body} with Web Crypto (crypto.subtle) and formats t=...,v1=.... Falls back to a deterministic 64-hex placeholder where Web Crypto is unavailable. |
| Send | POST | Passes the signed WebhookTestRequest and AbortSignal to onSend (or local simulation). |
| Response | Latency | Displays HTTP status (200 OK, 500 Server error), Timed out, or Unreachable with formatted duration. |
Response inspector tabs
| Tab | Content | Copy output |
|---|---|---|
| Body | Syntax-tinted JSON response body, empty-body placeholder, or network failure reason. | Raw response body text or error message. |
| Headers | Status line (HTTP/1.1 200 OK) followed by each response header key and value. | Status line and name: value header lines. |
| Request | Exact signed POST line, host, request headers (including signature), and body. | Full HTTP request transcript ready for support tickets. |
The signing secret stays masked and omitted from SSR and initial DOM markup until the reader activates the reveal toggle, preventing accidental secret leakage in server-rendered HTML.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
defaultEndpoint | stringDefault: "https://api.northwind.dev/webhooks/stripe" | Initial endpoint URL, https or http on localhost. Edits do not reset a mounted instance. |
events | WebhookEventTemplate[]Default: [{"type":"invoice.paid","payload":{"id":"evt_1QhT8sKZ3v2Lw9Xc","type":"invoice.paid","created":1793111528,"livemode":false,"data":{"object":{"id":"in_1QhT8rKZ3v2Lw9Xc","customer":"cus_RkN4b7TzqP1m","amount_paid":4900,"currency":"usd","status":"paid","hosted_invoice_url":null}}}},{"type":"customer.created","payload":{"id":"evt_1QhT2aKZ3v2Lw4Rn","type":"customer.created","created":1793111528,"livemode":false,"data":{"object":{"id":"cus_RkN4b7TzqP1m","email":"maya.okafor@lumen.studio","name":"Maya Okafor","currency":"usd","delinquent":false}}}},{"type":"customer.subscription.updated","payload":{"id":"evt_1QhSz4KZ3v2Lw8Jd","type":"customer.subscription.updated","created":1793111528,"livemode":false,"data":{"object":{"id":"sub_1QhSz3KZ3v2Lw8Jd","customer":"cus_RkN4b7TzqP1m","status":"active","plan":"team_annual","quantity":12,"cancel_at_period_end":false}}}},{"type":"checkout.session.completed","payload":{"id":"evt_1QhSq9KZ3v2Lw1Te","type":"checkout.session.completed","created":1793111528,"livemode":false,"data":{"object":{"id":"cs_test_a1Kq8ZpR2vN7","customer":"cus_RkN4b7TzqP1m","amount_total":58800,"currency":"usd","payment_status":"paid","mode":"subscription"}}}},{"type":"payment_intent.payment_failed","payload":{"id":"evt_1QhSk2KZ3v2Lw6Wb","type":"payment_intent.payment_failed","created":1793111528,"livemode":false,"data":{"object":{"id":"pi_3QhSk1KZ3v2Lw6Wb","amount":4900,"currency":"usd","last_payment_error":{"code":"card_declined","decline_code":"insufficient_funds"}}}}}] | Event types in the selector, each with its default JSON payload. Defaults to five Stripe-style sample events. |
defaultEvent | string— | Event selected on first render. Defaults to the first event in the list. |
secret | stringDefault: "whsec_demo_9f8e7d6c5b4a3210" | The signing secret. Payloads are signed with real HMAC SHA-256 in the browser via Web Crypto. |
signatureHeader | stringDefault: "stripe-signature" | Header that carries the t=...,v1=... signature. Defaults to stripe-signature. |
sourceName | stringDefault: "Stripe" | Who sends the events, shown in the subtitle beside the mark. Defaults to Stripe. |
defaultDeliveries | WebhookDelivery[]Default: [{"id":"msg_2Lq8RkT4mN","event":"invoice.paid","time":"14:28:06","request":{"url":"https://api.northwind.dev/webhooks/stripe","event":"invoice.paid","body":"{\n \"id\": \"evt_1QhT8sKZ3v2Lw9Xc\",\n \"type\": \"invoice.paid\",\n \"created\": 1793111528,\n \"livemode\": false,\n \"data\": {\n \"object\": {\n \"id\": \"in_1QhT8rKZ3v2Lw9Xc\",\n \"customer\": \"cus_RkN4b7TzqP1m\",\n \"amount_paid\": 4900,\n \"currency\": \"usd\",\n \"status\": \"paid\",\n \"hosted_invoice_url\": null\n }\n }\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"327","user-agent":"UtherealWebhooks/1.0 (+https://uthereal.dev/webhooks)","stripe-signature":"t=1793111286,v1=b8f660d0e04878121828b0aac0dc7c3ae090644830d65ca8702ec094307e6050"},"timestamp":1793111286,"signature":"b8f660d0e04878121828b0aac0dc7c3ae090644830d65ca8702ec094307e6050"},"response":{"status":200,"durationMs":184,"body":"{\n \"received\": true\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"22","x-request-id":"req_8fK2nQ4tVw"}}},{"id":"msg_2Lp1XcV9sB","event":"customer.subscription.updated","time":"14:11:42","request":{"url":"https://api.northwind.dev/webhooks/stripe","event":"customer.subscription.updated","body":"{\n \"id\": \"evt_1QhSz4KZ3v2Lw8Jd\",\n \"type\": \"customer.subscription.updated\",\n \"created\": 1793111528,\n \"livemode\": false,\n \"data\": {\n \"object\": {\n \"id\": \"sub_1QhSz3KZ3v2Lw8Jd\",\n \"customer\": \"cus_RkN4b7TzqP1m\",\n \"status\": \"active\",\n \"plan\": \"team_annual\",\n \"quantity\": 12,\n \"cancel_at_period_end\": false\n }\n }\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"349","user-agent":"UtherealWebhooks/1.0 (+https://uthereal.dev/webhooks)","stripe-signature":"t=1793110302,v1=b8f6600e8062981218280c8aa0347c3ae00a84eed0d65ca8088e2c7c307e6006"},"timestamp":1793110302,"signature":"b8f6600e8062981218280c8aa0347c3ae00a84eed0d65ca8088e2c7c307e6006"},"response":{"status":500,"durationMs":1204,"body":"{\n \"error\": \"Cannot read properties of undefined (reading 'plan')\"\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"69","x-request-id":"req_3Hd7pLm2Qa","x-simulated-error":"FUNCTION_INVOCATION_FAILED"}}},{"id":"msg_2Ln7GhD3wE","event":"customer.created","time":"13:57:19","request":{"url":"https://api.northwind.dev/webhooks/stripe","event":"customer.created","body":"{\n \"id\": \"evt_1QhT2aKZ3v2Lw4Rn\",\n \"type\": \"customer.created\",\n \"created\": 1793111528,\n \"livemode\": false,\n \"data\": {\n \"object\": {\n \"id\": \"cus_RkN4b7TzqP1m\",\n \"email\": \"maya.okafor@lumen.studio\",\n \"name\": \"Maya Okafor\",\n \"currency\": \"usd\",\n \"delinquent\": false\n }\n }\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"304","user-agent":"UtherealWebhooks/1.0 (+https://uthereal.dev/webhooks)","stripe-signature":"t=1793109439,v1=b8f66062904654121828a4b0c07a7c3ae0e6d04a90d65ca828f0c4b6307e606a"},"timestamp":1793109439,"signature":"b8f66062904654121828a4b0c07a7c3ae0e6d04a90d65ca828f0c4b6307e606a"},"response":{"status":200,"durationMs":96,"body":"{\n \"received\": true\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"22","x-request-id":"req_6Tz1cRb8Nk"}}},{"id":"msg_2Lm4JkP8yR","event":"payment_intent.payment_failed","time":"13:40:03","request":{"url":"https://api.northwind.dev/webhooks/stripe","event":"payment_intent.payment_failed","body":"{\n \"id\": \"evt_1QhSk2KZ3v2Lw6Wb\",\n \"type\": \"payment_intent.payment_failed\",\n \"created\": 1793111528,\n \"livemode\": false,\n \"data\": {\n \"object\": {\n \"id\": \"pi_3QhSk1KZ3v2Lw6Wb\",\n \"amount\": 4900,\n \"currency\": \"usd\",\n \"last_payment_error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"insufficient_funds\"\n }\n }\n }\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"360","user-agent":"UtherealWebhooks/1.0 (+https://uthereal.dev/webhooks)","stripe-signature":"t=1793108403,v1=b8f660986000b8121828f02a00947c3ae058e40070d65ca8b0ae005c307e6018"},"timestamp":1793108403,"signature":"b8f660986000b8121828f02a00947c3ae058e40070d65ca8b0ae005c307e6018"},"response":{"status":0,"durationMs":10000,"timedOut":true,"error":"No response after 10 s. Return a 2xx before doing slow work."}},{"id":"msg_2Lk9MnQ2zT","event":"checkout.session.completed","time":"13:22:51","request":{"url":"https://api.northwind.dev/webhooks/stripe","event":"checkout.session.completed","body":"{\n \"id\": \"evt_1QhSq9KZ3v2Lw1Te\",\n \"type\": \"checkout.session.completed\",\n \"created\": 1793111528,\n \"livemode\": false,\n \"data\": {\n \"object\": {\n \"id\": \"cs_test_a1Kq8ZpR2vN7\",\n \"customer\": \"cus_RkN4b7TzqP1m\",\n \"amount_total\": 58800,\n \"currency\": \"usd\",\n \"payment_status\": \"paid\",\n \"mode\": \"subscription\"\n }\n }\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"348","user-agent":"UtherealWebhooks/1.0 (+https://uthereal.dev/webhooks)","stripe-signature":"t=1793107371,v1=b8f660fe3014e01218289c94f0a87c3ae03af8dc60d65ca8d85cb828307e6076"},"timestamp":1793107371,"signature":"b8f660fe3014e01218289c94f0a87c3ae03af8dc60d65ca8d85cb828307e6076"},"response":{"status":200,"durationMs":212,"body":"{\n \"received\": true\n}","headers":{"content-type":"application/json; charset=utf-8","content-length":"22","x-request-id":"req_2Wq5vYx7Je"}}}] | Deliveries shown on first render, newest first. Defaults to a five-row sample with one failure and one timeout. |
autoPlay | booleanDefault: false | Send one sample event when the card first scrolls into view. Opt-in demo behavior; never fires when onSend is wired. |
sendAction | string— | Registered host action requested when Send test event is pressed. |
retryAction | string— | Registered host action requested when Retry is pressed on a failed delivery. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes preserve interaction behavior. |
theme | WebhookTesterThemeDefault: {} | Color mode, accent, and typed semantic token overrides. |
motion | none | subtle | expressiveDefault: "subtle" | Animation preset. System reduced-motion preferences take precedence. |
motionOptions | WebhookTesterMotionOptionsDefault: {} | Timeline crossfade and delivery row reflow timing overrides in milliseconds. |
dir | ltr | rtl— | Reading direction; inherited from the page when omitted. |
WebhookEventTemplateaccepts{ type: string, payload?: JsonValue }. Event types must be unique.WebhookDeliveryaccepts{ id, event, time, request, response? }, whererequestis{ url, event, body, headers, timestamp, signature }andresponseis{ status, durationMs, headers?, body?, error?, timedOut? }.
React integration
| Prop | Purpose |
|---|---|
onEndpointChange(url) | Called on every edit to the endpoint URL field. |
onSend(request, signal) | Sends the signed request through your backend and resolves with a WebhookTestResponse (use status: 0 and error when unreachable). |
onRetry(delivery, signal) | Re-sends a failed delivery with a fresh timestamp and signature. Defaults to calling onSend with the re-signed request. |
onAction(action, itemId?) | Called with sendAction on send or retryAction (plus the delivery ID) on retry. |
renderSourceMark() | Replaces the default 16px monogram mark beside the source subtitle. Keep returned elements decorative. |
portalContainer | Portal target forwarded to the event type selector. |
preset | Application defaults overridden by explicit instance arguments. |
tokens | CSS variables applied after the typed theme, forwarded to the root card and portalled event selector. |
ref, className, style | Applied to the root <section> element. |
| Native attributes | id, aria-*, data-*, and remaining <section> props forwarded to the root element. |
Keyboard & accessibility
| Key | Action |
|---|---|
Mod+Enter | Sends the test event from the payload editor or endpoint URL field (Enter alone also sends in Endpoint). |
Enter (in editor) | Inserts a newline matching current indentation and indents two spaces after { or [. |
ArrowLeft / ArrowRight | Moves between the Body, Headers, and Request tabs (respects RTL). |
Home / End | Jumps to the first or last response inspector tab. |
Tab | Moves across Endpoint, Event, Reveal, Copy, Payload editor, Format, Send, Tabs, Copy, Panel, and Rows. |
- Every field carries an explicit accessible label; the payload
<textarea>is labelled with the active event type, setsaria-invalidon parse errors, and highlights the failing line number in the gutter and footer. - The reveal toggle uses
aria-pressedand updates its label between"Reveal signing secret"and"Hide signing secret". Unrevealed secrets are omitted from the DOM and announced as"Hidden". - Response tabs follow the WAI-ARIA tabs pattern with roving
tabIndex, and the response panel is keyboard-scrollable (tabIndex={0}). - Delivery rows announce event name, status, and timestamp, mark the active delivery with
aria-current, and pair every status chip with an icon and label rather than color alone. - A pre-mounted polite
role="status"live region announces each send and outcome (appending"Simulated, nothing was sent."whenonSendis omitted). - Container queries split the card into two side-by-side columns at
680pxand stack below it; below420px, delivery timestamps hide and long event names truncate cleanly. Code surfaces staydir="ltr"while surrounding layout mirrors cleanly in RTL (dir="rtl").
Motion & theming
The timeline connectors fill along the inline axis while a traveling dot loops on the active leg until the response settles. Status icons, labels, hints, and response panels crossfade in fixed grid slots so nothing shifts, and new deliveries fade in while older rows glide down on the snappy spring (260ms).
Under prefers-reduced-motion: reduce, the traveling dot, connector fill, row reflow, and scale/travel animations turn off, swaps fall back to 120ms opacity crossfades, and the in-flight spinner slows to 1.6s. Setting motion="none" makes every transition immediate (0ms) and stops spinner animation.
theme accepts mode, accent, and typed tokens across these groups:
| Token group | CSS custom properties |
|---|---|
core | --ui-surface, --ui-surface-raised, --ui-text, --ui-text-secondary, --ui-muted, --ui-border, --ui-highlight, --ui-accent, --ui-accent-foreground, --ui-danger, --ui-focus-ring, --ui-radius, --ui-border-width, --ui-shadow, --ui-disabled-opacity, --ui-font, --ui-font-size, --ui-font-weight |
extended | --ui-surface-sunken, --ui-border-strong, --ui-border-subtle, --ui-track, --ui-info, --ui-success, --ui-warning, --ui-tone-foreground, --ui-overlay, --ui-tint-strength |
shape | --ui-radius-sm, --ui-popup-radius, --ui-surface-radius |
accentTones | --ui-accent-strong, --ui-accent-subtle |
control | --ui-control-height, --ui-control-padding-x, --ui-control-gap, --ui-icon-size |
type | --ui-font-mono, --ui-font-display |
include | --ui-series-1, --ui-series-2, --ui-series-3 (JSON syntax key, literal, and number tints) |
An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, WebhookTester is a leaf block. Provide placeholder endpoints and secrets only, define unique events, and wire sendAction and retryAction to registered host actions. See Building with agents.
{
"type": "WebhookTester",
"props": {
"defaultEndpoint": "https://api.northwind.dev/webhooks/stripe",
"sourceName": "Stripe",
"signatureHeader": "stripe-signature",
"sendAction": "send_webhook_test",
"retryAction": "retry_webhook_delivery"
},
"children": []
}