TutorialIncoming Webhooks for Gravity Forms

Do you want to add (and process) data from an incoming webhook to your Gravity Form? You can use the Incoming Webhook Add-on from Gravity Flow to do that. We explain where to get the Add-on and give you a real example how we use it.

How to configure the incoming webhook?

To get it working, you’ll need to add to your WordPress site Gravity Forms, Gravity Flow and the Incoming Webhook Add-on. Once you’ve done that, you can go to your Gravity Form settings (settings of one specific form) and click on Incoming Webhook:

Screenshot of the Gravity Flow Incoming Webhook Form Settings.
Screenshot of the Gravity Flow Incoming Webhook Form Settings.

Click Add New and fill in your Webhook name (required):

Screenshot of saving the Gravity Flow Incoming Webhook settings for the first time.
Screenshot of saving the Gravity Flow Incoming Webhook settings for the first time.

Once you save the settings, Gravity Flow Incoming Webhooks will automatically generate a Webhook URL for you to use for connecting Webhooks from other sites to your site, like GitHub, Moodle or Paddle:

Screenshot of the Incoming Webhook settings after saving for the first time. A Webhook URL is available.
Screenshot of the Incoming Webhook settings after saving for the first time. A Webhook URL is available.

Example GitHub webhooks

In GitHub you have within the Settings page of one of your repositories a menu link to Webhooks:

Screenshot with Github Webhooks overview for a specific repository.
Screenshot with Github Webhooks overview for a specific repository.

When you click Add webhook or Edit an existing one, you can paste the Webhook URL generated by Gravity Flow inside the Payload URL. Important is to select ‘application/json’ as Content type:

Screenshot of the Github Webhook Manage Settings. Payload URL is the Webhook URL generated by Gravity Flow.
Screenshot of the Github Webhook Manage Settings. Payload URL is the Webhook URL generated by Gravity Flow.

We leave SSL verification enabled (this checks if your site has a valid SSL certificate).
You can select on which triggers GitHub should post information to your Gravity Flow Incoming Webhook. You can select to send everything, but in this example we only want to get information on a specific individual event, namely the Releases event.

Screenshot of SSL verification settings and on which events the Github action should trigger (send data to the Gravity Flow incoming Webhook)
Screenshot of SSL verification settings and on which events the Github action should trigger (send data to the Gravity Flow incoming Webhook)

By selecting Releases, we’ll get an update from GitHub whenever a release is created, edited, published, unpublished or deleted. This way we can easily update information on our site about our own Add-ons, to keep it in sync with what’s happening on GitHub (where we manage all of our plugins):

Github select trigger: Release created, edited, published, unpublished or deleted.

Once some Release action is triggered, you can check in the tab ‘Recent Deliveries’ what was send to your Incoming Webook (all fake data for this example, but it should more or less look like this):

Screenshot of Github Recent Deliveries with Request data (Headers and Payload)
Screenshot of Github Recent Deliveries with Request data (Headers and Payload)

We see that the Response gave back ‘200’ (in green), which means our WordPress website accepted our GitHub data. The most important to do in your Gravity Form Incoming Webhook settings is mapping the Payload to specific fields.

Here is our example to process the above GitHub data:

Screenshot of the Gravity Flow Incoming Webhook Field values: which Gravity Form Field should be filled with what Key from the Payload.
Screenshot of the Gravity Flow Incoming Webhook Field values: which Gravity Form Field should be filled with what Key from the Payload.

You see that when we want to map data from within an array inside the JSON, we have to us \ to target it specifically. For example we see that the release “url” is inside “release”. You can map that value by using release\url as your Key.

Screenshot of part of the Github Payload as example (only action, release and url)

In our Gravity Form we have several Single Line fields, that we named exactly like the Key, but this is not necessary, you can use any label you want.

Screenshot of the example Gravity Form to save the Incoming Webhook information.
Screenshot of the example Gravity Form to save the Incoming Webhook information.

Once this is set-up, we receive specific information on our site after we create, publish or delete releases on GitHub. Based on the values you can create follow up Workflow steps like processing this information on other places on your site or sending an automatic Twitter message or e-mail update to interested users.

Screenshot of the first entry created by processing and saving the information from the Github Payload through the Gravity Flow Incoming Webhook in the Gravity Form.
Screenshot of the first entry created by processing and saving the information from the Github Payload through the Gravity Flow Incoming Webhook in the Gravity Form.

Read more tutorials about Steve Henty S.L.

Steve Henty S.L. is the developer of Gravity Flow. Gravity Flow provides you with a huge amount of options to organize workflow steps after somebody submits a Gravity Form entry. Visit GravityFlow.io
All tutorials Steve Henty S.L.