🏠 Home / Hub

n8n 02 — Triggers & Nodes

Every workflow starts with a trigger and does its work through action nodes. This lesson covers all trigger types and the most important core nodes.

1. Trigger Types Overview

TriggerWhen it firesBest for
ManualYou click "Execute"Testing, one-off runs
ScheduleCron expression or intervalDaily reports, syncs, cleanups
WebhookExternal HTTP request hits the URLForm submissions, app events
App EventGmail, Slack, GitHub, etc. push an eventReal-time reactive automations
Form TriggerBuilt-in n8n form is submittedQuick internal forms

2. Schedule Trigger (Cron)

The Schedule Trigger fires at a defined interval. You can use the visual picker (every X minutes/hours/days) or enter a cron expression for precise control.

Cron expression format:

┌───── minute (0-59)
│ ┌───── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌───── month (1-12)
│ │ │ │ ┌───── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *

Common examples:

0 9 * * *       # Every day at 9:00 AM
0 9 * * 1       # Every Monday at 9:00 AM
*/15 * * * *    # Every 15 minutes
0 0 1 * *       # First day of every month
0 8,17 * * 1-5  # 8am and 5pm on weekdays
n8n shows a human-readable description of your cron expression as you type it. Use it to verify the schedule is correct.

3. Webhook Trigger

The Webhook Trigger gives you a unique URL. Any HTTP request to that URL starts the workflow. The request body, query string, and headers all become available as data.

# Test webhook with curl
curl -X POST https://your-n8n.io/webhook/abc123 \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","email":"alice@example.com"}'

# Access in workflow:
{{ $json.name }}          # "Alice"
{{ $json.email }}         # "alice@example.com"
{{ $json.headers["x-api-key"] }}  # header value
You must activate the workflow (toggle top-right) for the production webhook URL to work. The test URL only works while the editor is open.

4. Core Action Nodes

NodePurposeKey settings
HTTP RequestCall any REST APIMethod, URL, auth, headers, body
SetAdd, edit, or remove fields on itemsField name, value, type
IFBranch based on a conditionCondition, AND/OR logic
SwitchMultiple condition routesRules, output index
MergeCombine data from multiple branchesMode: Append, By Index, By Key
CodeCustom JavaScript logicJS code, input items
WaitPause execution for time or webhookDuration, resume webhook

5. IF Node — Branching Logic

The IF node splits the workflow into two branches: true (condition met) and false (condition not met). Each branch continues independently.

# Condition examples:
{{ $json.score }} >= 70          # Number comparison
{{ $json.status }} equals "active"   # String equals
{{ $json.email }} contains "@"       # String contains
{{ $json.items.length }} > 0         # Array length check

Combining conditions:

You can rename the output branches in the IF node settings to make the canvas easier to read (e.g., "Qualified" and "Rejected").

6. Switch Node — Multiple Routes

Use Switch when you have more than two possible paths. Each rule maps to a numbered output connector.

# Example: Route by order status
Rule 1: status equals "pending"   → Output 0
Rule 2: status equals "paid"      → Output 1
Rule 3: status equals "cancelled" → Output 2
Fallback                          → Output 3 (optional)
Connect each output to a different node. Items matching Rule 1 go to the Output 0 connection, Rule 2 to Output 1, etc.

7. Merge Node — Combining Data

ModeDescriptionUse when
AppendAll items from both inputs combined into one listCombining two lists
Merge By IndexPairs item 0 from input 1 with item 0 from input 2Parallel fetches of same records
Merge By KeyMatches items by a shared field valueJoining on ID or email
Keep Key MatchesOnly outputs items found in both inputsInner join behaviour

8. HTTP Request Node In Depth

# GET request with query params
Method: GET
URL: https://api.example.com/users
Query Parameters:
  page  = 1
  limit = 50

# POST with JSON body
Method: POST
URL: https://api.example.com/users
Body Content Type: JSON
Body:
{
  "name": "{{ $json.name }}",
  "email": "{{ $json.email }}"
}

# With Bearer token auth
Authentication: Header Auth
Name: Authorization
Value: Bearer YOUR_TOKEN_HERE

Response format options:

Enable "Include Response Headers and Status" to access the HTTP status code via {{ $json.statusCode }} in the next node.

📌 Study Checklist