μ›”. 8μ›” 18th, 2025

D: The Set node in n8n is one of the most versatile tools for manipulating, transforming, and restructuring data in your workflows. Whether you’re a beginner or an advanced user, mastering this node can significantly enhance your automation capabilities.

In this comprehensive guide, we’ll explore:
βœ” What the Set Node Does
βœ” Key Features & Configuration Options
βœ” 10 Practical Use Cases (with examples!)
βœ” Pro Tips & Best Practices

Let’s dive in! πŸŠβ€β™‚οΈ


πŸ” What is the Set Node?

The Set node allows you to:
βœ… Add new fields to your data
βœ… Modify existing values
βœ… Delete unwanted fields
βœ… Restructure JSON objects

It’s like a Swiss Army knife πŸ›  for data transformation in n8n!


βš™οΈ How to Configure the Set Node

When you add a Set node, you’ll see these key options:

1. Mode (Choose how data is modified)

  • “Set” β†’ Overwrites or adds new fields
  • “Remove” β†’ Deletes specified fields
  • “Keep Only” β†’ Keeps only selected fields

2. Value Type (How to assign data)

  • “String” β†’ Plain text
  • “Number” β†’ Numeric values
  • “Boolean” β†’ True/False
  • “JSON” β†’ Structured data

3. Include in Output

  • Toggle whether to pass modified data forward

🎯 10 Powerful Use Cases for the Set Node

1. Adding Timestamps to Records

πŸ“Œ Use Case: Automatically log when a record is processed.
βš™οΈ Setup:

{
  "timestamp": "={{ $now.toISOString() }}"
}

2. Renaming Fields for API Compatibility

πŸ“Œ Use Case: Adjust field names before sending to another service.
βš™οΈ Setup:

{
  "user_id": "={{ $input.item.id }}",
  "email_address": "={{ $input.item.email }}"
}

3. Combining Multiple Fields

πŸ“Œ Use Case: Merge first & last names into a full name.
βš™οΈ Setup:

{
  "full_name": "={{ $input.item.first_name }} {{ $input.item.last_name }}"
}

4. Removing Sensitive Data

πŸ“Œ Use Case: Strip out passwords before logging.
βš™οΈ Mode: “Remove”
βš™οΈ Fields: ["password", "credit_card"]

5. Setting Default Values

πŸ“Œ Use Case: Ensure a field always has a fallback value.
βš™οΈ Setup:

{
  "status": "={{ $input.item.status || 'pending' }}"
}

6. Converting Data Types

πŸ“Œ Use Case: Change a string to a number for calculations.
βš™οΈ Setup:

{
  "price": "={{ Number($input.item.price_str) }}"
}

7. Flattening Nested JSON

πŸ“Œ Use Case: Simplify complex API responses.
βš™οΈ Setup:

{
  "user_name": "={{ $input.item.user.profile.name }}",
  "user_email": "={{ $input.item.user.contact.email }}"
}

8. Conditional Field Assignment

πŸ“Œ Use Case: Apply discounts only if eligible.
βš™οΈ Setup:

{
  "discount_price": "={{ $input.item.is_member ? $input.item.price * 0.9 : $input.item.price }}"
}

9. Creating Arrays from Strings

πŸ“Œ Use Case: Split tags into an array.
βš™οΈ Setup:

{
  "tags": "={{ $input.item.tags_str.split(',') }}"
}

10. Generating Custom IDs

πŸ“Œ Use Case: Create unique identifiers.
βš™οΈ Setup:

{
  "custom_id": "={{ 'CUST-' + $input.item.id + '-' + Date.now() }}"
}

πŸ’‘ Pro Tips for Using the Set Node

πŸ”Ή Use JavaScript expressions (={{ ... }}) for dynamic values.
πŸ”Ή Chain multiple Set nodes for complex transformations.
πŸ”Ή Test with sample data before full execution.
πŸ”Ή Combine with Function nodes for advanced logic.


οΏ½ Conclusion

The Set node is a game-changer for data manipulation in n8n. Whether you’re cleaning data, reformatting API responses, or adding metadata, mastering this tool will make your workflows more efficient and flexible.

πŸ’¬ Got questions? Drop them in the comments!
πŸ”„ Found this useful? Share with fellow automators!

Happy automating! πŸ€–βœ¨


πŸ”— Further Reading:

Would you like a deep dive into any specific use case? Let me know! πŸš€

λ‹΅κΈ€ 남기기

이메일 μ£Όμ†ŒλŠ” κ³΅κ°œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•„μˆ˜ ν•„λ“œλŠ” *둜 ν‘œμ‹œλ©λ‹ˆλ‹€