All docs
Custom code
Custom code steps run JavaScript inside a sandbox when a playbook or flow reaches them. Use them to combine calls, shape responses or apply logic that is specific to your business.
Your first function
A code step exports one async function. It receives the inputs you declare and the secrets you grant, and returns output values plus the path the conversation should take next.
javascript
export default async function main(args) {
const { order_id } = args.inputVars;
const res = await fetch(
`https://api.example.com/orders/${order_id}`,
{ headers: { Authorization: args.secrets.ORDERS_KEY } }
);
if (!res.ok) return { next: { path: "error" } };
const order = await res.json();
return {
outputVars: { eta: order.eta, carrier: order.carrier },
next: { path: "success" },
};
}Runtime
- Node-compatible runtime with
fetch,cryptoandURL. - 5 second time limit and 128 MB of memory per call.
- No file system; network access only to hosts you allow-list.
Testing code steps
Run a step on its own from the editor with sample inputs, or from the CLI with parley code run. Logs and errors appear in the conversation's trace.
Something unclear?Contact supportor browse thehelp centerAll guides

