Skip to main content

Workflows Overview

Workflows let you build automated processes that chain multiple API calls, add conditional logic, transform data, and handle errors - all through a visual drag-and-drop interface.

What Are Workflows?

Workflows are automated sequences of actions that execute in response to triggers or manual invocation. Example workflow:
Trigger: Incoming webhook from Stripe

HTTP Request: Validate payment with your backend

Condition: Is payment successful?
    ↓ Yes                           ↓ No
Send confirmation email         Log error to Slack
    ↓                               ↓
Update CRM record               Create support ticket

Key Concepts

Nodes

Nodes are the building blocks of workflows. Each node performs a specific action:
Node TypePurpose
TriggerStarts the workflow (webhook, manual, schedule)
HTTP RequestMake API calls to external services
Code BlockRun custom JavaScript code
ConditionBranch based on if/else logic
LoopIterate over arrays
RouterRoute to different paths based on conditions
DelayPause execution for a specified time
Error HandlerCatch and handle errors

Edges

Edges connect nodes and define the flow of execution. Data passes from one node to the next through these connections.

Variables

Workflows use a variable system to pass data between nodes:
// Access trigger data
{{trigger.body.payment_id}}

// Access previous node output
{{nodes.http_request_1.response.data.customer_id}}

// Access environment variables
{{env.API_KEY}}

Node Types

Trigger Node

Every workflow starts with a trigger node that determines when the workflow runs: Trigger Types:
  • Manual: Run on-demand from the UI or API
  • Webhook: Run when an HTTP request hits the workflow endpoint
  • Route Event: Run when a KnoxCall route processes a request
Webhook trigger example:
{
  "type": "trigger",
  "trigger_type": "webhook",
  "data": {
    "method": "POST",
    "path": "/payment-received"
  }
}

HTTP Request Node

Make HTTP requests to external APIs: Configuration:
{
  "type": "http_request",
  "data": {
    "method": "POST",
    "url": "https://api.example.com/users",
    "headers": {
      "Authorization": "Bearer {{env.API_TOKEN}}",
      "Content-Type": "application/json"
    },
    "body": {
      "email": "{{trigger.body.email}}",
      "name": "{{trigger.body.name}}"
    }
  }
}
Output:
{
  status: 200,
  headers: { ... },
  data: { id: "user_123", ... }
}

Code Block Node

Run custom JavaScript for data transformation: Example:
// Input: trigger.body.items = [{ price: 10 }, { price: 20 }]

const total = input.trigger.body.items.reduce(
  (sum, item) => sum + item.price,
  0
);

return {
  total: total,
  itemCount: input.trigger.body.items.length,
  timestamp: new Date().toISOString()
};
Use cases:
  • Data transformation
  • Calculations
  • Formatting responses
  • Complex conditional logic

Condition Node

Branch workflow execution based on conditions: Configuration:
{
  "type": "condition",
  "data": {
    "condition": "{{nodes.http_request.response.status}} === 200"
  }
}
Branches:
  • True path: Executes when condition is true
  • False path: Executes when condition is false
Supported operators:
  • ===, !== (equality)
  • >, <, >=, <= (comparison)
  • &&, || (logical)
  • includes(), startsWith() (string methods)

Loop Node

Iterate over arrays: Configuration:
{
  "type": "loop",
  "data": {
    "items": "{{trigger.body.users}}",
    "variable": "user"
  }
}
Inside the loop:
// Access current item
{{loop.user.email}}

// Access loop index
{{loop.index}}

Router Node

Route to different paths based on multiple conditions: Configuration:
{
  "type": "router",
  "data": {
    "routes": [
      {
        "name": "high_priority",
        "condition": "{{trigger.body.priority}} === 'high'"
      },
      {
        "name": "medium_priority",
        "condition": "{{trigger.body.priority}} === 'medium'"
      },
      {
        "name": "default",
        "condition": "true"
      }
    ]
  }
}

Delay Node

Pause execution for a specified duration: Configuration:
{
  "type": "delay",
  "data": {
    "duration": 5000,
    "unit": "milliseconds"
  }
}
Units: milliseconds, seconds, minutes

Error Handler Node

Catch and handle errors from previous nodes: Configuration:
{
  "type": "error_handler",
  "data": {
    "catch_from": ["http_request_1", "code_block_1"]
  }
}
Error output:
{
  error: {
    message: "Connection refused",
    node: "http_request_1",
    timestamp: "2025-01-15T10:30:45Z"
  }
}

Creating a Workflow

1. Navigate to Workflows

  1. Click Workflows in the sidebar
  2. Click + Create Workflow

2. Add a Trigger

Every workflow needs a trigger node:
  1. The trigger node is added automatically
  2. Configure the trigger type (manual, webhook, etc.)
  3. Set any trigger-specific options

3. Add Nodes

  1. Click the + button on a node’s output
  2. Select the node type from the menu
  3. Configure the node settings

4. Connect Nodes

  1. Drag from one node’s output to another’s input
  2. Edges show the flow direction
  3. Some nodes (Condition, Router) have multiple outputs

5. Configure Variables

Use the variable picker to reference:
  • Trigger data
  • Previous node outputs
  • Environment variables

6. Save and Enable

  1. Click Save
  2. Toggle Enabled to ON
  3. Your workflow is now active

Executing Workflows

Manual Execution

  1. Open the workflow
  2. Click Run
  3. Optionally provide input data
  4. View execution progress in real-time

Webhook Execution

  1. Configure a webhook trigger
  2. Get the workflow URL
  3. Send HTTP requests to trigger the workflow
Workflow URL format:
https://workflows.knoxcall.com/v1/{tenant_slug}/{workflow_id}

Via API

curl -X POST https://admin.knoxcall.com/api/workflows/{workflow_id}/execute \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"key": "value"}}'

Execution Monitoring

Real-time Progress

When a workflow runs, you can watch execution in real-time:
  • Each node highlights when it starts
  • Success/failure status shown per node
  • Execution time displayed
  • Output data visible

Execution History

View past executions:
  1. Open the workflow
  2. Click the Executions tab
  3. See list of all executions with:
    • Status (running, completed, failed, cancelled)
    • Start time
    • Duration
    • Trigger type

Execution Details

Click on an execution to see:
  • Full execution timeline
  • Each node’s input and output
  • Error messages (if any)
  • Duration per node

Error Handling

Automatic Retries

HTTP Request nodes can be configured to retry on failure:
{
  "retry": {
    "enabled": true,
    "maxAttempts": 3,
    "backoff": "exponential"
  }
}

Error Handler Nodes

Catch errors and execute recovery logic:
HTTP Request → Error Handler → Slack Notification

              Log to Database

Workflow-level Error Handling

If no error handler catches an error:
  • Workflow status set to “failed”
  • Error message logged
  • Execution stops at the failing node

Common Use Cases

1. Payment Processing Pipeline

Stripe Webhook

Validate Payment

Condition: Successful?
    ↓ Yes           ↓ No
Update Order    Notify Support

Send Receipt

Update Analytics

2. User Onboarding

New User Trigger

Create CRM Record

Send Welcome Email

Delay: 1 day

Send Getting Started Guide

3. Data Synchronization

Schedule: Every hour

Fetch from API A

Loop: For each record

Transform Data

Push to API B

4. Error Alerting

Route Error Event

Code Block: Format Message

Router: By Severity
    ↓ Critical              ↓ Warning
PagerDuty Alert         Slack Message

Workflow Versioning

Workflows automatically version when you save changes:
  • Each save creates a new version
  • View version history
  • Rollback to previous versions
View versions:
  1. Open workflow
  2. Click Versions tab
  3. See all saved versions with timestamps

Best Practices

1. Start Simple

Begin with basic workflows and add complexity gradually:
  • Start with Trigger → HTTP Request
  • Add Condition nodes as needed
  • Use Error Handlers for critical paths

2. Use Descriptive Names

Name nodes clearly:
  • “Fetch Customer Data” not “HTTP Request 1”
  • “Is Payment Valid?” not “Condition 1”

3. Handle Errors

Always add error handling for:
  • External API calls
  • Critical business logic
  • Data transformations

4. Test Thoroughly

Before enabling:
  • Run manually with test data
  • Verify each node’s output
  • Test error scenarios

5. Monitor Executions

Regularly check:
  • Execution history for failures
  • Execution times for performance
  • Error patterns

Next Steps


Statistics

  • Level: intermediate
  • Time: 10 minutes

Tags

workflows, automation, orchestration, visual-builder, no-code