Incoming WebHook - Field Mapping

Request Type
The system which is sending data to the incoming webhook in one of 3 formats:
     - POST with form-data in the body of the request
     - POST with form-data in the body of the request with a Content-Type header = application/json
     - POST with raw JSON in the body of the request with a Content-Type header = application/json

Request Sanitization not Request Validation
All incoming request values are sanitized based on their field type regardless of whether you use version 1 or 2 of the Gravity Forms Web/REST API. This prevents script injections and other technically bad data from being submitted through the incoming webhook field mapping to your form entries. However, it does not validate the request values submit for required status or format. 

What does that mean exactly? 

If you have a dropdown field type set as required with options of A, B, C, D or E, mapping that field for a request it:  
     - WOULD prevent "<script>alert('Doing bad things')</script>" from being stored to DB in a bad format. 
     - WOULD NOT prevent "Banana" from being stored. 

If you need the webhook to validate request values, or source, it is suggested you use version 2 of the Gravity Forms API and refer to the  WordPress Rest API Handbook on extending the API or helpful blog posts on validating options with it.

Choice and Complex Field Types

Some field types that can have multiple selections (ex. checkboxes), or have sub-fields (ex. address), can have request values mapped to the entire field or individual data elements. The following settings field values and JSON show how they could be set as part of a raw JSON request. 

  • {"checkboxes": [{"id":"4.1","value":"Alberta"},{"id":"4.2","value":"British Columbia"},{"id":"4.9","value":"Ontario"}], "single-checkbox": "Alberta", "multiselect": ["Alberta","British Columbia","Ontario"], "name-full": [{"id":"11.3","value":"Mickey"},{"id":"11.6","value":"Mantle"}], "name-middle": "Baseball", "address-full":[{"id":"15.1","value":"Apt 1"},{"id":"15.2","value":"2nd Street"}], "address-city": "New York"}
    	

Unavailable Field Types
The majority of field types in the standard, advanced and workflow sections of the form editor are available for request mapping. A few, listed below, are not available at this time. Please contact Gravity Flow Support if you have a use case that would benefit from them being added to a future release of the add-on. 
     - File Uploads 
     - Any Post Fields (Title, Content, Excerpt, Tags, Category, Images, Custom Field) 
     - Any Pricing Fields (Product, Quantity, Options, Shipping, Total 

Mapping array values and complex objects
Values inside arrays or complex objects can be mapped to fields by using a backslash to drill down into the structure. For example, people\0\name would map "Steve" to the field if the following JSON is received:

{people: [ "Steve", "Jamie" ] }