đ to the home page
In part 1 you learned how to make outgoing API calls, essentially testing how a machine (or an app you might write) to ask for information or perform actions.
Webhooks are the reverseâwhen something happens in an application, that action might send a message (a webhook) to another system to let it know. Like push notifications, but for machines instead of humans. This type of notification system for APIs is especially useful for processes that do not happen concurrently, like payments!
ngrok is a tool that allows you to create a secure tunnel from the public internet to your computer or âlocal machineâ. This is useful for testing webhooks because it allows external services and APIs to send requests to your code on computer, even when it's running locally.
If youâre unable or would prefer not to install software like this on your computer, skip down to option 2.
Instructions:
Go to ngrok and download the version for your operating system.
Install ngrok by following the setup instructions on their website.
<aside> đ
Trouble installing? We have an alternative!
It appears that you must signup for a free account to use ngrok đ itâs worth it! But if youâd prefer not to, you can use this alternative: pinggy.io which does not require any account signup.
</aside>
Open your Terminal:
Run the following command to start ngrok on port 8080 (this is the port weâll use to run our example app):
ngrok http 8080
You should see output that shows a publicly available URL (e.g., https://abcd1234.ngrok.io
) which will be labelled forwarding. This URL is now live on the internet and configured as a âforwardingâ service to your laptop. So it can be used to receive webhook events from external services!
Youâll also see a url labelled âWeb Interfaceâ, it will probably be http://127.0.0.1:4040
. Open this link in your web browser and you can see a simple interface that will show information about any incoming webhooks.
If you canât install a terminal-based command line tool like ngrok or pinggy, donât worry you can use one of these tools below: