> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeplo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Automations

> Build visual automation flows with drag-and-drop triggers, conditions, delays, and action nodes to automate your WhatsApp customer interactions.

# Automations

Zeplo Automations provide a visual flow builder for designing complex WhatsApp workflows without writing code. Drag-and-drop nodes onto a canvas to define triggers (incoming messages, keywords, schedule), conditions (contact attributes, time of day), delays, message actions, agent assignments, and status updates. Every automation runs reliably with built-in error handling and execution logging.

> **Flow Builder**
>
> Design multi-step automation flows in a visual canvas. Connect triggers to conditions and actions with an intuitive drag-and-drop interface.

> **Triggers**
>
> Start automations from incoming messages, keyword matches, contact events, webhook payloads, or cron schedules.

> **Action Nodes**
>
> Send messages, update contact fields, assign to agents, add tags, make HTTP requests, and branch with conditional logic.

> **Execution Logs**
>
> Monitor every automation run with detailed logs showing node-by-node execution, timing, and error details for debugging.

## Basic Usage

**JavaScript/TypeScript**

```typescript theme={null}
import { Zeplo } from "@zeplo/sdk";

const zeplo = new Zeplo({ apiKey: process.env.ZEPLO_API_KEY });

// Create an automation
const automation = await zeplo.automations.create({
  name: "Welcome Flow",
  description: "Greet new contacts and collect their interests",
  status: "active",
  nodes: [
    {
      id: "node_1",
      type: "trigger",
      subtype: "keyword",
      config: { keyword: "hi", matchType: "contains" },
      position: { x: 100, y: 100 },
    },
    {
      id: "node_2",
      type: "send_message",
      config: {
        templateName: "welcome_greeting",
        language: "en",
      },
      position: { x: 300, y: 100 },
    },
    {
      id: "node_3",
      type: "update_status",
      config: { status: "greeted" },
      position: { x: 500, y: 100 },
    },
  ],
  edges: [
    { from: "node_1", to: "node_2" },
    { from: "node_2", to: "node_3" },
  ],
});

// List automations
const { automations } = await zeplo.automations.list({ status: "active" });

// Get execution logs
const logs = await zeplo.automations.getLogs(automation.id, {
  limit: 20,
  sortOrder: "desc",
});

console.log(`Automation "${automation.name}" created with ID: ${automation.id}`);
```

**Python**

```python theme={null}
import os
from zeplo import Zeplo

zeplo = Zeplo(api_key=os.environ["ZEPLO_API_KEY"])

# Create an automation
automation = zeplo.automations.create(
    name="Welcome Flow",
    description="Greet new contacts and collect their interests",
    status="active",
    nodes=[
        {
            "id": "node_1",
            "type": "trigger",
            "subtype": "keyword",
            "config": {"keyword": "hi", "matchType": "contains"},
            "position": {"x": 100, "y": 100},
        },
        {
            "id": "node_2",
            "type": "send_message",
            "config": {
                "templateName": "welcome_greeting",
                "language": "en",
            },
            "position": {"x": 300, "y": 100},
        },
        {
            "id": "node_3",
            "type": "update_status",
            "config": {"status": "greeted"},
            "position": {"x": 500, "y": 100},
        },
    ],
    edges=[
        {"from": "node_1", "to": "node_2"},
        {"from": "node_2", "to": "node_3"},
    ],
)

# List automations
result = zeplo.automations.list(status="active")
automations = result.automations

# Get execution logs
logs = zeplo.automations.get_logs(
    automation.id,
    limit=20,
    sort_order="desc",
)

print(f'Automation "{automation.name}" created with ID: {automation.id}')
```

> [!NOTE]
>
> Automations can also be created and edited in the Zeplo Dashboard's visual flow builder. The API is ideal for version-controlled, programmatic automation management.

## Node Types

| Type | Description | Key Config Fields |
| - | - | - |
| `trigger` | Entry point that starts the flow | `subtype` (keyword, message, event, schedule), `config` |
| `condition` | Branches the flow based on rules | `rules` (contact field, operator, value), `trueBranch`, `falseBranch` |
| `delay` | Pauses execution for a duration | `duration`, `unit` (seconds, minutes, hours, days) |
| `send_message` | Sends a template or free-form message | `templateName`, `text`, `type` |
| `assign_agent` | Assigns the conversation to a team member | `agentId` or `agentGroup` |
| `update_status` | Updates the contact or conversation status | `status`, `target` (contact, conversation) |

## Best Practices

> Keep flows **focused and linear** where possible. Avoid deeply nested conditions that make debugging difficult. Each flow should accomplish one clear goal — use separate automations for unrelated workflows.

> Add a fallback path after every action node. If a message fails to send (e.g., template not approved), route to a delay-and-retry node or escalate to a human agent. Always enable execution logging for production flows.

> Test every flow with the built-in simulator before activating it. Send test messages that match each trigger type and verify the expected path through the flow. Check execution logs for unexpected node skips or timeouts.

> Automations are evaluated in **priority order**. Place your most specific triggers (exact keyword match) above generic ones (contains keyword). Limit active automations per trigger type to avoid unnecessary processing overhead.

> **[API Reference: List Automations](https://docs.zeplo.ai/docs/api-reference/automations/list-automations.md)**
>
> Explore the full request schema, node configuration options, and response format for the automations endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.