Skip to main content
The Code integration lets advanced users run small JavaScript snippets inside automation flows or live agent actions. Use it for last-mile customization when built-in steps almost solve the workflow but you need to transform, validate, format, or calculate something first. Examples:
  • Normalize phone numbers before dialing.
  • Convert a webhook response into fields an agent can use.
  • Calculate a lead score.
  • Choose a local-presence number based on area code.
  • Route by date, time window, or custom business rules.
Code is not a general-purpose serverless environment. It runs in a restricted sandbox with time, memory, network, and security limits.

How it works

A Code step receives prior node outputs through an inputs object. Your script returns a JSON-serializable value. That return value becomes the step output and can be mapped into later steps or agent actions.

Configuration

Use variables from prior steps

Use the data picker to insert references to previous outputs. References are inserted as inputs['nodeId'].fieldName paths. Example:

Limits

Typical limits include:

Blocked capabilities

The sandbox blocks risky or platform-level operations, including:
  • Network calls such as fetch, XMLHttpRequest, or WebSocket
  • Node.js built-ins such as require or process
  • Code generation such as eval, new Function, or dynamic import()
  • Known sandbox escape patterns
  • Obvious infinite loops
If your workflow needs external API access, use a webhook or integration step before or after the Code step.

Examples

Validate an email address

Calculate a lead score

Route by area code

Best practices

  • Keep scripts short and focused.
  • Return structured JSON objects, not long strings.
  • Use webhooks or CRM steps for external API calls.
  • Test with realistic sample data before going live.
  • Avoid putting secrets in code.