You can’t listen to webhooks on localhost, right? Wrong. You can.

Webhooks are HTTP callbacks that allow external systems to notify your application about specific events. You’ll have to add the Webhook URL in the external system. When you’re developing on localhost, you can’t just provide a localhost URL — it can’t listen to the external system.

Here are the steps to follow

1) Download the tunneling software ngrok. https://ngrok.com/download

2) Extract the downloaded file.

3) In the command line, navigate to this folder. For example: if the folder is on a desktop and the folder name is “ngrok-v3-stable-windows-amd64“, you’ll probably enter commands.

cd desktop

cd ngrok-v3-stable-windows-amd64

4) Enter command:

ngrok http 80

Then, it gives you a LIVE URL like https://62d2-27-34-64-48.ngrok-free.app, which can listen to webhooks, and it’s the localhost. just like you enter http://localhost:80

If you have a specific directory and virtual host, for example: app.test

Then, you can specify that with command,

ngrok http 80 --host-header=app.test

Hurray!

How to use webhooks on localhost?

Sanjeev Aryal

Don't bury your thoughts, put your vision into reality ~ Bob Marley.

Leave a Reply

Your email address will not be published. Required fields are marked *

× WhatsApp