n8n Masterclass
0/24 complete

Module 01 · Why n8n, Why Now

Your First Workflow: Trigger, Node, Output

20 minfocused lesson5practical steps4grounded questions3source links
Open lesson + course map

On this lesson

Course outline

An n8n workflow turns an event into explicit state transitions. Your first workflow should be deterministic, synthetic, and observable: a manual trigger creates input, a transformation validates it, and the final node produces a reviewable output.

// concept

Define the Contract

Use this sample input:

// json7 lines
{
  "lead_id": "sample-001",
  "name": "Sample Customer",
  "city": "Lahore",
  "interest": "website audit",
  "consent_followup": false
}

Goal: normalize allowed fields and create a DRAFT lead summary. Excluded: messaging, CRM writes, real customer data, and marketing.

Build:

// prompt — copy me5 lines
Manual Trigger
→ Edit Fields/Set: create sample item
→ validation/IF: required values and allowed city format
→ transformation: create summary and workflow version
→ final output: display draft JSON

n8n passes arrays of items between nodes. Inspect each node’s input and output rather than assuming the shape. Use expressions for simple references; use a Code node only when clearer, tested logic justifies it.

// concept

Add Failure Behavior

Create an invalid sample missing lead_id. Route it to an explicit rejected output with error code and safe message. Do not let the main branch continue. Name nodes by business action, not Set1 or IF2.

Pin the workflow version in output and add a note explaining authority. The workflow creates a draft, not a qualified lead or permission to contact.

// worked_example

Worked Example

Valid sample becomes:

// json7 lines
{
  "lead_id": "sample-001",
  "city": "lahore",
  "summary": "Website audit enquiry — Lahore",
  "status": "DRAFT",
  "workflow_version": "lead-normalize-v1"
}

The invalid sample returns MISSING_LEAD_ID. Execution history shows which branch ran. Re-execution creates no external side effect, so iteration is safe.

// failure_cases

Failure Cases to Diagnose

6 cases to diagnose

  • Real contact pasted into tutorial

    replace with synthetic fixture.

  • Expression references wrong item

    inspect input/output and item linking.

  • Missing field becomes `undefined` prose

    validate before transform.

  • Draft labelled “qualified”

    preserve truthful states.

  • Every operation in Code node

    prefer visible native nodes where clearer.

  • No version/naming

    future operators cannot compare behavior.

// pakistan_angle

Pakistan Angle

Normalize a customer-supplied city only for routing; do not infer province, language, income, or quality from phone prefix or name. Use explicit language preference if needed.

Keep PKR amounts as exact data and separate subtotal, delivery, tax, and pending fees. A first workflow should never calculate a real invoice or send a WhatsApp message without the later validation, consent, idempotency, and approval controls.

// hands_on

Hands-On Exercise

5 steps

  1. Build the four-stage workflow.

  2. Run valid and missing-ID fixtures.

  3. inspect every node’s data.

  4. rename nodes and add workflow version.

  5. export the credential-free workflow JSON for review.

// completion_rubric

Completion Rubric

6 checks — tick as you verify

0/6

// sources

Sources

// check_yourself

Check yourself

4 questions · answers and options are taken word-for-word from this course

0/4
  1. 1 / 4 · diagnose

    Your work shows this failure mode: “Real contact pasted into tutorial.” What does the lesson tell you to do about it?