Testing Webhooks Locally with Ngrok
Last updated on an hour ago
When developing integrations with third-party services like Twilio, Telnyx, or Stripe, we often rely on webhooks—requests sent from public services to our backend. However, during development, our backend typically runs on a local machine behind a NAT or firewall, making it inaccessible from the outside world. This is where Ngrok comes in.
🌍 What is Ngrok?
Ngrok is a tunneling service that exposes your local server to the internet via a secure URL. It creates a public HTTPS endpoint that forwards requests to your localhost. This is ideal for testing webhooks, APIs, or any local services that need to be accessed remotely.
🔗 Official Docs: Ngrok Documentation
🕒 When to Use Ngrok
You should use Ngrok when:
Testing webhooks from third-party services like Twilio, Stripe, or GitHub.
Developing and debugging APIs locally before deploying to the cloud.
Demoing or sharing your local web app with teammates or clients.
Running serverless functions (e.g., Firebase Functions) locally that need external triggers.
Image Reference: https://youtu.be/1iVQEFi_bhc?si=lx8iP82o775xqnqu
👨💻 Who Should Use It?
- Backend developers who integrate with external services.
- Full-stack engineers testing full request-response cycles locally.
- QA and DevOps teams simulating real-world scenarios before deployment.
- Startup teams and solo developers who want to move fast without needing public cloud deployments for every test.
🚀 How to Use Ngrok
Here’s a step-by-step guide to run and test a webhook using Ngrok:
Step1:
Create a Ngrok account https://dashboard.ngrok.com/login
Step2:
Go to https://ngrok.com/ download Ngrok
Mac:
1 |
|
1 |
|
1 |
|
Windows:
1 |
|
1 |
|
1 |
|
Ngrok service url
My Ngrok url Example(https://mutual-driven-warthog.ngrok-free.app)
Step3:
Config Service Webhook URL:
Take my Twilio Webhook service for example
1 |
|
Step4:
Copy whole URL to Third Party Webhook setting
1 |
|
Step5:
Use Postman Testing Webhook
Twilio Example:
1 |
|