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.
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.
搶先發佈留言