zapier code formatter & linter

Zapier code actions support javascript (node) and python. JS actions run in an async context with `inputData` (mapped fields), pre-provided `fetch`, and either `return` or `callback(err, output)` for results. python actions use `input_data`, `output`, `StoreClient`, and `requests`. the node stdlib is available; the only npm package is `@zapier/zapier-sdk` (toggle it on in the editor's Packages panel).

javascriptzapier
input
const name=inputData.name
return {greeting:"hi "+name}
output
format your own zapier code →free, no signup, runs in your browser

working inside zapier? the codefmt Chrome and Firefox extension adds a right-click Fix with codefmt in the code editor, so you format and lint in place without copy-pasting in and out of this page.

why standard formatters fail on zapier code

standard formatters and linters fail on Zapier code because it uses top-level await and bare return statements. codefmt wraps your code in the correct async function before formatting, then strips it back, so you get clean, formatted code that works directly in Zapier.

zapier javascript globals

code by Zapier lets you write custom javascript or python to transform data, make API requests, and connect services. your javascript runs inside an async function with access to inputData (mapped fields), output (assignable result), fetch, callback, and console.

zapier python support

codefmt also supports Zapier python code with input_data, output, StoreClient, and requests as registered globals, so they aren't flagged as undefined. codefmt lints javascript with oxlint and python with Ruff, catching common mistakes in both languages before you publish your zap.

frequently asked questions

why does Prettier fail on my Zapier code?

Zapier code runs inside an invisible async function wrapper. this means top-level await and bare return statements are valid inside Zapier, but invalid as standalone javascript. Prettier tries to parse your code as a complete program and fails. codefmt handles this automatically by wrapping your code before formatting and stripping the wrapper afterward. it also detects Zapier's newer sdk-in-code form (top-level `import` and `export default async function main(...)`) and parses it at module scope so the same Prettier-style parse error doesn't happen there either.

what globals are available in code by Zapier?

code by Zapier javascript injects inputData (your mapped input fields), output (assignable result), fetch (preinstalled, no require needed), callback for async completion, and console. the node standard library and fetch are available; the only npm package you can import is @zapier/zapier-sdk (enable it via the Packages panel in the code editor). codefmt recognizes all of these and won't flag them as undefined.

can I use async/await in Zapier code?

yes. Zapier wraps your code in an async function, so top-level await works directly. you can also use return to send data to the next step, or call callback(err, output) for classic async-completion. codefmt preserves your async/await patterns during formatting.

can I use lodash or other npm packages in Zapier code?

not for general npm modules. lodash, axios, and moment are not available and cannot be required. the one exception is @zapier/zapier-sdk, which you enable via the Packages panel in the code editor; it lets you call your connected Zapier app actions and make authenticated http requests through Zapier. for anything else you either inline the logic or move to a different platform.

what globals are available in Zapier python code?

Zapier python code injects input_data (mapped input fields), output (assignable result dict), StoreClient (class for Zapier's key-value store: store = StoreClient('secret')), and requests (preinstalled http library). codefmt formats python code with Ruff and recognizes all of these globals.

primary source: Zapier: Use JavaScript code in Zaps