跳至主要內容

Test your webhook locally

Managing tasks or integrating a third-party service reliant on webhooks can be a hassle. This is due to the necessity of setting up the service on your server, configuring the callback URL, and then initiating testing. Additionally, running the service on the server may introduce complications, especially during the development phase.

Is there any way to simplify and get it work easily?

Ngrok

As them claims on their website, Ngrok is an unified ingress platform 
for developers. Through this tool, you can test webhook locally.

https://ngrok.com/

You can just follow the instruction on their website or just do the following steps.

Download ngrok

wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip

If you’re using MacOS or Windows, you can just download it directly from their website.

Unzip

unzip ngrok-v3-stable-linux-amd64.zip

Move ngork file to /usr/local/bin/

sudo cp ngrok /usr/local/bin/

WHY? so you can just call ngrok directly via your commandline tool

Set your auth token

ngrok config add-authtoken {auth-token}

You can get the auth token after you sign up. If you don’t config your token, you may only have limited time to use their service.

Start ngrok

ngrok http 80

Ngrok will start a HTTP tunnel forwarding to your local port 80. Please modify the port accordingly to your service.

分類:Hands-on

搶先發佈留言

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

由 Compete Themes 設計的 Author 佈景主題