Testing webhooks with ngrok

In case you need to demo some tool or work with any tool that sends webhooks, you can use ngrok to get the result.

There are other services available, but so it worked great and has features that improve your development experience.

Install

Head to ngrok download page, and get the build. That page also describes how to install it (which is basically unzip an archive...).

How to use it

Basics

The basic format is ngrok http 8080 which exposes port 8080 of your localhost to the web via the URLs provided in the ngrok console (you should see it once the command runs successfully, see below).

Example of ngrok console

As you can see it provides HTTPS connection out of the box, which can be useful if the service you test only works with HTTPS.

You can also forward TCP requests with ngrok tcp <port>.

Dashboard

This is one of the most useful features for me. Once you activated HTTP link, you can see all requests made via this link, and what's more importantly, you can replay the request in case you need to debug it. This is super helpful in case you are testing webhooks.

Persistent URL

if you pass --subdomain argument to the ngrok, you can actually use the same URL every time, as by default it generates a new URL every time. Again, it's helpful with webhooks as you don't need to manually change the webhook URL every time.

Show Comments