Skip to main content
Execute custom JavaScript functions deployed on Cloudflare Workers. Functions can process data, integrate with external APIs, and update workflow variables.

Configuration

  • id: Unique node identifier
  • function_id: ID of deployed function to execute
  • save_response_to: Variable name to store function response (optional)

Function context

Your function receives this data:
{
  execution_context: {
    vars: {},      // Workflow variables
    system: {},    // System info (flow_id, started_at, etc)
    context: {}    // Channel info (phone_number, etc)
  },
  flow_events: [], // Recent workflow events (last 10)
  flow_info: {
    id: "flow_123",
    name: "Customer Support",
    step_id: "current_step_456"
  },
  whatsapp_context: { // Only if WhatsApp workflow
    conversation: {},
    messages: []
  }
}

Function response

Functions can return JSON to update the workflow:
return new Response(JSON.stringify({
  vars: {
    user_score: 85,
    validated: true
  },
  next_edge: "success" // Optional: suggest next workflow path
}))

How it works

  1. Invokes function: Calls your deployed function with workflow context
  2. Processes response: Updates workflow variables from function response
  3. Continues workflow: Advances to next step via next edge
  4. Saves data: Optionally stores full response in specified variable

Usage patterns

Data validation API integration Conditional processing