Grab and use response from a webhook request

I am sending data from a form to an external server using the webhooks addon. The API returns an id in response like shown below:

body: [{"id":"c4120194-af09-46df-905c-xxxxxxxxxxxx"}] 

I have another form on the website and I am using another webhook to send data to an external site. I want to use the id above in the other form’s request URL. I have created a custom merge tag and have the script ready to replace data of the merge tag with the id received. I am having issues in saving the ‘id’ response and using it to replace the value of merge tag.

I know gform_webhooks_post_request_FORMID can be used to log response but need some guidance on how to grab and use the response from here.

Hi Jarrett. Can you store that ID in the entry of the first form (using the gform_webhooks_post_request hook) and then pre-populate the field in the second form, using the gform_field_value filter?

I don’t want to use the ID in the second form. The ID is supposed to be part of URL for the webhook. Something like this:

Also, how do I save the ID using [gform_webhooks_post_request] ?

Hi Jarrett. In order to get more details and help you with your specific application, can you open a support ticket here please?

Thank you.

If you would like to save the ID without requiring code to do so, the Gravity Flow Outgoing Webhook provides a response mapping feature as a part of defining the step settings. See this reply on a related topic that shows more about the setup. In your case, your merge tag would then just need to know the Entry ID and Field ID from form 1 where the ID is stored to be used in the webhook settings for step in Form 2.

If you wanted to go further and have the ID in Form 1 deleted after Form 2 executes its’ webhook successfully, the Form Connector extension has a step type for Update an Entry that offers similar no-code pattern to set the value of ID field in Form 1 to empty.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.