Zapier's built-in steps cover a lot, but eventually you hit something they cannot express — a non-trivial transformation, a calculation, a call that needs custom handling. Code by Zapier lets you drop into JavaScript or Python for exactly those moments. It is powerful and occasionally essential, and the skill is using it only where it earns its place rather than turning every Zap into a script.
When to reach for code
Prefer the native steps and Formatter for anything they can do — they are visible, testable in the editor, and understandable by whoever inherits the Zap. Reach for Code when you genuinely need it:
- Complex data transformation — reshaping nested arrays, custom parsing, logic beyond what Formatter offers.
- Calculations or conditionals too involved for Filter and Paths.
- Custom API interactions that need specific request shaping or response handling.
- Combining or looping over data in ways the built-in steps cannot.
Input and output
Pass data into a Code step explicitly through its input fields — map the values you need from earlier steps into named inputs, rather than assuming access. Return a plain object (or a list of objects) from the step, and those become the output fields later steps can use. Keeping inputs explicit is what makes a Code step testable and its data flow legible; a step that reaches unpredictably into prior data is a debugging nightmare.
// inputData is populated from the step's mapped input fields
const items = JSON.parse(inputData.lineItems);
const total = items.reduce((sum, i) => sum + i.qty * i.price, 0);
// Returned object becomes this step's output fields
return { itemCount: items.length, total: total.toFixed(2) };
Know the sandbox limits
Code steps run in a constrained sandbox: limited execution time, limited memory, and no arbitrary package installation. It is for logic, not for heavy processing or pulling in a dependency tree. If you find yourself fighting those limits, that is a sign the work belongs in a real service you call from the Zap, not inside a Code step.
Every Code step is logic that does not show up in Zapier's visual flow — a black box someone will have to open and read later. Keep them small, single-purpose, and commented, and reach for a native step whenever one exists. The maintainability cost of code is real; pay it only where the capability is worth it.
Code by Zapier is the right tool for the logic built-in steps cannot express — custom transformations, calculations, and API handling — with explicit inputs and outputs and an awareness of the sandbox's limits. Use it deliberately and sparingly, and it extends what a Zap can do without turning it into a script only its author understands.
Independent software engineer in Nairobi specialising in Acumatica customisations, Laravel backends, and tax fiscalisation integrations across East and Southern Africa.