Webhook Debugging
Test and debug webhooks from services like Stripe and GitHub
Overview
zgrok makes webhook development easy. Instead of deploying your app to test webhooks, you can receive them on your local machine in real-time.
Setting up webhooks
1. Start a tunnel
zgrok http 3000Note the public URL (e.g., https://a7f9x2--acme-shop.zgrok.io).
2. Register the webhook URL
In your service's webhook settings, use your tunnel URL as the endpoint:
- Stripe:
https://a7f9x2--acme-shop.zgrok.io/api/webhooks/stripe - GitHub:
https://a7f9x2--acme-shop.zgrok.io/api/webhooks/github - Slack:
https://a7f9x2--acme-shop.zgrok.io/api/slack/events
3. Watch requests flow in
Trigger an event (e.g., make a test payment in Stripe) and watch it arrive in your terminal:
[14:32:05] POST /api/webhooks/stripe 200 45ms
Tips
Keep the same URL across restarts (Pro)
A webhook endpoint is a URL you registered somewhere else, so it is the one place a changing address really hurts.
On Free, your address is per-session. The name in https://a7f9x2--acme-shop.zgrok.io
is assigned to you for that run only; the next zgrok http 3000 hands you a
different one, and the endpoint you registered with Stripe or GitHub stops
resolving to you. Two ways to live with that:
- Re-register the new URL each session, which is fine while you are still wiring things up.
- Trigger the event once, then use the request inspector's Replay to re-run that exact delivery against your handler as often as you like. No provider round-trip, so the URL never has to be current.
On Pro, a tunnel name you choose inside your project is yours and survives every restart:
zgrok http 3000 --subdomain myappIn a project called acme-shop, your URL stays https://myapp--acme-shop.zgrok.io across
sessions, so the endpoint you registered once keeps working.
Add CORS headers
If your webhook handler needs to respond to preflight requests:
zgrok http 3000 --header "Access-Control-Allow-Origin: *"Set defaults in config
Save your commonly used settings:
# ~/.zgrok/config.yaml
default_port: 3000Then just run zgrok http. No port argument needed.
default_subdomain: myapp belongs here too, on Pro: it is the same claim as
--subdomain, so the same plan rule applies. On Free the CLI cannot claim the
name, prints Previous subdomain unavailable, requesting a new one... and
starts the tunnel on a fresh address instead.
Inspect and replay a delivery
The terminal line above tells you the webhook arrived. To see the signature headers and the JSON payload, and to send that exact delivery to your handler again, open the request inspector, which every tunnel runs on your own machine:
Inspect: http://127.0.0.1:4040
Click the request to see its full headers and body, then press Replay. zgrok sends the captured bytes straight to your local app, not back out through the tunnel, so Stripe or GitHub never sees the retry and nothing fires again on their side. Your own handler does run again in full, side effects included, which is the point.
That turns webhook development into a normal edit-and-rerun loop: trigger the event once in the provider's dashboard, then replay that one delivery against your handler until it is right. No test payments, no waiting for the next push, and the signature headers stay byte-identical so signature verification is exercised for real.
The inspector keeps the last 50 requests, in memory, for the life of the tunnel. It is on by default; --no-inspect turns it off.
See also
- Webhooks on localhost: what the tunnel does to a signed request, and which address to register
- Request Inspector: full headers, bodies, and replay
- Custom Headers: inject response headers
- Configuration: save default settings