The short answer
A custom code action is a workflow step that runs JavaScript or Python on HubSpot's serverless runtime and can pass named outputs to later steps. HubSpot documents it for Data Hub Professional and Enterprise. A connected-app action is a separate way to run code in the same workflow.
HubSpot’s Custom code action is a step inside a workflow. You give it JavaScript or Python, pass in CRM properties, and define outputs the next step can use. HubSpot documents the action for Data Hub Professional and Enterprise, and it describes the runtime as a serverless function managed with AWS Lambda.
That is the native action. It is not the same thing as a custom-coded module on a page, a tracking code, or a private app by itself. The search “HubSpot custom code” usually means this workflow step.
What the action is for
HubSpot’s own examples are operational jobs the standard actions do not express: weighted lead rotation, formatting an international phone number, archiving or deleting contacts, deduplicating contacts, and completing the tasks on a closed deal. The pattern is the same in each case. A record enrolls, the code applies a rule HubSpot does not ship as a button, and a later step writes the result back.
JavaScript uses the Node.js runtime. Python is documented as a beta, selected from the language menu on the action. Both languages have a fixed list of libraries. See npm packages in workflows and Python in HubSpot workflows before assuming a package you use locally is installed there.
What you pass in and what you get back
You can include up to 50 properties. Each property is added once, with its own name in the code. Secrets, such as a private app token, are attached on the action rather than pasted into the script. The app behind a token still needs the scopes for the data the code reads.
Outputs are declared on the action: a data type and a name. An Edit records step can map a matching output onto a property. Datetime outputs need UNIX milliseconds. A date property also needs midnight UTC. If the code returns a value you did not declare, the test result warns you, and later steps cannot use it until you add the output.
A test runs the code against a record you pick. HubSpot states that changes from that test apply to the record. Use a record you can afford to change.
Where the native action stops
The documented execution limits are 20 seconds and 128 MB of memory. The library list is closed. Multiple secrets in one action must stay within 1,000 characters combined. A rate limit you turn on pauses that action and the steps after it. The full set is in HubSpot custom code limitations. The timeout error itself is covered in the 20-second timeout.
Those limits are enough for a short calculation or a single API call. They are the wrong shape for a document, a paginated import, or a package HubSpot does not list.
The other way to put code in the workflow
HubSpot also lets a connected app register its own workflow action. That action appears in the editor, accepts mapped inputs, and can return values to later steps. It does not turn on Data Hub, and it does not open HubSpot’s native code editor. Custom code without Data Hub separates those two paths.
Turbyn is that kind of action. You write and test the code in Turbyn, publish a build, and add the Turbyn step to the workflow. Start from a job you already recognize in custom code examples, or open the recipe library.
Sources and references
- HubSpot: custom code actions, inputs, outputs and runtime limits
- HubSpot: available workflow actions and connected apps
Source documentation checked for this update. Availability can vary by subscription and account.