The popular Gravity Forms plugin for WordPress has an addon called "Webhooks" which allows you to send form data to a custom URL endpoint.
However it is limited because only string values can be sent. This plugin allows you to send arrays & objects (using psudo JSON syntax) as well as int values.
It's a bit hacky, so please read the Usage and Example sections below.
- Append
_as_json'
in the field name. - Use JSON syntax with SINGLE QUOTES in the field value.
The
_as_json
suffix will be removed in the final output.
You can still send form data using the default
{fieldName:fieldId}
syntax. This will be resolved before the string is converted to JSON
- Append
_as_int
in the field name - Enter integer values in the field value
The
_as_int
suffix will be removed in the final output.
In the Gravity Forms Webhook GUI:
# Note the use of single quotes
users_as_json: {{'name':'John','gender':'male'}, {'name':'Jill','gender':'female'}}
This will output:
// Note '_as_json' is truncated
users: {
{
name: "John",
gender: "male"
},
{
name: "Jill",
gender: "female"
}
}
In the Gravity Forms Webhook GUI:
answer_as_int: 42
This will output:
// Note '_as_int' is truncated
answer: 42