Lesson 2 12 min

n8n Fundamentals: Nodes, Triggers & Data Flow

Master n8n's building blocks — triggers, nodes, connections, expressions, and credentials. Build your first working data pipeline.

Before we touch any AI nodes, you need to understand how n8n thinks. Every AI workflow you build in this course — from email classifiers to RAG chatbots — runs on the same foundation: triggers, nodes, connections, and expressions. Get this right, and the AI stuff in Lesson 3 will click immediately.

n8n’s Core Concepts

n8n workflows are visual pipelines. Data enters through a trigger, flows through nodes that transform or route it, and exits through an action (send email, update database, return a response). Think of it as a flowchart that actually runs.

Four concepts to internalize:

1. Triggers — The “when” of your workflow. Something has to start the pipeline:

  • Webhook Trigger — fires when an external service hits a URL
  • Schedule Trigger — fires on a cron schedule (every hour, every Monday at 9am)
  • App Triggers — Gmail Trigger, Slack Trigger, etc. — fires when an event happens in that app
  • Chat Trigger — fires when a user sends a message (essential for AI chatbots)
  • Manual Trigger — fires when you click “Test workflow” (for development)

2. Nodes — The “what” of your workflow. Each node does one thing:

  • App nodes — interact with services (Gmail, Slack, Notion, Google Sheets)
  • AI nodes — LLM chains, agents, memory, vector stores (70+ of these — our focus)
  • Logic nodes — IF, Switch, Merge, Split, Loop
  • Transform nodes — Set, Code, Function, Date & Time

3. Connections — Lines between nodes. Data flows through them. One node’s output becomes the next node’s input.

4. Expressions — Dynamic values using {{ }} syntax. Instead of hardcoding “Hello World”, you write {{ $json.userName }} to pull the actual user’s name from the data flowing through.

Quick Check: A workflow should send a Slack message every time a new row appears in Google Sheets. What trigger would you use? (Answer: The Google Sheets Trigger — it watches for new rows and fires when one is added. The Schedule Trigger would also work but is less efficient because it polls on an interval instead of reacting to the event.)

How Data Flows

Every node receives items, processes them, and passes them on. An “item” is just a JSON object. If a Gmail Trigger fires for 3 new emails, the next node receives 3 items — and processes each one.

Here’s what a simple pipeline looks like:

Gmail Trigger → IF node → Send Slack Message
     ↓              ↓ (true branch)
  3 emails    "Is subject = 'urgent'?"  → Slack: "Urgent email from {{$json.from}}"
                    ↓ (false branch)
               Do nothing (or different action)

The IF node splits the flow. Items matching the condition go one way; the rest go another. This is how every decision works in n8n — and it’s the foundation for AI-powered routing in Lesson 3.

Building Your First Pipeline

Let’s build a simple workflow to practice these concepts. Open your n8n instance and follow along:

Step 1: Create a new workflow Click “Add workflow” in the top-right. Name it “My First Pipeline.”

Step 2: Add a Manual Trigger Click the “+” button and search for “Manual Trigger.” This lets you run the workflow by clicking a button — perfect for testing.

Step 3: Add a Set node Click “+” again, add a “Set” node. This node lets you define data manually. Configure it:

  • Add a string field: name = greeting, value = Hello from n8n!
  • Add a number field: name = count, value = 42

Connect the Manual Trigger to the Set node.

Step 4: Add an IF node Add an IF node after the Set node. Configure the condition:

  • Value 1: {{ $json.count }}
  • Operation: “Is Greater Than”
  • Value 2: 10

Step 5: Test it Click “Test workflow.” Watch the data flow through each node. Click on any node to see its input and output in the panel on the right.

You just built a pipeline that creates data, evaluates a condition, and routes the result. Every AI workflow in this course follows this same pattern — the only difference is that AI nodes generate the data and make the decisions.

Expressions: The Glue

Expressions are how you reference dynamic data. The syntax is {{ }} with these key variables:

VariableWhat It Accesses
$jsonThe current item’s data
$inputAll items from the previous node
$node["NodeName"]Output from a specific node by name
$execution.idThe current execution ID
$nowCurrent timestamp

Example: If a Gmail Trigger outputs this JSON:

{
  "from": { "value": [{ "address": "sarah@example.com" }] },
  "subject": "Q2 Report",
  "date": "2026-03-05T10:30:00Z"
}

To get the sender’s email: {{ $json.from.value[0].address }} To get the subject: {{ $json.subject }}

You don’t need to memorize paths. Click any node’s output panel, hover over a field, and n8n shows you the expression to copy.

Quick Check: You want to include the email subject in a Slack message. How would you write the expression? (Answer: {{ $json.subject }} — referencing the subject field from the current item’s JSON data. You can also drag-and-drop from the output panel directly into the Slack node’s message field.)

Credentials: Connecting External Services

Most useful workflows need credentials — API keys, OAuth tokens, or login details for external services. n8n manages these securely:

  1. Go to Settings → Credentials in your n8n instance
  2. Click Add Credential and select the service (OpenAI, Gmail, Slack, etc.)
  3. Follow the setup wizard — for OAuth services like Gmail, n8n handles the authentication flow
  4. Once saved, select the credential in any node that needs it

Important for this course: Set up your OpenAI credential now. Go to Settings → Credentials → Add Credential → OpenAI. Paste your API key. You’ll use this credential in every AI lesson starting from Lesson 3.

Never hardcode API keys in expressions or code nodes. Always use n8n’s credential system — it encrypts keys at rest and keeps them out of your workflow JSON exports.

Key Takeaways

  • Workflows start with a trigger (the event) and flow through nodes (the processing)
  • Data flows as JSON items — each node receives items, processes them, and passes them forward
  • Expressions ({{ $json.field }}) let you reference dynamic data between nodes
  • The IF and Switch nodes route data based on conditions — the foundation for smart workflows
  • Always use n8n’s credential system for API keys — never hardcode them

Up Next

In Lesson 3, you’ll add your first AI node. You’ll build an AI Email Classifier that reads incoming emails and automatically labels them by intent — using the Basic LLM Chain node and a prompt template. The expressions and data flow you just learned will make it all click.

Knowledge Check

1. What's the difference between a trigger node and a regular node in n8n?

2. You need to extract the sender's email address from a Gmail trigger's output. Which expression syntax does n8n use?

3. Your workflow needs to behave differently based on an email's subject line. Which node should you use?

Answer all questions to check

Complete the quiz above first

Related Skills