Tunneling
Forward webhooks and captured emails to your local development server in one command. No port forwarding, no deploy: inspect every request as it arrives.
Updated Nov 2026
What the tunnel prints
whk tunnel 3000One line per delivery: the time, the color-coded method, the path (for an email, the address it arrived at and its subject), and the status your local server answered with its latency, or why the delivery failed:
14:32:01 POST /webhook -> 200 (12ms)
14:32:09 EMAIL acme@mailhooks.cc Your order shipped -> 204 (8ms)
14:32:15 POST /webhook -> FAILED: connection refused
With --json every line is a JSON object (NDJSON) with an event field: forwarded for a delivery (with the request's id, status, duration_ms and success), skipped, reconnecting, endpoint_deleted and the live relay's own events, so a script or an agent can follow the tunnel line by line. Read a delivered request in full with whk requests get <id>.
Create and forward
whk tunnel 3000Creates an endpoint, prints its URL and email address, and forwards every incoming request to localhost:3000, and every email it receives too (emails). The sender receives the mock response you configured (200 OK by default).
Answer with your app
When the sender needs your app's response (a Slack slash command, Twilio's TwiML, a verification handshake), add --live: each webhook is relayed to your local server while the sender waits, and the sender gets your app's answer. The request is still captured, with your app's response stored next to it. See live tunnels.
whk tunnel 3000 --liveTo show a whole site to people in a browser rather than deliver webhooks, use whk share.
Forward an existing endpoint
Use --endpoint to forward an endpoint you already created in the dashboard or CLI:
whk tunnel 3000 --endpoint <slug>Ephemeral mode
Delete the endpoint when the tunnel exits:
whk tunnel 3000 -eCustom headers
Inject headers into every forwarded request and email with -H (repeatable):
whk tunnel 3000 -H "Authorization: Bearer test-token" -H "X-Custom: value"Listen without forwarding
Stream requests to the terminal without forwarding them to a local server:
whk listen <slug>How it works
- The CLI creates (or connects to) an endpoint on webhooks.cc.
- When a webhook arrives, the server pushes it to the CLI over Server-Sent Events (SSE).
- The CLI replays the request (method, headers, body) to your local port. An email is first rendered by webhooks.cc in the format you picked, then posted.
- Your local server processes it as if the sender called it directly.
Sensitive headers (Authorization, Cookie) from the original request are filtered out before forwarding. Use -H to inject authentication headers your local server needs.
Emails
The tunnel also delivers the emails the endpoint receives at its mailhooks.cc address, so you can test an inbound email handler while you click through a signup by hand. An email is a message sent to an address, not an HTTP request, so for each one the CLI asks webhooks.cc to render it and sends the result to your server as a POST.
By default the body is webhooks.cc's own email.received JSON, the same body forwarding posts, with Content-Type: application/json. The tunnel does not sign it: there are no webhook-* headers, so turn off a verifyForwardedEmail check while you test through the tunnel, or post a signed copy with the SDK (test an email handler locally).
An email has no path of its own (its path is the address it was sent to), so emails go to the target itself: whk tunnel 3000 posts them to http://localhost:3000, and whk tunnel 3000/api/inbound to http://localhost:3000/api/inbound. --email-path appends a path for emails only, the way a webhook's path is appended, so one tunnel can feed your webhook handlers and your email handler:
# Webhooks keep their own paths; emails go to localhost:3000/hooks/email
whk tunnel 3000 --email-path /hooks/emailEach email shows up with the address it arrived at and its subject:
14:32:01 POST /webhooks/stripe -> 200 (12ms)
14:32:09 EMAIL acme-7@mailhooks.cc Confirm your email -> 204 (8ms)
With --json, an email's forwarded event also carries "kind": "email", its subject and the format it was posted in.
In a mail provider's shape
If your app receives email through an inbound mail service, --email-format posts each email the way that service would, so the handler you wrote for it runs against real mail from real clients:
whk tunnel 3000 --email-format postmark --email-path /webhooks/postmark--email-format | What your handler receives |
|---|---|
json (default) | webhooks.cc's email.received JSON |
postmark | Postmark's inbound JSON |
sendgrid | A SendGrid Inbound Parse form (multipart/form-data) |
mailgun | A Mailgun route's form (application/x-www-form-urlencoded), signed below |
cloudmailin | CloudMailin's JSON Normalized format |
The fields of each shape are listed under forwarding in a mail provider's shape.
A Mailgun handler checks signature, the hex HMAC-SHA256 of timestamp and token under your Mailgun HTTP webhook signing key (under API Security in Mailgun). Give the tunnel that key and the form is signed the way Mailgun signs it, so the check passes; without it, signature is empty. Set it in the environment rather than on the command line, where it would end up in your shell history:
export WHK_MAILGUN_SIGNING_KEY=key-from-mailgun
whk tunnel 3000 --email-format mailgun --email-path /webhooks/mailgun--mailgun-signing-key <key> works too. The key is only used with --email-format mailgun: it goes to webhooks.cc with each email to sign that form, and is not stored.
What differs from the real thing: attachment files ride along up to 1 MB per email (Postmark and CloudMailin in their JSON, SendGrid and Mailgun as file parts with their exact bytes, so a PDF or an image arrives as the file it is; past that, CloudMailin's shape carries a file's download link and the others leave it out, while the JSON format lists every attachment), and the text and HTML are what webhooks.cc kept, up to 256 KB each.
Skip emails
--no-email leaves emails out: they are listed as skipped (--no-email) and nothing reaches your server.
whk tunnel 3000 --no-emailTips
- The tunnel reconnects on network interruptions.
- Your local server's response does not affect what the webhook sender receives, unless you add
--live. - Multiple tunnels can run against different endpoints simultaneously.
- Use
-efor throwaway sessions that clean up on exit. - Use
whk wait <slug>in a script to block until the next request arrives instead of reading the stream.