Prompt
How do I test webhooks locally for a messaging app?
Latest observation
To test webhooks locally for a messaging app, you usually need to make your local server reachable from the internet, because the messaging provider has to send webhook requests to a public URL.
Common options
1. Use a tunneling tool
This is the most common approach.
Tools:
- ngrok
- Cloudflare Tunnel
- localtunnel
- Tailscale Funnel (in some setups)
How it works:
- Run your app locally, e.g. on
http://localhost:3000/webhook - Start a tunnel
- Get a public HTTPS URL, like
https://abc123.ngrok.io - Configure your messaging app provider to send webhooks to that public URL
- The tunnel forwards requests to your local machine
Example with ngrok:
ngrok http 3000
Then set your webhook URL in the provider dashboard to:
https://abc123.ngrok.io/webhook
2. Use a webhook request inspector
If you just want to see what the provider sends without fully running your app, use:
- Webhook.site
- RequestBin
- Pipedream webhook endpoints
These give you a temporary public URL and show incoming payloads.
3. Expose your local app with HTTPS directly
This is less common, but you can:
- use a reverse proxy
- set up a public test server
- deploy a temporary staging environment
This is useful if your provider requires a stable URL.
Basic local testing workflow
-
Run your webhook handler locally
- Example:
localhost:3000/webhook
- Example:
-
Start a tunnel
- Example:
ngrok http 3000
- Example:
-
Copy the public HTTPS URL
-
Register that URL with your messaging provider
- Slack, Telegram, Twilio, WhatsApp Cloud API, Discord, etc.
-
Send a test event
- Trigger a message, subscription event, delivery receipt, etc.
-
Inspect logs
- Watch your local server console to verify the request body, headers, and signature checks
Things to watch out for
- HTTPS is often required
- Most messaging platforms require secure webhook URLs.
- Webhook signature verification
- Test that you validate request authenticity correctly.
- Keep the tunnel running
- If the tunnel closes, the webhook stops working.
- Use a stable path
- Example:
/webhook/events
- Example:
- Handle retries
- Providers may resend webhooks if your server doesn’t return
200 OKquickly.
- Providers may resend webhooks if your server doesn’t return
- Avoid leaking secrets
- Don’t expose production credentials in your local environment.
Example for a Node/Express app
import express from 'express';
const app = express();
app.use(express.json());
app.post('/webhook', (req, res) => {
console.log('Webhook received:', req.body);
res.sendStatus(200);
});
app.listen(3000, () => console.log('Listening on 3000'));
Then:
ngrok http 3000
Set the provider webhook URL to:
https://your-ngrok-subdomain.ngrok.io/webhook
If you tell me the platform
If you want, I can give you exact steps for a specific messaging app like:
- Slack
- Telegram
- WhatsApp Cloud API
- Twilio
- Discord
- Facebook Messenger