Skip to content

Workflow Concepts

Understanding n8n’s core concepts is essential for building effective automation workflows. This guide covers the fundamental building blocks you’ll use when integrating with Last Mile Intelligence.

Nodes are the fundamental building blocks of n8n workflows. Each node performs a specific task and passes data to the next node in the chain.

Start workflow execution. Common triggers include:

  • Webhook - Execute when an HTTP request is received
  • Schedule - Run at specified times (cron)
  • LMI Trigger - React to LMI events (order created, task updated, etc.)
  • Manual - Execute on-demand via the UI

Perform operations on data:

  • LMI Actions - CRUD operations on LMI resources
  • HTTP Request - Call external APIs
  • Code - Execute custom JavaScript/Python
  • Database - Query databases directly

Control workflow execution flow:

  • IF - Conditional branching
  • Switch - Multiple condition branches
  • Merge - Combine multiple branches
  • Loop - Iterate over items
  • Wait - Pause execution

Manipulate data between nodes:

  • Set - Create or modify data fields
  • Function - Custom data transformations
  • Split Out - Separate array items
  • Aggregate - Combine multiple items

Data flows between nodes as “items” - JSON objects with any structure:

{
"customerId": "cust_12345",
"name": "Acme Propane",
"tanks": [
{ "id": "tank_001", "level": 45 },
{ "id": "tank_002", "level": 72 }
]
}

Nodes can output multiple items. Subsequent nodes process each item independently:

// Output from "Get Customers" node
[
{ "id": "cust_001", "name": "Customer A" },
{ "id": "cust_002", "name": "Customer B" },
{ "id": "cust_003", "name": "Customer C" }
]

When merging branches, n8n pairs items by index or key fields.

Expressions let you dynamically reference data from previous nodes.

Access data using {{ }} syntax:

{{ $json.customerId }} // Current item field
{{ $json.tanks[0].level }} // Nested array access
{{ $node["Get Customer"].json.name }} // Specific node output
// String manipulation
{{ $json.name.toLowerCase() }}
{{ $json.firstName + ' ' + $json.lastName }}
// Date handling
{{ new Date().toISOString() }}
{{ DateTime.fromISO($json.createdAt).toFormat('yyyy-MM-dd') }}
// Conditional values
{{ $json.status === 'active' ? 'Yes' : 'No' }}
// Array operations
{{ $json.items.length }}
{{ $json.items.map(i => i.name).join(', ') }}
VariableDescription
$jsonCurrent item’s JSON data
$binaryCurrent item’s binary data
$node["Name"]Access specific node output
$inputAll input items
$executionExecution metadata
$workflowWorkflow metadata
$nowCurrent timestamp
$todayToday’s date

Credentials store authentication information securely.

  1. Created in n8n’s credential manager
  2. Encrypted at rest
  3. Referenced by nodes (not stored in workflow)
  4. Can be shared across workflows

Each integration has its own credential type:

  • LastMile API - API key, URL, organization
  • Samsara - API token
  • Anova - API URL and token
  • Fiserv - Merchant credentials
  • Triggered automatically (webhooks, schedules)
  • Runs in background
  • Full error handling and retry logic
  • Triggered from n8n UI
  • Interactive debugging
  • View data at each step
  • Execute selected nodes only
  • Pin test data for development
  • Faster iteration during development

Configure automatic retries for failed nodes:

  • Number of retry attempts
  • Wait time between retries
  • Exponential backoff

Designate a workflow to handle errors:

  1. Create an error handling workflow
  2. Set it as the error workflow in settings
  3. Receive error notifications and take action

Use the Error Trigger node in sub-workflows for granular error handling.

Nodes execute one after another:

Trigger → Get Data → Transform → Save → Notify

Split into multiple branches that execute simultaneously:

Trigger → Split
├→ Branch A → Merge
└→ Branch B → Merge
Combine Results

Route execution based on conditions:

Trigger → Check Condition
├→ True Path → Action A
└→ False Path → Action B

Process arrays of data:

Trigger → Get Items → Loop Over Items → Process Each → Aggregate
  • Name workflows clearly - Use descriptive, searchable names
  • Add notes - Document complex logic with sticky notes
  • Use sub-workflows - Break large workflows into reusable pieces
  • Version control - Export workflows and store in Git
  • Batch operations - Process multiple items in single API calls when possible
  • Limit data - Only fetch fields you need
  • Use pagination - Handle large datasets incrementally
  • Avoid loops - Use built-in array operations when possible
  • Handle errors - Configure retries and error workflows
  • Validate data - Check for required fields before processing
  • Log important events - Use the “No Operation” node with notes for debugging
  • Test thoroughly - Test with edge cases before activating