Webhook addon: Formatting json in body [REOPENED]

Hi there,

I’m trying to use the webhook addon to send a post request with a json body to an API. For the most part everything works, except I can’t workout how to format the json with nested properties. The snippet below shows the format I’m trying to achieve but which I cannot workout how to get the syntax correct.

“summary”: “testing”,
“id” : 19853
“contact”: {
“id” : 1186
“initialDescription”: “Hello testing initial description”,
“initialInternalAnalysis”: “powesrshell goes here”

I have created the keys as shown below but this does not give the output I had hoped for. Can anyone shine some light on how I might produce the json above?


1 Like

I’m afraid it’s not currently possible to define that structure via the feed settings, we do have it on the feature request list for consideration by the development team when planning future versions of the add-on.

You could use the gform_webhooks_request_data filter in the theme functions.php file or a custom functionality plugin 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.

Hey All,
I am having the same issue as well, and just came across this thread. I have my webhook ALMOST working, I am almost there! I’m not sure how I would use the gform_webhooks_request_data filter to pass the emails array in my example below to my API. I read the documentation, and since this is all new to me, the documentation examples didn’t really help. Looking for some guidance.

“firstName”: “James”,
“lastName”: “Gordon”,
“emails”: [
“type”: null,
“email”: "jim@gotham.city.us",
“dateCreated”: “2004-10-31T14:35:00Z”,
“isPreferred”: true

I ended up purchasing the gravityflow plugin which made this whole thing much easier. I recommend giving it a go

Basically, I am looking for help from the community for how to use the gform_webhooks_request_datato format JSON Body with nested arrays.

Just need some help & guidance on how I would use this to do this. I’ve already configured most of the webhook, just need to figure out this last part.

Curious if anyone else has use the gform_webhooks_request_data like this before, and if they can offer some guidance to someone new to this.

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.