Custom Workflow Action returns a JSON in HubSpot

Hey HubSpot!

I’m working on a Custom Workflow Action that triggers an API call and returns a JSON response. The challenge I’m facing is that the structure of the JSON response isn’t static, so I can’t predefine the fields using the Definition API. Here’s the current output field definition I’m using:

{
 "typeDefinition": {
 "name": "crew_result_raw",
 "type": "json",
 "fieldType": "text"
 },
 "supportedValueTypes": ["STATIC_VALUE"]
}

My goal is to extract specific values from this JSON (e.g., crew_result_raw[“my_custom_key”]) and use them in other workflow actions, like sending internal email notifications. However, I haven’t found a simple way to do this.

Is there a way to dynamically parse and reference values from this JSON field in other workflows? If not, could you suggest an alternative solution for achieving this?

Thanks in advance!

Hi @vinib!
Good morning and thanks for reaching out! From my understanding, you’d like to apply JSON coding dynamically in a custom-coded workflow action to be able to use values pulled in with the code when sending internal email notifications in a workflow. Is that correct?
Had you tried implementing branches for conditional logic in the workflow and adding personalization tokens in the internal email action(s)?
Would you be able to share a screenshot of your workflow actions and another of that specific action so we have additional context?
This doesn’t look to be a default functionality that’s supported, but I found this other post that seems to get at a similar goal to yours in case you find it helpful: https://community.hubspot.com/t5/APIs-Integrations/how-to-create-dinamyc-inputs-in-my-custom-action/td-p/1000774
Tagging in HubSpot subject matter experts @Humashankar , @Danielle_J , @Jaycee_Lewis in case they have further insight. Any thoughts?

Thank you and have a great day!
Best,
Jessie
HubSpot Community Moderator

Hi @vinib

If you have JavaScript expertise, you can utilize HubSpot’s Custom Code Actions to craft a script that interprets the JSON response, extracts the required values, and stores them in a custom HubSpot property or utilizes them directly in your workflow actions.

Though, if your JSON structure is complex and varied, consider developing a middleware service to handle advanced parsing.

This service can process the JSON externally, extract specific values, and return them to HubSpot via a webhook, enabling their use in your workflow.

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Thanks @Humashankar :raising_hands: — Jaycee