금. 8월 8th, 2025

Welcome, fellow automation enthusiasts! 👋 In the world of workflow automation, n8n stands out as a powerful, flexible, and self-hostable tool. But like any sophisticated machinery, its true potential is unlocked by understanding its core components. Today, we’re diving deep into the essential n8n nodes that form the backbone of almost any data processing workflow.

Whether you’re cleaning API responses, filtering customer data, or orchestrating complex multi-step processes, these nodes are your go-to tools. We’ll explore their functions, why they’re crucial, and how to wield them with real-world examples. Get ready to supercharge your n8n workflows! 🚀


Why are Core Nodes So Important? 🤔

Imagine building a house. You need foundational elements: bricks, cement, wood, and a good hammer. In n8n, these “core nodes” are your foundational elements and versatile tools. They allow you to:

  • Manipulate Data: Transform, add, remove, or modify information.
  • Control Flow: Make decisions, loop through data, and handle errors.
  • Integrate & Interact: Send and receive data from virtually any service.
  • Scale & Optimize: Manage large datasets efficiently.

Without mastering these, your workflows will be basic. With them, you can build sophisticated, robust, and intelligent automations! Let’s get started! 💪


1. The Set Node: Your Data Transformer 🛠️

The Set node is arguably one of the most frequently used and fundamental nodes in n8n. It’s your workshop for reshaping data.

  • What it does: Allows you to add new fields, modify existing ones, rename fields, or remove fields from the incoming JSON data. Think of it as a highly flexible data editor.
  • Why it’s important: Data often comes in a format that isn’t ideal for the next step. You might need to rename a field to match an API’s requirement, calculate a new value, or simply remove sensitive information.
  • When to use it:
    • Cleaning up API responses.
    • Preparing data for another service.
    • Adding calculated fields (e.g., total_price).
    • Renaming cryptic field names.

Real-World Example: Cleaning and Enhancing API Data 🧹✨

Let’s say you’ve fetched a list of products from an e-commerce API, and the data looks like this:

[
  {
    "productId": "SKU001",
    "name": "Luxury Smartwatch",
    "priceStr": "$299.99",
    "availability_status": "in_stock",
    "internal_id": "abc123xyz"
  }
]

You want to:

  1. Rename productId to item_code.
  2. Convert priceStr (string) to price (number).
  3. Add a currency field with value “USD”.
  4. Remove internal_id.

How to do it with Set:

  1. Drag a Set node onto your canvas after your HTTP Request (or Start node for testing).
  2. Add Value:
    • Set Keep Only Set to false (unless you want to discard all other fields).
    • For price: Set Value to {{ parseFloat($json.priceStr.replace('$', '')) }} and Value Type to Number.
    • For currency: Set Value to "USD" and Value Type to String.
  3. Rename Key: Click “Add Operation”, select Rename Key.
    • Old Name: productId
    • New Name: item_code
  4. Remove Key: Click “Add Operation”, select Remove Key.
    • Key: internal_id

After this, your data will look much cleaner and ready for your next step!

[
  {
    "item_code": "SKU001",
    "name": "Luxury Smartwatch",
    "priceStr": "$299.99",
    "availability_status": "in_stock",
    "price": 299.99,
    "currency": "USD"
  }
]

(Note: priceStr still exists as we didn’t remove it explicitly, but you could!)


2. The If Node: The Decision Maker 🚦

The If node is your workflow’s logical brain. It allows your workflow to take different paths based on conditions you define.

  • What it does: Evaluates a condition (or multiple conditions) for each incoming item. If the condition is true, the item goes down the true branch; otherwise, it goes down the false branch.
  • Why it’s important: Essential for creating dynamic and intelligent workflows that adapt to data. Without it, every item would follow the exact same path.
  • When to use it:
    • Filtering data (e.g., only process orders with status: "completed").
    • Sending different notifications based on an event (e.g., high-priority alert vs. standard notification).
    • Skipping steps if a certain field is missing.

Real-World Example: Conditional Email Notifications 📧🔔

Imagine you receive new customer sign-ups. You want to send a welcome email, but if they signed up with a @test.com email address (for internal testing, perhaps), you want to skip sending a real email and instead log it to a testing channel.

How to do it with If:

  1. After your Webhook or Trigger node that receives new sign-ups, add an If node.
  2. Condition 1:
    • Value 1: {{ $json.email }} (the email address from the incoming data)
    • Operation: Ends With
    • Value 2: @test.com
  3. Connect the true branch to a Log node or a Send Message (e.g., Discord/Slack) node that notifies your internal testing channel.
  4. Connect the false branch to an Email Send node that sends the actual welcome email.

Now, your workflow intelligently handles sign-ups, preventing test data from cluttering your actual customer communications!


3. The Code Node: The Custom Logic Powerhouse 🧙

When standard nodes just don’t cut it, the Code node comes to the rescue. It allows you to write custom JavaScript directly within your workflow.

  • What it does: Executes arbitrary JavaScript code. You have access to the incoming data ($json, items), global workflow variables ($workflow), and can return modified data.
    • (Note: The Function Item node is older and largely deprecated in favor of the more powerful Code node.)
  • Why it’s important: For complex data transformations, custom calculations, specific filtering logic that’s hard to express with If nodes, or interacting with data in ways not covered by built-in nodes.
  • When to use it:
    • Complex string manipulation (e.g., parsing log lines).
    • Advanced mathematical calculations.
    • Iterating over nested arrays and restructuring data.
    • Implementing custom business logic.

Real-World Example: Dynamic Price Calculation with Discounts 💸🔢

Suppose you have product data with basePrice and a discountPercentage. You need to calculate the final salePrice and also check if the stock is below a certain threshold to flag it.

[
  {
    "productName": "Widget A",
    "basePrice": 100,
    "discountPercentage": 10,
    "stock": 50
  },
  {
    "productName": "Widget B",
    "basePrice": 200,
    "discountPercentage": 5,
    "stock": 5
  }
]

How to do it with Code:

  1. After your data source, add a Code node.
  2. Paste the following JavaScript:

    
    // The 'items' array contains all incoming data items
    for (const item of items) {
      const basePrice = item.json.basePrice;
      const discountPercentage = item.json.discountPercentage;
      const stock = item.json.stock;
    
      // Calculate salePrice
      const salePrice = basePrice * (1 - discountPercentage / 100);
      item.json.salePrice = parseFloat(salePrice.toFixed(2)); // Format to 2 decimal places
    
      // Check stock and add a flag
      if (stock  500`) or `HTTP Request` nodes to process each product separately!

Conclusion: Empower Your n8n Workflows! 🎉

By mastering these core n8n nodes – Set, If, Code, HTTP Request, Split In Batches, Merge, and Item Lists – you gain an incredible amount of power and flexibility in designing your automation workflows. These aren’t just isolated tools; they’re designed to work together, creating sophisticated data processing pipelines.

Remember:

  • Start simple: Understand one node at a time.
  • Experiment: Drag them onto your canvas and play with their settings.
  • Use expressions: Leverage {{ $json.fieldName }} to dynamically access data.
  • Debug: Use console.log in Code nodes and inspect node outputs to understand data flow.

The world of n8n is vast, but these core nodes are your compass and map. Go forth and automate responsibly! Happy building! 🏗️✨

Got any favorite node combinations or challenging data processing problems you solved with n8n? Share your experiences in the comments below! 👇 G

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다