Intermediate

Building Workflows in n8n

Every n8n workflow starts with a trigger, flows through nodes that transform or act on data, and ends with an output. This page walks through the key building blocks and patterns.

Workflow Anatomy

Trigger
When to run
Process
Transform data
Branch
If / Switch
Act
Send / Write / Call

Every workflow: trigger → process → branch → act

Trigger Types

TriggerWhen it firesCommon use
WebhookAn HTTP request hits your n8n URLReceive data from any external system
ScheduleA cron expression (every hour, daily at 9am, etc.)Periodic data pulls, reports, digests
ManualYou click 'Execute' in the editorTesting and one-off runs
Email TriggerA new email arrives in Gmail or OutlookSupport tickets, lead capture
Chat TriggerA message is sent to an n8n chat UIChatbot interfaces for AI agents
Form TriggerAn n8n-hosted form is submittedData collection without a custom form backend
App TriggersA new record in Airtable, a Slack message, a GitHub PREvent-driven automations from any connected app

Data Flow — Items and Fields

Data in n8n flows as an array of items. Each item is a JSON object. Most nodes process each item individually — if 10 emails come in, the next node runs 10 times. Key concepts:

  • {{ $json.fieldName }} — access the current item's data in expressions
  • {{ $node['NodeName'].json.field }} — reference data from a specific previous node
  • {{ $items() }} — access all items from the previous node
  • Merge node — combine data from two parallel branches
  • Split In Batches — process large arrays in chunks to avoid API rate limits

Flow Control Nodes

If
Binary branch — route items to True or False outputs based on a condition. The most common branching node.
Switch
Multi-branch — route items to one of N outputs based on a field value. Cleaner than chained If nodes.
Loop Over Items
Process items one at a time with full sub-workflow logic. Useful when each item needs complex handling.
Wait
Pause execution for a set time or until a webhook is called. For human-in-the-loop workflows or rate-limiting.
Stop and Error
Halt the workflow and throw an error with a custom message. Use in validation branches.
No Op
Pass-through node — does nothing. Useful as a visual label or placeholder in complex workflows.

Error Handling

n8n has two error handling mechanisms:

  • Try/Catch on nodes: Right-click any node → "Continue on Fail" to prevent the whole workflow failing if that node errors. The error data flows to the next node.
  • Error Workflow: Set a separate workflow to trigger whenever any workflow fails. Use it to send Slack alerts or log failures to a database.

Debugging Tips

  • Click any node after execution to see exactly what data it received and output — the most useful debugging tool
  • Use the Code node to console.log() intermediate values
  • Pin data on a trigger node to test the rest of the workflow without re-triggering the source system
  • Use execution logs (left sidebar) to see all past runs and replay them
  • The Test URL on webhook triggers lets you send a test payload without going to your source system

Starting From Templates

n8n has a template library at n8n.io/workflows with 1,000+ community-contributed workflows. Many AI agent templates are available — search for "AI agent", "ChatGPT", "summarization", or your specific use case. Templates are one-click imports into your n8n instance.

Checklist: Do You Understand This?

  • Can you describe the 4-step anatomy of any n8n workflow?
  • Do you know which trigger to use for: a scheduled report, an incoming webhook, a Slack message?
  • Can you access a specific field from a previous node using n8n expressions?
  • Do you know how to debug a failing node — where to look for the error data?

Page built: 01 Jun 2026