Cognito-forms – Separate JSON Webhook for Repeating Sections

cognito-formszapier

Due to some limitations of the current Zapier integration I have been forced to use the JSON webhook functionality instead. The way that the repeating section data is presented through the current JSON WEBHOOK function is pretty useless. It would be nice to be able to specify a separate JSON WEBHOOK URL for repeating sections that cognito would send a new hook for each iteration of the repeating section. That would make adding "child" rows in a traditional database format so much easier than how we have to do it right now.

The current setup returns ALL data in that repeating section as one field. For instance, I have a test form with a section called "Children". That section is repeating and has 2 fields – name and sex. So when you pull the list of available fields, it lists "Children" as a single field with all the data like this:

Children:
ChildName: A
Sex: Male
ChildName: B
Sex: Female
ChildName: C
Sex: Other

Wouldn't it be easy to have another hook that would publish each item along with the parent form ID?

Best Answer

Cognito Forms allows you to post a JSON document to webhooks when new entries are submitted that accurately reflects the data being collected. Forms can be hierarchical with multiple repeating sections and even nested repeating sections, so it naturally lends itself to being expressed using JSON. Repeating sections are not stored in a single field--they are actually arrays of child entities that have their own fields and children.

For example, the form you described might look like this:

enter image description here

And the corresponding JSON looks like this:

enter image description here

As you can see, the Children repeating section is represented correctly in JSON as an array of child entities, each of which have Name and Gender fields.