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
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
/v1/workflows/executeExecute a workflow with input data and receive structured output after all steps complete.
Request Headers
X-API-Key: YOUR_API_KEY
X-Backend-Token: YOUR_BACKEND_TOKEN (optional)Request Body
{
"workflowId": "workflow_456",
"environmentId": "env_xyz789",
"inputData": {
"orderId": "order_123",
"action": "process"
},
"customerId": "customer_abc123" // optional
}Response
{
"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.
{{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:
// 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:
- Open your workflow in the Meebly dashboard
- Select a step that comes after another step
- Expand the "Data Mapping" section (green)
- Add target field names (what the next step expects)
- Map to source fields using
{{fieldName}}syntax - Use dot notation for nested fields:
{{user.email}} - Save your workflow
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
// 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:
- Open your workflow in the dashboard
- Create multiple steps that should be alternatives
- Assign them the same branch group number (e.g., group 1)
- Set a JavaScript condition for each step
- Optionally mark one step as the default (fallback) branch
- Save your workflow
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.
// 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:
- Open your workflow in the dashboard
- Add or select a step that should process each array item
- Expand the "Loop Configuration" section (purple)
- Select "For Each (.foreach)" as the loop type
- Set Collection Path:
{{fieldName}}pointing to an array from the previous step - Set Concurrency (1-20): How many items to process in parallel
- Save your workflow
{{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
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.
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:
- • Type: Tool Step (calls validateOrderEndpoint)
- • Retries: 2
- • Returns: {valid: true, items: [...]}
- • Maps: items → {{items}}
- • Transforms data for next step
- • Loop Type: foreach
- • Collection: {{items}}
- • Concurrency: 3
- • Executes: Calculate tax (Code Step)
- • Branch Group: 1
- • Path A: If total > 100 → Apply Premium Discount
- • Path B: If total ≤ 100 → Apply Standard Discount
- • 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:
// 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);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.