Prompt
How do I test a webhook endpoint locally?
Latest observation
Oct 5, 2026
OpenAI APIWeb search: off
A few common ways:
1) Run your server locally
Start your webhook handler on a local port, e.g. http://localhost:3000/webhook.
2) Send a test request with curl or Postman
Example:
curl -X POST http://localhost:3000/webhook \
-H "Content-Type: application/json" \
-d '{"event":"test","id":"123"}'
This is the simplest way to verify:
- your endpoint accepts the right method
- it parses the body correctly
- signature/auth validation works
- your handler returns the expected response
3) Expose your local server to the internet
If the webhook provider needs a public URL, use a tunneling tool like:
- ngrok
- Cloudflare Tunnel
- localtunnel
Example with ngrok:
ngrok http 3000
It gives you a public URL like:
https://abc123.ngrok.io/webhook
Point the webhook provider to that URL.
4) Replay real webhook payloads
If the provider supports it, use:
- their dashboard’s “send test event” feature
- CLI tools
- saved payloads from production logs
5) Log the raw request
When testing locally, log:
- headers
- raw body
- query params
- request method
This helps a lot with signature verification issues, because many providers require the exact raw body.
6) Use a mock webhook sender
You can simulate a webhook by writing a small script that POSTs to your endpoint.
Example Node.js:
import fetch from "node-fetch";
await fetch("http://localhost:3000/webhook", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ event: "payment.succeeded", id: "evt_123" })
});
Common gotchas
- Webhooks usually require POST
- Some providers require the raw body, not parsed JSON
- Your endpoint may need to respond quickly with
2xx - If testing through a tunnel, the URL can change when you restart the tunnel
- Make sure your local firewall isn’t blocking the port
If you want, I can show you how to test a webhook locally in Node.js, Python, or Go, including signature verification.