Formatting Entries for JSON with Arrays

I need to send a JSON payload in a specific format which includes an array. Ideally it would be great if I could structure a Raw Data output and include merge tags from the form output.

Here’s an example of the payload JSON structure as specified in the Braze documentation here - POST: User Track

curl --location --request POST 'https://rest.iad-01.braze.com/users/track' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-API-KEY-HERE' \
--data-raw '{
  "attributes": [ 
  {
    "external_id":"user_identifier",
      "string_attribute": "fruit",
      "boolean_attribute_1": true,
      "integer_attribute": 25,
      "array_attribute": ["banana", "apple"]
    }
    ],

Is it possible to format the webhook for GF in this way?

Hi @jgiroux - assuming you are using the Gravity Forms Webhooks Add-On, you can use the gform_webhooks_request_headers filter to add your own authorization headers. There are a few examples of this in the documentation for the hook: https://docs.gravityforms.com/gform_webhooks_request_headers/

The nested JSON you need for the Braze API is not supported by the Webhooks Add-On natively. We do have an open request with the product team, and I added your use case as an additional insight.

You can use the gform_webhooks_request_data filter to create your own array of data, including using nested arrays. The array you return via the filter will then be JSON encoded by the add-on before being sent to the designated endpoint:

An alternative solution would be to use the third-party Gravity Flow add-on which has an outgoing webhook step which supports defining the request body using JSON in a textarea setting.

If you have any other questions about setting this up, please let us know.

1 Like

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