This should be straight forward but I don’t seem to find the answer. How do I display the return codes to a page after the form is submitted and posted through the api.
Hi Jack. The webhook runs well after the confirmation and notifications are handled, so it’s not possible to use a return code somewhere. If you need to access an API upon submission and return a code, you may want to use the gform_pre_submission or gform_pre_validation filter:
If you need to use the Webhooks Add-On for other reasons, there is a hook that runs after the webhook response:
So you could “do something” with the return code, but updating the confirmation would still not be possible because of the order of events. If you have any other questions, please let us know.
Thank you for that, but how can i check the response code without programming? How do I troubleshoot posting issues?
Hi Jack. I don’t know of a way to do it without code. To troubleshoot issues, I recommend using the built in logging, and for any custom code you add, add your own logging statements:
Enable Gravity Forms logging:
Add your own custom logging statements:
Hi Jack,
Gravity Flow’s outgoing webhook step type would be an excellent option to look at. The workflow submits prior to confirmation/notifications and provides you with a no-code approach to response mapping.
Here’s some setup screenshots and tips for the setup for a scenario using https://quickchart.io/ to show a chart to a user in their confirmation.
The form
Has 4 number fields for Q1, Q2, Q3, Q4 for revenues.
Has 4 number fields for Q1, Q2, Q3, Q4 for # of customers.
Has a single URL field (visibility = administrative) to store the generated chart URL in
The Outgoing Webhook
Is the first step in the workflow. It’s request URL/method/headers would be very similar to what you are used to with the Gravity Forms webhook add-on. In this case I’m feeding the 8 number fields into a raw (json) request body to produce a 2 line chart of revenues and customers. QuickChart docs for POST are quite good.
The response mapping settings let you define which part of the response you want to map into which field. While this example is straight forward that ‘url’ is at the top level of the response, the response mapping also supports array notation so you can get deeper values from complex responses if needed.
The Next Step options are contextual to Success (200’s), Client Error (400’s), Server Error (500’s), or any other. So you could adjust subsequent steps in the workflow if (like yesterday) the AWS US-East-1 zone was down making a lot of API connections fail. If it’s more complex/business-value than just a chart display, you might route the workflow to either a delayed retry step or an approval step for staff to investigate further.
The Confirmation
Just needs to use a merge tag with the “expected to be populated” value such as in this case. The same could be used into notifications and both would look just as pretty.
Hope that helps!
Jamie
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.