generate_and_save_flow
Build a complete WhatsApp flow from a plain-English description and save its node graph atomically in one step.
Instructions
Generate a complete WhatsApp flow from a plain-English description and save it fully in one step.
INSTRUCTIONS FOR THE AI:
Read the description and design the full node graph.
Build the nodes[] and edges[] arrays using the schema below.
Call this tool with name, description, triggerType, nodes, and edges — all in one shot.
The tool will create the flow AND save the node graph atomically.
WapiSender Flow Node Types:
trigger: { type: "trigger", data: { match: "any"|"contains"|"exact"|"regex", keywords: string[] } }
send_message: { type: "send_message", data: { messageType: "text"|"image"|"video"|"document"|"audio"|"voice"|"buttons"|"list"|"location"|"poll"|"sticker", text?: string, mediaUrl?: string, audioUrl?: string, stickerUrl?: string } }
condition: { type: "condition", data: { source: "last_message"|"custom", variableName?: string, operator: "equals"|"contains"|"starts_with"|"ends_with"|"regex", value: string } } condition has two output handles: "true" and "false"
delay: { type: "delay", data: { amount: number, unit: "seconds"|"minutes"|"hours"|"days" } }
webhook: { type: "webhook", data: { method: "GET"|"POST"|"PUT"|"PATCH"|"DELETE", url: string, headers?: object, body?: string, responseVariable?: string } }
wait_for_reply: { type: "wait_for_reply", data: {} }
human_handoff: { type: "human_handoff", data: { message?: string, resumeAfterMinutes: number } }
ai_agent: { type: "ai_agent", data: { mode: "reply"|"router"|"extract", credentialId: string, provider: string, model: string, systemPrompt: string, promptTemplate: string, outputVariable: string } }
end: { type: "end", data: {} }
Edge format: { id: "e1", source: "nodeId", target: "nodeId", sourceHandle?: "true"|"false" } Positions: spread nodes with ~250px vertical spacing starting at { x: 250, y: 100 }
Example: "A support flow that greets the user, asks if they need sales or support, then routes accordingly" → trigger → send_message("Hello! Do you need Sales or Support?") → wait_for_reply → condition(reply contains "sales") → [true: end-sales, false: end-support]
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"description": "<description>",
"nodes": "<nodes>",
"edges": "<edges>"
},
"name": "generate_and_save_flow"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the new flow | |
| edges | Yes | Generated flow edges connecting the nodes | |
| nodes | Yes | Generated flow nodes matching the node schema above | |
| description | Yes | Plain-English description of the flow behavior | |
| triggerType | No | message_received | |
| triggerConfig | No |