Skip to content
← All guides

Can you run custom code in HubSpot workflows without Data Hub?

Understand the difference between HubSpot's native custom code action and a connected-app action, including workflow access, input mapping and safe testing.

Turbyn · Published · Updated

The short answer

Yes, through a connected app such as Turbyn rather than HubSpot's native custom code action. You still need access to the relevant HubSpot workflow and downstream actions. The code runs on the app's infrastructure; installing an app does not unlock other HubSpot subscription features.

Separate workflow access from code execution

HubSpot lists its native Custom code action under Data Hub Professional and Enterprise. It documents connected-app actions separately. An app action is an integration point, not a way to change the permissions of the native action.

Before choosing a tool, check three things in your account:

  1. Can you create the required workflow and enroll the intended object?
  2. Is the connected app’s action available after installation?
  3. Can the next step use its outputs and perform the update you need?

Avoid deciding from an unlocked-looking card alone. Test the full sequence in the account that will run it. Subscription features and beta experiences can differ.

What runs where

Part Where you work
Enrollment and subsequent steps Your HubSpot workflow
Code, packages and test inputs Turbyn
Execution and retained run results Turbyn’s runtime and run history
Choosing a returned value for the next step Your HubSpot workflow

The code does not run inside HubSpot’s native custom code sandbox. It has Turbyn’s own runtime and package constraints. See plan allowances and package compatibility.

A small first action

Start with a calculation that makes no network requests and writes no records. This complete Turbyn JavaScript handler reads numeric inputs and returns a number output:

exports.main = async (event) => {
  const { amount, rate } = event.inputs;
  if (!Number.isFinite(amount) || !Number.isFinite(rate)) {
    throw new Error("amount and rate must be numbers");
  }
  return { number: Math.round(amount * rate * 100) / 100 };
};

Synthetic test event:

{ "inputs": { "amount": 12000, "rate": 0.08 } }

Expected returned JSON:

{ "number": 960 }

Map the deal amount and your commission rate into the step’s Inputs JSON. Then select the Turbyn action’s number output in the next step. Returning a value does not itself update the deal.

This is a simple percentage example, not a complete compensation policy. Define rounding, currencies, eligibility and exceptional cases before using it for business decisions.

Move existing code deliberately

Do not confuse event.inputs in Turbyn with event.inputFields in native HubSpot examples. Check the handler contract, replace credential access with the appropriate secret binding, and test missing values.

A test is not a guarantee of harmlessness: external requests made by your code are real. Start with a pure calculation, then test the workflow handoff on a dedicated record.

When to stay with native actions

If your existing subscription and native actions already express the rule clearly, use them. Turbyn is relevant when you need a code-owned step, compatible libraries or a different execution budget. It does not replace HubSpot’s wider data-management features.

Sources and references

Source documentation checked for this update. Availability can vary by subscription and account.

Questions from this guide

No. Turbyn supplies its own workflow action. You write and test code in Turbyn, then configure the Turbyn step in HubSpot.

Continue reading