Setting Up Webhooks for Local Development
When developing applications that use webhooks, you’ll need a publicly accessible URL that ContactManager can reach. This is a challenge when developing locally, as your development server typically doesn’t have a public URL.Why Localhost Doesn’t Work
Webhooks can only send data to publicly accessible URLs. When you’re developing locally:- Your machine doesn’t have a public URL that our servers can reach
- Local addresses (localhost, 127.0.0.1) are blocked for security reasons
- Private network addresses (192.168.x.x) are not reachable from the internet
Using Tunneling Services
The solution is to use a secure tunneling service that creates a public URL for your local development server. The most popular options are:- ngrok
- Cloudflare Tunnel
- localtunnel
ngrok is a widely used tunneling service that’s perfect for webhook development.
Setup Steps
-
Install ngrok
- Start your local server Start your application server on a local port (e.g., port 3000)
-
Create a tunnel with ngrok
-
Use the provided URL
ngrok will display a URL (e.g.,
https://abc123.ngrok.io). Use this as your webhook URL in the ContactManager dashboard.
Example Output
Benefits
- Free tier available
- Simple setup
- Web interface for inspecting requests
- Supports custom domains (paid plans)
Verifying Webhook Requests Locally
When developing locally, you’ll want to examine the webhook payloads for debugging:- ngrok Inspector
- Request Logging
ngrok provides a built-in inspector that shows all HTTP traffic:
- Start ngrok as usual
- Open
http://localhost:4040in your browser - View all incoming webhook requests in real-time
- Inspect headers, body, and other details
Testing Webhook Flows
To fully test your webhook implementation during development:- Use the dashboard test tool The ContactManager dashboard provides a test tool to send sample webhook events to your endpoint.
- Trigger real events Perform actions in your test environment (like creating a user or following someone) to trigger real webhook events.
- Check webhook logs In the ContactManager dashboard, you can view detailed logs of webhook deliveries, including response codes and timing.