Testing Webhooks locally

Webhooks originate from the server which means we cannot use localhost as an endpoint.

Fortunately there are a few tools that make working with webhooks during development much easier.

Capturing Webhooks - RequestBin 

RequestBin gives you a URL that will collect requests made to it and let you inspect them in a human-friendly way.

This is really useful in the early stages of developing an app as you can see the general shape and structure of any webhooks you need without writing a single line of code.
On the flip side, we can also use it to test our own webhooks in a real-world environment.

Developing locally - ngrok

The best tool to allow webhooks from different services to access your local development server is ngrok

It provides you a unique public URL that you can use as a webhook endpoint and will proxy the requests to your local server.

  1. Download ngrok.
  2. Start ngrok with your local server port number which you would like to test. (eg:  ./ngrok http 3000)

  3. A URL will be generated. Update this URL as your webhook URL.
     

 

See the complete documentation for more advanced features like inspecting and replaying requests.