Before you start building automations in n8n, it helps to understand the core concepts that make it work. This guide breaks down everything you need to know about nodes, triggers, data flow, and workflow execution.
The Building Blocks: Nodes
In n8n, everything revolves around nodes. A node is a single step in your workflow that performs a specific action. Think of nodes as Lego blocks—each one does something simple, but when you connect them together, you can build something powerful.
Types of Nodes
There are several categories of nodes in n8n:
1. Trigger Nodes
These start your workflow. They "listen" for something to happen:
- Webhook: Starts when an external service sends data to a URL
- Schedule: Runs at specific times (like cron jobs)
- App Triggers: Listens for events in apps (new email, new Slack message, etc.)
- Manual: Starts when you click "Execute"
2. Action Nodes
These do something with data:
- App Actions: Create a contact in HubSpot, send an email, post to Slack
- HTTP Request: Call any API
- Code: Run custom JavaScript or Python
3. Flow Control Nodes
These control how data moves through your workflow:
- IF: Branch based on conditions
- Switch: Route to different paths based on values
- Merge: Combine data from multiple branches
- Loop: Process items one at a time
4. Data Transformation Nodes
These modify your data:
- Set: Create or modify fields
- Function: Transform data with code
- Split Out: Break arrays into individual items
- Aggregate: Combine items back together
How Data Flows Through Workflows
Understanding data flow is crucial to building effective automations. Here's how it works:
Items and Fields
Data in n8n is organized into items. Each item is like a row in a spreadsheet, containing multiple fields (columns). For example, if you fetch 10 contacts from a CRM, you get 10 items, each with fields like name, email, and phone.
// Example: Two items flowing through a workflow
[
{ "name": "Alice", "email": "alice@example.com" },
{ "name": "Bob", "email": "bob@example.com" }
]
Connections Pass Data
When you connect two nodes, the output of the first becomes the input of the second. Each node can:
- Pass data through: Keep items unchanged
- Transform data: Modify fields or structure
- Add data: Enrich with new information
- Filter data: Remove items that don't match criteria
- Generate new data: Create new items from API responses
Expressions: Dynamic Values
n8n uses expressions to reference data from previous nodes. Instead of hardcoding values, you can use expressions like:
{{ $json.email }} // Current item's email field
{{ $('Webhook').item.json.name }} // Data from a specific node
{{ $now }} // Current timestamp
{{ $json.amount * 1.2 }} // Calculations
Workflow Execution: What Happens When You Run
Execution Flow
- Trigger fires: Something starts the workflow (schedule, webhook, manual click)
- Nodes execute sequentially: Each node runs in order, following connections
- Data passes between nodes: Output of one becomes input of next
- Branches execute in parallel: If workflow splits, branches run simultaneously
- Workflow completes: All paths finish execution
Execution Modes
n8n offers different ways to run workflows:
- Manual: Click "Execute Workflow" to test
- Active: Toggle on to run automatically when triggered
- Test Mode: Run with sample data to debug
Error Handling
What happens when something goes wrong? n8n provides several options:
- Stop on Error: Workflow halts at the failed node
- Continue on Error: Skip failed items, process the rest
- Error Workflow: Trigger a separate workflow to handle failures
- Retry: Automatically retry failed operations
Real Example: Lead Processing Workflow
Let's walk through a practical example to see these concepts in action:
The Scenario
When someone fills out a contact form, we want to:
- Receive the form data
- Check if they're a high-value lead
- Add them to our CRM
- Notify the sales team on Slack
The Workflow
Webhook → IF (revenue > $100k)
↓ Yes → HubSpot (Create Contact) → Slack (Send Message)
↓ No → Mailchimp (Add to Newsletter)
How It Executes
- Webhook receives data:
{ name: "Acme Corp", email: "ceo@acme.com", revenue: "$500,000" } - IF node evaluates: Is revenue > $100k? Yes!
- HubSpot node runs: Creates contact, returns contact ID
- Slack node runs: Posts "New high-value lead: Acme Corp" to #sales channel
Best Practices for Building Workflows
1. Start with the Trigger
Always begin by defining what starts your workflow. The trigger determines everything that follows.
2. Test Incrementally
Don't build a 20-node workflow and then test. Add nodes one at a time, testing each step.
3. Use Descriptive Names
Rename nodes from "HTTP Request" to "Fetch Customer Data". Future you will thank present you.
4. Handle Errors Gracefully
Add error handling for critical workflows. Consider what should happen when an API is down.
5. Keep It Simple
If a workflow is getting complex, consider breaking it into sub-workflows that call each other.
See It In Action
Browse our library of real-world n8n workflows to see these concepts applied.
Explore Workflows