How to create workflow with Custom workflow action?
SOLVE
I want to create a workflow in HubSpot using PHP and attach a custom workflow action during its creation. Can anyone guide me on how to do this? I’ve checked the documentation but couldn’t find anything.
As far as I have been able to determine, these APIs can display the details of custom code actions in any query for a given workflow, but cannot suppprt the creation/update of code sections in that workflow step.
Bottom line, this maybe needs a HubSpot update to round out the implementation.
Sep 17, 20259:19 AM - edited Sep 17, 20259:45 AM
Top Contributor
How to create workflow with Custom workflow action?
SOLVE
@KPadhiyar What is your action expected to do? It seems like it's missing field data. That's probably why you're getting an error.
Eg,
Here is an action that updates the Deal Name to include the company name. As you can see the fields property has more properties showing what it's going to do. Sorry, it's in JSON format.
{
"actionId": "4",
"secretNames": [],
"sourceCode": "exports.main = async (event, callback) => {\n /*****\n Use inputs to get data from any action in your workflow and use it in your code instead of having to use the HubSpot API.\n *****/\n const email = event.inputFields['email'];\n /*****\n Use the callback function to output data that can be used in later actions in your workflow.\n *****/\n callback({\n outputFields: {\n email: email\n }\n });\n}",
"runtime": "NODE20X",
"inputFields": [],
"outputFields": [],
"type": "CUSTOM_CODE"
}
I'm not sure I can extrapolate what you intend with just 'fieldName' => 'fieldValue'. Are you trying to set the value of fieldName on the object? If so, you are missing additional properties.
The easiest way to get the structure is to make a similar workflow in Hubspot and do a GET request on it. You can then see how it's built. Much easier than trying to figure out the documentation.
Unless you mean you want to create a Custom Code Action:
{
"actionId": "4",
"secretNames": [],
"sourceCode": "exports.main = async (event, callback) => {\n /*****\n Use inputs to get data from any action in your workflow and use it in your code instead of having to use the HubSpot API.\n *****/\n const email = event.inputFields['email'];\n /*****\n Use the callback function to output data that can be used in later actions in your workflow.\n *****/\n callback({\n outputFields: {\n email: email\n }\n });\n}",
"runtime": "NODE20X",
"inputFields": [],
"outputFields": [],
"type": "CUSTOM_CODE"
}
But it's literally easier to just build the workflow or actions you want in Hubspot, then use a GET request on it and copy the action data.
Sep 17, 20259:19 AM - edited Sep 17, 20259:45 AM
Top Contributor
How to create workflow with Custom workflow action?
SOLVE
@KPadhiyar What is your action expected to do? It seems like it's missing field data. That's probably why you're getting an error.
Eg,
Here is an action that updates the Deal Name to include the company name. As you can see the fields property has more properties showing what it's going to do. Sorry, it's in JSON format.
{
"actionId": "4",
"secretNames": [],
"sourceCode": "exports.main = async (event, callback) => {\n /*****\n Use inputs to get data from any action in your workflow and use it in your code instead of having to use the HubSpot API.\n *****/\n const email = event.inputFields['email'];\n /*****\n Use the callback function to output data that can be used in later actions in your workflow.\n *****/\n callback({\n outputFields: {\n email: email\n }\n });\n}",
"runtime": "NODE20X",
"inputFields": [],
"outputFields": [],
"type": "CUSTOM_CODE"
}
I'm not sure I can extrapolate what you intend with just 'fieldName' => 'fieldValue'. Are you trying to set the value of fieldName on the object? If so, you are missing additional properties.
The easiest way to get the structure is to make a similar workflow in Hubspot and do a GET request on it. You can then see how it's built. Much easier than trying to figure out the documentation.
How to create workflow with Custom workflow action?
SOLVE
Hi @KPadhiyar , may I ask if you have any solution for this? I'm also trying to build workflows with custom workflow action that I've created via custom action endpoint.
How to create workflow with Custom workflow action?
SOLVE
Hi @SSun7 Thank you for reaching out to the Community! Just to clarify—are you asking if there’s a way to set up a workflow using the custom action you’ve already built via a custom action endpoint, or are you looking for guidance on how to create the custom action itself? I'd like to invite some community members who are subject matter experts to join this conversation. @SteveHTM@MichaelMa@nickdeckerdevs1 - Would you be able to share any insights on this? Your expertise would be greatly appreciated. Best, Victor
Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth. Learn More
How to create workflow with Custom workflow action?
SOLVE
I want to create a workflow with a custom workflow action via this endpoint https://developers.hubspot.com/docs/api-reference/automation-automation-v4-v4/workflows/post-automat.... I've created that custom workflow action to my public app so that every user who installs my public app would be able to see & use that custom workflow action. Currently, what I'm trying to achieve is to also create a demo workflow with that custom workflow action for each user who installs my app so that they can know how to use our workflow action. Our custom workflow action has an action url and options url that would send request to our served backend.
Unless you mean you want to create a Custom Code Action:
{
"actionId": "4",
"secretNames": [],
"sourceCode": "exports.main = async (event, callback) => {\n /*****\n Use inputs to get data from any action in your workflow and use it in your code instead of having to use the HubSpot API.\n *****/\n const email = event.inputFields['email'];\n /*****\n Use the callback function to output data that can be used in later actions in your workflow.\n *****/\n callback({\n outputFields: {\n email: email\n }\n });\n}",
"runtime": "NODE20X",
"inputFields": [],
"outputFields": [],
"type": "CUSTOM_CODE"
}
But it's literally easier to just build the workflow or actions you want in Hubspot, then use a GET request on it and copy the action data.
How to create workflow with Custom workflow action?
SOLVE
Hi Michael,
I think the webhook action is the one I need. Could you send me the link to the documentation of webhook action please so I could get a better understanding of it. Thanks.
How to create workflow with Custom workflow action?
SOLVE
Hi Michael, actually the method to build a workflow with custom workflow action then GET it to check its details worked for me. But I still have a few questions regarding it. The actionTypeVersion is 1 and actionTypeId is 1-xxxxx (the xxxxx is the id of my custom workflow action) and I'm wondering if there's any documentation on the choose and formatting of actionTypeVersion and actionTypeId for custom workflow action so that I could better understanding this payload. Thanks.
How to create workflow with Custom workflow action?
SOLVE
@SteveHTM@Josh Thanks for the reply. I can't get it what I need to do. Do you've any example for me so I can do it? FYI: I'm using PHP language for this.
As far as I have been able to determine, these APIs can display the details of custom code actions in any query for a given workflow, but cannot suppprt the creation/update of code sections in that workflow step.
Bottom line, this maybe needs a HubSpot update to round out the implementation.