Just wondering if someone can point me in the right direction with how to convert nested data into form data in a workflow webhook?
Pretty simply, I’m just configuring a POST webhook to an external application and the expected payload is in CURL.
I really just wanted some help on how to configure the nested parameters in the request body
I have the API documentation for an external application and want to send a POST webhook from a workflow in Hubspot, however I just need to understand how to configure the request body in Hubspot and keep getting a 422 error.
I can do this quite easily in Zapier using form data, but would prefer to be able to send it directly from Hubspot if I can.
In Zapier it’s simply using a double-underscore, eg:
Unfortunately, this doesn’t work in Hubspot. I’ve tried single underscore, but this fails as well. Is there any information on this somewhere? Can anyone help?
This is the expected payload, so I'm fine with everything apart from the 3 nested parameters:
You cannot customize the body of the webhook action in workflows to have nested fields.
It only sends flat JSON (unless there's a secret, undocumented method for that ? @Teun, @Anton)
There are two workarounds I can think of :
This one works for sure but you'll need an operations hub pro subscription : use the custom code action to make a custom API call using either Axios (NodeJS) or Requests (Python)
This one I haven't tried it till the end but I don't see why this wouldn't work : Use a custom property named 'details' and format it using the "format data" action
Use the custom mode and concat function to format the inside of the "details" key.
Then set up your webhook like so :
If this works for this specific use case that's nice, but if at some point you need a more advanced customisation (like support of an OAuth flow for authentication) you will have to find another way. (Either the custom code action from the Pro subscrption or a webhooks to a third party solution like make.com).
Hope this helps ! If it does, please consider marking this answer as a solution 🙂
Best,
Ludwig
CTO @ Mi4 Hubspot Platinum Partner and Integration Expert
Passionate human, very curious about everything data and automation.
You cannot customize the body of the webhook action in workflows to have nested fields.
It only sends flat JSON (unless there's a secret, undocumented method for that ? @Teun, @Anton)
There are two workarounds I can think of :
This one works for sure but you'll need an operations hub pro subscription : use the custom code action to make a custom API call using either Axios (NodeJS) or Requests (Python)
This one I haven't tried it till the end but I don't see why this wouldn't work : Use a custom property named 'details' and format it using the "format data" action
Use the custom mode and concat function to format the inside of the "details" key.
Then set up your webhook like so :
If this works for this specific use case that's nice, but if at some point you need a more advanced customisation (like support of an OAuth flow for authentication) you will have to find another way. (Either the custom code action from the Pro subscrption or a webhooks to a third party solution like make.com).
Hope this helps ! If it does, please consider marking this answer as a solution 🙂
Best,
Ludwig
CTO @ Mi4 Hubspot Platinum Partner and Integration Expert
Passionate human, very curious about everything data and automation.
Thanks @LMeert looks like we'd need operations hub for both of those workarounds unless there's a way to flatten the JSON (Zapier uses underscores, but I can't find any documentation about this in Hubspot).
Thanks for your prompt reply though 🙂 I appreciate the help.