Chat Flow
Flow Builder
Blocks
Integrations
Execute Workflow

Execute Workflow Block

What it does: Call and execute other published workflows from within your current workflow, enabling modular and reusable workflow design.

🔄

In simple terms: Execute Workflow is like calling a function in programming. Break complex workflows into smaller, reusable pieces, then call them when needed. Build once, use everywhere.

When to Use This

Use Execute Workflow when you need:

  • ✅ Reuse common logic across multiple workflows
  • ✅ Break complex workflows into manageable modules
  • ✅ Maintain consistency across related workflows
  • ✅ Update shared functionality in one place
  • ✅ Create workflow libraries for your team

Example: Create a "Send Welcome Email" workflow once, then call it from signup, trial activation, and first purchase workflows.

Key Features

  • Workflow Reusability: Build once, execute anywhere
  • Variable Passing: Send data to the child workflow
  • Response Handling: Get results back from executed workflow
  • Published Workflows Only: Only stable, published workflows can be called
  • Modular Design: Break complexity into manageable pieces

Setup Guide

Step 1: Create the Workflow to Execute

First, you need a published workflow to call:

  1. Build your reusable workflow (e.g., "Calculate Shipping Cost")
  2. Add variables that will receive input data
  3. Configure the workflow to produce output
  4. Publish the workflow - Only published workflows can be executed
  5. Test it works correctly

Step 2: Configure Execute Workflow Block

In your main workflow:

  1. Select Workflow: Choose from published workflows

    • Dropdown shows all published workflows in your workspace
    • Only displays workflows with status "PUBLISHED"
    • Select the workflow you want to execute
  2. Save Answer: Choose where to store the workflow's result

    • Select a variable to receive the response
    • This variable will contain whatever the child workflow returns
    • Optional: Leave empty if you don't need the result
  3. Variable Mappings: Pass data to the child workflow

    • Map your bot variables to the child workflow's variables
    • Workflow variable: Select from child workflow's variables
    • Variable value: Enter the value or use bot variables
    • Add multiple mappings to pass multiple values

Configuration Example

Scenario: Reusable Discount Calculator

Child Workflow ("Calculate Discount"):

  • Name: Calculate Discount
  • Status: PUBLISHED
  • Variables:
    • original_price (receives value)
    • discount_percent (receives value)
    • discount_result (returns result)

Parent Workflow (Shopping Cart):

  • Execute Workflow Block Settings:
    • Select Workflow: "Calculate Discount"
    • Save Answer: {{final_price}}
    • Variable Mappings:
      • Workflow variable: original_price → Value: {{cart_total}}
      • Workflow variable: discount_percent → Value: {{user_discount}}

Flow:

  1. User adds items to cart → {{cart_total}} = 150
  2. User applies discount code → {{user_discount}} = 20
  3. Execute Workflow block calls "Calculate Discount"
  4. Passes cart_total (150) to original_price
  5. Passes user_discount (20) to discount_percent
  6. Gets result back in {{final_price}} = 120

Variable Mapping Explained

How It Works

Variable Mapping connects bot variables to workflow variables:

Your Workflow Variable → Child Workflow Variable
{{current_value}}     →  input_parameter

Mapping Types

1. Direct Value:

Workflow variable: email_address
Variable value: user@example.com

2. From Bot Variable:

Workflow variable: customer_name
Variable value: {{user_name}}

3. From Previous Step:

Workflow variable: calculated_total
Variable value: {{previous_block_output}}

4. Combined/Formatted:

Workflow variable: full_message
Variable value: Hello {{user_name}}, your total is {{cart_total}}

Common Use Cases

Shared Email Templates

Create reusable email sending workflows:

Child Workflow - "Send Welcome Email":

  • Variables: recipient_email, recipient_name
  • Logic: Format email, call send email block
  • Published and ready

Usage in Multiple Workflows:

  • Signup workflow → Execute "Send Welcome Email"
  • Trial Started → Execute "Send Welcome Email"
  • Account Activated → Execute "Send Welcome Email"

Benefits:

  • Update email template once
  • Consistent messaging everywhere
  • Easy to maintain

Complex Calculations

Centralize business logic:

Child Workflow - "Calculate Tax":

  • Variables: amount, state, item_type
  • Logic: Tax rules by state and item type
  • Returns: tax_amount, total_with_tax

Usage:

  • Shopping Cart → Execute "Calculate Tax"
  • Invoice Generation → Execute "Calculate Tax"
  • Quote Creator → Execute "Calculate Tax"

Benefits:

  • Tax logic in one place
  • Easy to update rates
  • Guaranteed consistency

Data Validation

Reusable validation logic:

Child Workflow - "Validate User Data":

  • Variables: email, phone, address
  • Logic: Check formats, verify data
  • Returns: is_valid, error_messages

Usage:

  • Registration Form → Execute "Validate User Data"
  • Profile Update → Execute "Validate User Data"
  • Checkout Process → Execute "Validate User Data"

API Integration Wrapper

Wrap external API calls:

Child Workflow - "Fetch Weather":

  • Variables: city, units
  • Logic: Call weather API, format response
  • Returns: temperature, conditions, forecast

Usage:

  • Travel Bot → Execute "Fetch Weather"
  • Event Planner → Execute "Fetch Weather"
  • Daily Briefing → Execute "Fetch Weather"

Benefits:

  • API credentials in one place
  • Error handling centralized
  • Easy to switch weather providers

Multi-Step Process

Break down complex workflows:

Main Workflow - "Complete Order":

  1. Execute "Validate Cart"
  2. Execute "Calculate Total"
  3. Execute "Process Payment"
  4. Execute "Create Invoice"
  5. Execute "Send Confirmation"

Benefits:

  • Each step is testable independently
  • Easy to debug
  • Clear workflow organization
  • Reusable components

Advanced Patterns

Conditional Execution

Execute workflows based on conditions:

If {{user_type}} = "premium"
  → Execute "Premium Checkout"
Else
  → Execute "Standard Checkout"

Sequential Execution

Chain multiple workflow executions:

1. Execute "Validate Data" → {{is_valid}}
2. If {{is_valid}} = true
   → Execute "Process Request" → {{result}}
3. If {{result}} = "success"
   → Execute "Send Notification"

Nested Workflows

Workflows can call other workflows:

Workflow A → Execute Workflow B
Workflow B → Execute Workflow C
Workflow C → Returns to B
Workflow B → Returns to A

Note: Be careful with nesting depth to avoid complexity.

Best Practices

Workflow Design

  1. Single Responsibility - Each child workflow should do one thing well
  2. Clear Naming - Use descriptive workflow names like "Send-Welcome-Email"
  3. Document Variables - Name variables clearly (recipient_email vs email1)
  4. Keep It Simple - Don't make child workflows too complex
  5. Test Independently - Ensure child workflows work alone first

Variable Management

  1. Consistent Naming - Use same conventions across workflows
  2. Required vs Optional - Document which variables are required
  3. Default Values - Provide defaults when appropriate
  4. Validation - Validate inputs in child workflow
  5. Clear Outputs - Return predictable, well-formatted results

Error Handling

  1. Graceful Failures - Child workflows should handle errors
  2. Return Status - Include success/error status in results
  3. Error Messages - Return helpful error descriptions
  4. Fallback Logic - Have backup plans for failures
  5. Logging - Log executions for debugging

Performance

  1. Avoid Deep Nesting - Limit workflow call depth
  2. Cache Results - Store results if called multiple times
  3. Minimize Calls - Combine operations when possible
  4. Async When Possible - Don't wait if you don't need the result
  5. Monitor Execution Time - Track how long child workflows take

Troubleshooting

ProblemLikely CauseSolution
Workflow not in dropdownNot publishedPublish the workflow you want to call
Variables not mappingWrong variable namesCheck exact variable names in child workflow
No result returnedNo save variable setSelect a variable in "Save Answer"
Wrong values passedIncorrect mappingVerify variable mappings are correct
Workflow failsChild workflow errorTest child workflow independently
Slow executionInefficient child workflowOptimize the child workflow

What You Get Back

After executing a workflow:

  • Workflow Result: Whatever the child workflow returns

    • Could be text, numbers, JSON, etc.
    • Depends on how child workflow is configured
    • Stored in the variable you selected in "Save Answer"
  • Execution Status: Success or failure

    • If failed, check child workflow logs
    • Errors propagate to parent workflow

Tips for Success

  1. Plan Your Structure - Design workflow hierarchy upfront
  2. Start Small - Begin with simple reusable workflows
  3. Test Thoroughly - Test child workflows independently
  4. Document Everything - Describe what each workflow does
  5. Use Version Control - Keep track of workflow changes
  6. Monitor Usage - Track which workflows are most reused
  7. Refactor Regularly - Improve and optimize over time
  8. Share with Team - Create libraries of useful workflows

Example: Building a Workflow Library

Core Workflows (Publish these):

  • "Send-Email" - Reusable email sender
  • "Validate-Email" - Email format checker
  • "Calculate-Shipping" - Shipping cost calculator
  • "Format-Currency" - Money formatter
  • "Log-Event" - Event logging

Feature Workflows (Use the core workflows):

  • "User-Signup" → Uses: Send-Email, Validate-Email, Log-Event
  • "Checkout" → Uses: Calculate-Shipping, Format-Currency, Send-Email
  • "Profile-Update" → Uses: Validate-Email, Log-Event

Benefits:

  • Consistent behavior across features
  • Easy maintenance
  • Rapid development
  • Clear architecture

Execute Workflow is essential for building scalable, maintainable workflow systems!

Indite Documentation v1.4.0
PrivacyTermsSupport