API Reference

Workflows

Workflows enable you to orchestrate multi-step tasks with branching logic, data transformations, and loops. Build complex automation pipelines that combine agents, tools, and code execution.

What are Workflows?

Workflows are automated task sequences that execute multiple steps in order, with support for:

  • Sequential execution: Steps run one after another
  • Conditional branching: Different paths based on conditions
  • Data mapping: Transform data between steps
  • Loop constructs: Iterate over arrays or repeat until conditions are met
  • Retry logic: Automatic retries on failure
Workflows are created and configured in the Meebly dashboard, then executed via the API. Each workflow consists of steps that can be agents, tool calls, or custom code.

Workflow Step Types

Each step in a workflow can be one of three types:

Agent Steps

Call a functional agent to perform AI-powered tasks

  • ✓ Data extraction
  • ✓ Content generation
  • ✓ Decision making
  • ✓ Classification

Tool Steps

Call your backend APIs or external services

  • ✓ Database queries
  • ✓ API calls
  • ✓ File operations
  • ✓ Notifications

Code Steps

Execute custom JavaScript for transformations

  • ✓ Data transformation
  • ✓ Calculations
  • ✓ Formatting
  • ✓ Validation

Execute Workflow

POST/v1/workflows/execute

Execute a workflow with input data and receive structured output after all steps complete.

Request Headers

bash
X-API-Key: YOUR_API_KEY
X-Backend-Token: YOUR_BACKEND_TOKEN (optional)

Request Body

json
{
  "workflowId": "workflow_456",
  "environmentId": "env_xyz789",
  "inputData": {
    "orderId": "order_123",
    "action": "process"
  },
  "customerId": "customer_abc123"  // optional
}

Response

json
{
  "data": {
    "orderId": "order_123",
    "status": "completed",
    "result": {
      "itemsProcessed": 5,
      "totalAmount": 299.99
    }
  },
  "workflowId": "workflow_456",
  "workflowName": "Order Processing",
  "executionTime": 2450,
  "stepsExecuted": 4,
  "status": "success",
  "stepResults": [
    {
      "stepKey": "validate_order",
      "stepName": "validate_order",
      "status": "success",
      "executionTime": 0,
      "output": {"valid": true}
    },
    {
      "stepKey": "process_payment",
      "stepName": "process_payment", 
      "status": "success",
      "executionTime": 0,
      "output": {"charged": 299.99}
    }
  ]
}

Data Mapping

Data mapping transforms output from one step into the input format required by the next step. Configure data mapping in the workflow builder dashboard - no code required.

Data mapping uses {{field}} or {{nested.field}} syntax to reference fields from the previous step's output. Configure this entirely in the dashboard UI.

How Data Mapping Works

When you configure data mapping for a step in the dashboard, the workflow automatically inserts a transformation step before that step executes:

json
// Step 1 output
{
  "user": {
    "email": "user@example.com",
    "name": "John Doe"
  },
  "orderTotal": 99.99
}

// Data mapping configuration for Step 2
{
  "customerEmail": "{{user.email}}",
  "customerName": "{{user.name}}",
  "amount": "{{orderTotal}}"
}

// Transformed input for Step 2
{
  "customerEmail": "user@example.com",
  "customerName": "John Doe",
  "amount": 99.99
}

Configuring Data Mapping in the Dashboard

All data mapping is configured visually in the Meebly dashboard workflow builder:

  1. Open your workflow in the Meebly dashboard
  2. Select a step that comes after another step
  3. Expand the "Data Mapping" section (green)
  4. Add target field names (what the next step expects)
  5. Map to source fields using {{fieldName}} syntax
  6. Use dot notation for nested fields: {{user.email}}
  7. Save your workflow
Data mapping is configured entirely in the dashboard UI. Once configured, it runs automatically when you execute the workflow via the API.

Conditional Branching

Branching allows workflows to take different paths based on conditions. When multiple steps share the same branch group, only one executes based on which condition evaluates to true first.

How Branching Works

javascript
// Branch condition examples (JavaScript expressions)

// Check a field value
inputData.status === "approved"

// Numeric comparison
inputData.amount > 1000

// Complex logic
inputData.priority === "high" && inputData.region === "US"

// Array checks
inputData.items.length > 0

// Nested field access
inputData.user.role === "admin"

Configuring Branches in the Dashboard

All branching is configured in the Meebly dashboard workflow builder:

  1. Open your workflow in the dashboard
  2. Create multiple steps that should be alternatives
  3. Assign them the same branch group number (e.g., group 1)
  4. Set a JavaScript condition for each step
  5. Optionally mark one step as the default (fallback) branch
  6. Save your workflow
Branching is configured entirely in the dashboard UI. Your conditions run automatically when you execute the workflow via the API.
Branch Execution: Conditions are evaluated in order. The first step whose condition returns true will execute, and all others in the group are skipped. If no conditions match and there's a default branch, it executes.

Loops & Iteration

Workflows support loop constructs for iterating over arrays or repeating steps based on conditions. Currently, .foreach() loops are supported for array iteration.

ForEach Loops

ForEach loops execute a step once for each item in an array, optionally processing multiple items in parallel.

json
// Step 1 returns an array
{
  "users": [
    {"id": 1, "email": "user1@example.com"},
    {"id": 2, "email": "user2@example.com"},
    {"id": 3, "email": "user3@example.com"}
  ]
}

// Step 2 configured with foreach loop
{
  "loopType": "foreach",
  "loopConfig": {
    "collectionPath": "{{users}}",  // Extract this array
    "concurrency": 2  // Process 2 items at a time
  }
}

// Step 2 executes 3 times (once per user)
// with concurrency of 2 (max 2 parallel executions)

Configuring ForEach Loops in the Dashboard

All loop configuration happens in the Meebly dashboard workflow builder:

  1. Open your workflow in the dashboard
  2. Add or select a step that should process each array item
  3. Expand the "Loop Configuration" section (purple)
  4. Select "For Each (.foreach)" as the loop type
  5. Set Collection Path: {{fieldName}} pointing to an array from the previous step
  6. Set Concurrency (1-20): How many items to process in parallel
  7. Save your workflow
Loops are configured entirely in the dashboard UI. Once configured, they run automatically when you execute the workflow via the API.
Collection Path: Use template syntax to reference the array field from the previous step's output. For nested arrays, use dot notation: {{data.items}}

Concurrency Control

Concurrency determines how many array items are processed simultaneously:

  • Concurrency: 1 (default) - Sequential processing, one item at a time
  • Concurrency: 3 - Up to 3 items processed in parallel
  • Concurrency: 20 (max) - Maximum parallelization
Rate Limiting: Be mindful of backend API rate limits when using high concurrency. Start with lower values and increase as needed.

Retry Configuration

Each workflow step can be configured with retry logic for handling transient failures. Configure this in the dashboard when creating or editing a workflow step.

Set the retry count (0-10) for each step in the workflow builder dashboard. The workflow automatically retries failed steps up to this limit.

How Retries Work

  • If a step fails, it automatically retries up to the configured number of times
  • Each retry waits progressively longer (exponential backoff)
  • If all retries fail, the workflow execution fails
  • Retry count is per-step, not workflow-level

Complete Example: Building and Executing a Workflow

Here's how to create and use a complete workflow with all features:

Step 1: Build Workflow in Dashboard

Configure your workflow visually in the Meebly dashboard:

Step 1: Validate Order
  • • Type: Tool Step (calls validateOrderEndpoint)
  • • Retries: 2
  • • Returns: {valid: true, items: [...]}
Step 2: Data Mapping
  • • Maps: items → {{items}}
  • • Transforms data for next step
Step 3: Process Items (ForEach)
  • • Loop Type: foreach
  • • Collection: {{items}}
  • • Concurrency: 3
  • • Executes: Calculate tax (Code Step)
Step 4: Conditional Branch
  • • Branch Group: 1
  • • Path A: If total > 100 → Apply Premium Discount
  • • Path B: If total ≤ 100 → Apply Standard Discount
Step 5: Create Order
  • • Type: Tool Step (calls createOrderEndpoint)
  • • Retries: 3
  • • Returns: {orderId, status}

Step 2: Execute via API

Once configured in the dashboard, execute your workflow with a simple API call:

javascript
// Execute the workflow you built in the dashboard
const result = await fetch(
  'https://api.meebly.ai/v1/workflows/execute',
  {
    method: 'POST',
    headers: {
      'X-API-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      workflowId: 'workflow_456',
      environmentId: 'env_xyz',
      inputData: {
        customerId: 'cust_456',
        items: [
          {productId: 'prod_1', quantity: 2},
          {productId: 'prod_2', quantity: 1}
        ]
      }
    })
  }
);

const workflow = await result.json();
console.log('Order created:', workflow.data.orderId);
console.log('Execution time:', workflow.executionTime, 'ms');
console.log('Steps executed:', workflow.stepsExecuted);
Key Point: All workflow configuration (steps, data mapping, branches, loops, retries) happens in the Meebly dashboard. Your code only needs to call the execute API with input data.

Best Practices

Build Workflows in the Dashboard

Use the visual workflow builder in the Meebly dashboard to configure all steps, mappings, branches, and loops. No code required for workflow logic.

Keep Steps Focused

Each step should do one thing well. Break complex operations into multiple steps for better debugging and reusability.

Use Data Mapping

Configure data mapping in the dashboard to transform data between steps. This makes steps more reusable across workflows.

Configure Retries in Dashboard

Add retry counts to steps that call external APIs or databases to handle transient failures automatically.

Test in Development Environment

Build and test workflows in your development environment before promoting to production. Execute with test data via the API.

Monitor Execution in Dashboard

Use the Meebly dashboard to view workflow executions, step results, and execution times. Optimize slow steps based on real data.

Last updated: March 2026Report an issue