Skip to main content
The Scripts feature lets you embed custom JavaScript directly into your campaign flows in the Campaign Builder. Use scripts to call external HTTP APIs, apply business logic, and write data back to session variables that other nodes in the flow can consume.

What scripts can do

  • Access the current customer’s phone number and session variables as input
  • Fetch any external HTTP API and parse the response
  • Return structured output data and an outcome string
  • Map output fields to session variables for use in downstream nodes

Script structure

Every script exports a single onExecute function:

Parameters

input

Contains the current session context and output from previous script nodes:

config

Contains secrets configured for the script node:

Return value

Scripts must return a tuple [data, outcome]:

Mapping output to session variables

After a script node runs, you can map its output fields to session variables for use by downstream nodes: