Skip to main content

Webhooks and API access are available to Enterprise customers. Using webhooks as a Developer? Apply to become a certified Developer. For consultation on how to best use webhooks and the NationBuilder API, please email [email protected].

How to test Webhooks

       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:

  1. Download the latest version of ngrok.

  2. Double-click on the downloaded .dmg (or .exe file if you are using Windows) to install ngrok.

  3. Once ngrok finishes installing, you will see this:

    ngrok_installation.png
  4. Close out of the ngrok terminal (or command prompt if you are on Windows) installation window.

  5. 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:

    ngrok_starting_server_mac.png

    From here, you now have an external URL to use as the "Endpoint URL" to test your Webhook.


  6. 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". 

  7. 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". 

  8. 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

    ngrok_web_interface_chrome.png

    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!