Feb 6, 2023 5:40 PM
Hi all
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:
details__legalType
details__sortCode
details__accountNumber
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:
curl -X POST "https://api.sandbox.transferwise.tech/v1/accounts" \
-H "Authorization: Bearer <your api token>" \
-H "Content-Type: application/json" \
-d '{
"details": {
"legalType": "PRIVATE",
"sortCode": "40-30-20",
"accountNumber": "12345678"
}
}'
Solved! Go to Solution.
Feb 7, 2023 4:56 AM
Hi @Peta_APB,
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 :
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. Any problem with Hubspot you need help solving ? Let me know ! |
Feb 7, 2023 4:56 AM
Hi @Peta_APB,
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 :
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. Any problem with Hubspot you need help solving ? Let me know ! |
Feb 28, 2023 11:32 PM
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.