A starter guide to NGROK.
Webhooks are used to detect changes to data (People, Donations, etc.) from within a nation. Sometimes you may want to verify that webhooks are firing correctly in order to troubleshoot NationBuilder integrations, and to do so, you’ll need to use a webhook testing tool. Ngrok is commonly used to test development sites on a local machine, but we can use it to test webhooks instead.
The following are the steps to use ngrok to test your nation’s webhooks:
-
Download the latest version of ngrok.
- Double-click on the downloaded .dmg (or .exe file if you are using Windows) to install ngrok.
- Once ngrok finishes installing, you will see this:
- Close out of the ngrok terminal (or command prompt if you are on Windows) installation window.
-
Open terminal (or command prompt) and type
./ngrok http 80
and press "Enter". This will start the ngrok local server on port 80.
After you have started the server, you will see a screen like this:
From here, you now have an external URL to use as the "Endpoint URL" to test your Webhook.
- Login to your nation and go to Settings > Developer > Webhooks and copy the "Forwarding" URL from above. It should look something like "
https://UNIQUENUMBER.ngrok.io
".
- Paste the "Forwarding" URL into the "Endpoint URL" for your new Webhook. Depending on which Webhook you are testing, feel free to select your choice for "When to POST", "Number of connections" and "Payload version".
-
To view the incoming request when the "When to POST" is triggered, use the URL listed from ngrok as the "Web Interface". By default, the "Web Interface" can be access through
http://127.0.0.1:4040
Once the Webhook is triggered, you will see the requests displayed in the above interface.
At this point, you will have everything you need to test your Webhook triggers using ngrok!