n8n-node-configuration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

n8n Node Configuration

n8n 节点配置

Expert guidance for operation-aware node configuration with property dependencies.

针对感知操作的节点配置(含属性依赖)的专业指南。

Configuration Philosophy

配置理念

Progressive disclosure: Start minimal, add complexity as needed
Configuration best practices:
  • get_node
    with
    detail: "standard"
    is the most used discovery pattern
  • 56 seconds average between configuration edits
  • Covers 95% of use cases with 1-2K tokens response
Key insight: Most configurations need only standard detail, not full schema!

渐进式披露:从最简配置开始,根据需要逐步增加复杂度
配置最佳实践:
  • 使用
    get_node
    并设置
    detail: "standard"
    是最常用的发现模式
  • 配置编辑之间的平均间隔为56秒
  • 用1-2K令牌的响应覆盖95%的使用场景
核心见解:大多数配置只需要标准详情,无需完整架构!

Core Concepts

核心概念

1. Operation-Aware Configuration

1. 感知操作的配置

Not all fields are always required - it depends on operation!
Example: Slack node
javascript
// For operation='post'
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",  // Required for post
  "text": "Hello!"        // Required for post
}

// For operation='update'
{
  "resource": "message",
  "operation": "update",
  "messageId": "123",     // Required for update (different!)
  "text": "Updated!"      // Required for update
  // channel NOT required for update
}
Key: Resource + operation determine which fields are required!
并非所有字段始终是必填项——这取决于操作类型!
示例:Slack 节点
javascript
// 当 operation='post' 时
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",  // 发布操作必填
  "text": "Hello!"        // 发布操作必填
}

// 当 operation='update' 时
{
  "resource": "message",
  "operation": "update",
  "messageId": "123",     // 更新操作必填(与发布不同!)
  "text": "Updated!"      // 更新操作必填
  // channel 对于更新操作不是必填项
}
关键:资源 + 操作类型决定了哪些字段是必填的!

2. Property Dependencies

2. 属性依赖

Fields appear/disappear based on other field values
Example: HTTP Request node
javascript
// When method='GET'
{
  "method": "GET",
  "url": "https://api.example.com"
  // sendBody not shown (GET doesn't have body)
}

// When method='POST'
{
  "method": "POST",
  "url": "https://api.example.com",
  "sendBody": true,       // Now visible!
  "body": {               // Required when sendBody=true
    "contentType": "json",
    "content": {...}
  }
}
Mechanism: displayOptions control field visibility
字段的显示/隐藏取决于其他字段的值
示例:HTTP 请求节点
javascript
// 当 method='GET' 时
{
  "method": "GET",
  "url": "https://api.example.com"
  // 不会显示 sendBody(GET 请求没有请求体)
}

// 当 method='POST' 时
{
  "method": "POST",
  "url": "https://api.example.com",
  "sendBody": true,       // 现在会显示!
  "body": {               // 当 sendBody=true 时必填
    "contentType": "json",
    "content": {...}
  }
}
机制:displayOptions 控制字段的可见性

3. Progressive Discovery

3. 渐进式发现

Use the right detail level:
  1. get_node({detail: "standard"}) - DEFAULT
    • Quick overview (~1-2K tokens)
    • Required fields + common options
    • Use first - covers 95% of needs
  2. get_node({mode: "search_properties", propertyQuery: "..."}) (for finding specific fields)
    • Find properties by name
    • Use when looking for auth, body, headers, etc.
  3. get_node({detail: "full"}) (complete schema)
    • All properties (~3-8K tokens)
    • Use only when standard detail is insufficient

选择合适的详情级别
  1. get_node({detail: "standard"}) - 默认选项
    • 快速概览(约1-2K令牌)
    • 包含必填字段和常用选项
    • 优先使用——覆盖95%的需求
  2. get_node({mode: "search_properties", propertyQuery: "..."})(用于查找特定字段)
    • 按名称查找属性
    • 用于查找认证、请求体、请求头等字段时
  3. get_node({detail: "full"})(完整架构)
    • 包含所有属性(约3-8K令牌)
    • 仅在标准详情不足以满足需求时使用

Configuration Workflow

配置工作流

Standard Process

标准流程

1. Identify node type and operation
2. Use get_node (standard detail is default)
3. Configure required fields
4. Validate configuration
5. If field unclear → get_node({mode: "search_properties"})
6. Add optional fields as needed
7. Validate again
8. Deploy
1. 确定节点类型和操作类型
2. 使用 get_node(默认是标准详情)
3. 配置必填字段
4. 验证配置
5. 如果字段不明确 → 使用 get_node({mode: "search_properties"})
6. 根据需要添加可选字段
7. 再次验证
8. 部署

Example: Configuring HTTP Request

示例:配置 HTTP 请求节点

Step 1: Identify what you need
javascript
// Goal: POST JSON to API
Step 2: Get node info
javascript
const info = get_node({
  nodeType: "nodes-base.httpRequest"
});

// Returns: method, url, sendBody, body, authentication required/optional
Step 3: Minimal config
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none"
}
Step 4: Validate
javascript
validate_node({
  nodeType: "nodes-base.httpRequest",
  config,
  profile: "runtime"
});
// → Error: "sendBody required for POST"
Step 5: Add required field
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none",
  "sendBody": true
}
Step 6: Validate again
javascript
validate_node({...});
// → Error: "body required when sendBody=true"
Step 7: Complete configuration
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none",
  "sendBody": true,
  "body": {
    "contentType": "json",
    "content": {
      "name": "={{$json.name}}",
      "email": "={{$json.email}}"
    }
  }
}
Step 8: Final validation
javascript
validate_node({...});
// → Valid! ✅

步骤1:明确需求
javascript
// 目标:向 API 发送 POST 请求(JSON 格式)
步骤2:获取节点信息
javascript
const info = get_node({
  nodeType: "nodes-base.httpRequest"
});

// 返回内容:method、url、sendBody、body、authentication 的必填/可选状态
步骤3:最简配置
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none"
}
步骤4:验证配置
javascript
validate_node({
  nodeType: "nodes-base.httpRequest",
  config,
  profile: "runtime"
});
// → 错误提示:"sendBody required for POST"
步骤5:添加必填字段
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none",
  "sendBody": true
}
步骤6:再次验证
javascript
validate_node({...});
// → 错误提示:"body required when sendBody=true"
步骤7:完成配置
javascript
{
  "method": "POST",
  "url": "https://api.example.com/create",
  "authentication": "none",
  "sendBody": true,
  "body": {
    "contentType": "json",
    "content": {
      "name": "={{$json.name}}",
      "email": "={{$json.email}}"
    }
  }
}
步骤8:最终验证
javascript
validate_node({...});
// → 验证通过! ✅

get_node Detail Levels

get_node 详情级别

Standard Detail (DEFAULT - Use This!)

标准详情(默认选项 - 优先使用!)

✅ Starting configuration
javascript
get_node({
  nodeType: "nodes-base.slack"
});
// detail="standard" is the default
Returns (~1-2K tokens):
  • Required fields
  • Common options
  • Operation list
  • Metadata
Use: 95% of configuration needs
✅ 初始配置时使用
javascript
get_node({
  nodeType: "nodes-base.slack"
});
// detail="standard" 是默认值
返回内容(约1-2K令牌):
  • 必填字段
  • 常用选项
  • 操作类型列表
  • 元数据
适用场景:95%的配置需求

Full Detail (Use Sparingly)

完整详情(谨慎使用)

✅ When standard isn't enough
javascript
get_node({
  nodeType: "nodes-base.slack",
  detail: "full"
});
Returns (~3-8K tokens):
  • Complete schema
  • All properties
  • All nested options
Warning: Large response, use only when standard insufficient
✅ 当标准详情不足以满足需求时使用
javascript
get_node({
  nodeType: "nodes-base.slack",
  detail: "full"
});
返回内容(约3-8K令牌):
  • 完整架构
  • 所有属性
  • 所有嵌套选项
注意:响应内容较大,仅在标准详情不足以满足需求时使用

Search Properties Mode

属性搜索模式

✅ Looking for specific field
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "auth"
});
Use: Find authentication, headers, body fields, etc.
✅ 查找特定字段时使用
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "auth"
});
适用场景:查找认证、请求头、请求体等字段

Decision Tree

决策树

┌─────────────────────────────────┐
│ Starting new node config?       │
├─────────────────────────────────┤
│ YES → get_node (standard)       │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ Standard has what you need?     │
├─────────────────────────────────┤
│ YES → Configure with it         │
│ NO  → Continue                  │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ Looking for specific field?     │
├─────────────────────────────────┤
│ YES → search_properties mode    │
│ NO  → Continue                  │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ Still need more details?        │
├─────────────────────────────────┤
│ YES → get_node({detail: "full"})│
└─────────────────────────────────┘

┌─────────────────────────────────┐
│ 开始配置新节点?                │
├─────────────────────────────────┤
│ 是 → 使用 get_node(标准详情)  │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ 标准详情包含你需要的内容吗?    │
├─────────────────────────────────┤
│ 是 → 基于标准详情配置           │
│ 否 → 继续下一步                 │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ 是否要查找特定字段?            │
├─────────────────────────────────┤
│ 是 → 使用属性搜索模式           │
│ 否 → 继续下一步                 │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ 仍然需要更多详情?              │
├─────────────────────────────────┤
│ 是 → 使用 get_node({detail: "full"})│
└─────────────────────────────────┘

Property Dependencies Deep Dive

属性依赖深入解析

displayOptions Mechanism

displayOptions 机制

Fields have visibility rules:
javascript
{
  "name": "body",
  "displayOptions": {
    "show": {
      "sendBody": [true],
      "method": ["POST", "PUT", "PATCH"]
    }
  }
}
Translation: "body" field shows when:
  • sendBody = true AND
  • method = POST, PUT, or PATCH
字段具有可见性规则
javascript
{
  "name": "body",
  "displayOptions": {
    "show": {
      "sendBody": [true],
      "method": ["POST", "PUT", "PATCH"]
    }
  }
}
规则解读:当满足以下条件时,显示 "body" 字段:
  • sendBody = true 且
  • method = POST、PUT 或 PATCH

Common Dependency Patterns

常见依赖模式

Pattern 1: Boolean Toggle

模式1:布尔值切换

Example: HTTP Request sendBody
javascript
// sendBody controls body visibility
{
  "sendBody": true   // → body field appears
}
示例:HTTP 请求节点的 sendBody
javascript
// sendBody 控制 body 字段的可见性
{
  "sendBody": true   // → 显示 body 字段
}

Pattern 2: Operation Switch

模式2:操作类型切换

Example: Slack resource/operation
javascript
// Different operations → different fields
{
  "resource": "message",
  "operation": "post"
  // → Shows: channel, text, attachments, etc.
}

{
  "resource": "message",
  "operation": "update"
  // → Shows: messageId, text (different fields!)
}
示例:Slack 节点的 resource/operation
javascript
// 不同的操作类型 → 不同的字段
{
  "resource": "message",
  "operation": "post"
  // → 显示:channel、text、attachments 等字段
}

{
  "resource": "message",
  "operation": "update"
  // → 显示:messageId、text(与发布操作的字段不同!)
}

Pattern 3: Type Selection

模式3:类型选择

Example: IF node conditions
javascript
{
  "type": "string",
  "operation": "contains"
  // → Shows: value1, value2
}

{
  "type": "boolean",
  "operation": "equals"
  // → Shows: value1, value2, different operators
}
示例:IF 节点的条件
javascript
{
  "type": "string",
  "operation": "contains"
  // → 显示:value1、value2
}

{
  "type": "boolean",
  "operation": "equals"
  // → 显示:value1、value2、不同的运算符
}

Finding Property Dependencies

查找属性依赖

Use get_node with search_properties mode:
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "body"
});

// Returns property paths matching "body" with descriptions
Or use full detail for complete schema:
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  detail: "full"
});

// Returns complete schema with displayOptions rules
Use this when: Validation fails and you don't understand why field is missing/required

使用 get_node 的属性搜索模式
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "body"
});

// 返回匹配 "body" 的属性路径及描述
或者使用完整详情获取完整架构
javascript
get_node({
  nodeType: "nodes-base.httpRequest",
  detail: "full"
});

// 返回包含 displayOptions 规则的完整架构
适用场景:当验证失败且你不理解字段为何缺失/必填时

Common Node Patterns

常见节点模式

Pattern 1: Resource/Operation Nodes

模式1:资源/操作类型节点

Examples: Slack, Google Sheets, Airtable
Structure:
javascript
{
  "resource": "<entity>",      // What type of thing
  "operation": "<action>",     // What to do with it
  // ... operation-specific fields
}
How to configure:
  1. Choose resource
  2. Choose operation
  3. Use get_node to see operation-specific requirements
  4. Configure required fields
示例:Slack、Google Sheets、Airtable
结构
javascript
{
  "resource": "<entity>",      // 操作对象类型
  "operation": "<action>",     // 对对象执行的操作
  // ... 操作特定字段
}
配置方法
  1. 选择资源类型
  2. 选择操作类型
  3. 使用 get_node 查看该操作类型的必填项
  4. 配置必填字段

Pattern 2: HTTP-Based Nodes

模式2:基于 HTTP 的节点

Examples: HTTP Request, Webhook
Structure:
javascript
{
  "method": "<HTTP_METHOD>",
  "url": "<endpoint>",
  "authentication": "<type>",
  // ... method-specific fields
}
Dependencies:
  • POST/PUT/PATCH → sendBody available
  • sendBody=true → body required
  • authentication != "none" → credentials required
示例:HTTP 请求、Webhook
结构
javascript
{
  "method": "<HTTP_METHOD>",
  "url": "<endpoint>",
  "authentication": "<type>",
  // ... 请求方法特定字段
}
依赖关系
  • POST/PUT/PATCH → 可使用 sendBody
  • sendBody=true → body 字段必填
  • authentication != "none" → 需要凭据

Pattern 3: Database Nodes

模式3:数据库节点

Examples: Postgres, MySQL, MongoDB
Structure:
javascript
{
  "operation": "<query|insert|update|delete>",
  // ... operation-specific fields
}
Dependencies:
  • operation="executeQuery" → query required
  • operation="insert" → table + values required
  • operation="update" → table + values + where required
示例:Postgres、MySQL、MongoDB
结构
javascript
{
  "operation": "<query|insert|update|delete>",
  // ... 操作特定字段
}
依赖关系
  • operation="executeQuery" → query 字段必填
  • operation="insert" → table + values 字段必填
  • operation="update" → table + values + where 字段必填

Pattern 4: Conditional Logic Nodes

模式4:条件逻辑节点

Examples: IF, Switch, Merge
Structure:
javascript
{
  "conditions": {
    "<type>": [
      {
        "operation": "<operator>",
        "value1": "...",
        "value2": "..."  // Only for binary operators
      }
    ]
  }
}
Dependencies:
  • Binary operators (equals, contains, etc.) → value1 + value2
  • Unary operators (isEmpty, isNotEmpty) → value1 only + singleValue: true

示例:IF、Switch、Merge
结构
javascript
{
  "conditions": {
    "<type>": [
      {
        "operation": "<operator>",
        "value1": "...",
        "value2": "..."  // 仅二元运算符需要
      }
    ]
  }
}
依赖关系
  • 二元运算符(equals、contains 等)→ 需要 value1 + value2
  • 一元运算符(isEmpty、isNotEmpty 等)→ 仅需要 value1 且 singleValue: true

Operation-Specific Configuration

操作特定配置示例

Slack Node Examples

Slack 节点示例

Post Message

发布消息

javascript
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",      // Required
  "text": "Hello!",           // Required
  "attachments": [],          // Optional
  "blocks": []                // Optional
}
javascript
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",      // 必填
  "text": "Hello!",           // 必填
  "attachments": [],          // 可选
  "blocks": []                // 可选
}

Update Message

更新消息

javascript
{
  "resource": "message",
  "operation": "update",
  "messageId": "1234567890",  // Required (different from post!)
  "text": "Updated!",         // Required
  "channel": "#general"       // Optional (can be inferred)
}
javascript
{
  "resource": "message",
  "operation": "update",
  "messageId": "1234567890",  // 必填(与发布操作不同!)
  "text": "Updated!",         // 必填
  "channel": "#general"       // 可选(可自动推断)
}

Create Channel

创建频道

javascript
{
  "resource": "channel",
  "operation": "create",
  "name": "new-channel",      // Required
  "isPrivate": false          // Optional
  // Note: text NOT required for this operation
}
javascript
{
  "resource": "channel",
  "operation": "create",
  "name": "new-channel",      // 必填
  "isPrivate": false          // 可选
  // 注意:此操作不需要 text 字段
}

HTTP Request Node Examples

HTTP 请求节点示例

GET Request

GET 请求

javascript
{
  "method": "GET",
  "url": "https://api.example.com/users",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "httpHeaderAuth",
  "sendQuery": true,                    // Optional
  "queryParameters": {                  // Shows when sendQuery=true
    "parameters": [
      {
        "name": "limit",
        "value": "100"
      }
    ]
  }
}
javascript
{
  "method": "GET",
  "url": "https://api.example.com/users",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "httpHeaderAuth",
  "sendQuery": true,                    // 可选
  "queryParameters": {                  // 当 sendQuery=true 时显示
    "parameters": [
      {
        "name": "limit",
        "value": "100"
      }
    ]
  }
}

POST with JSON

发送 JSON 的 POST 请求

javascript
{
  "method": "POST",
  "url": "https://api.example.com/users",
  "authentication": "none",
  "sendBody": true,                     // Required for POST
  "body": {                             // Required when sendBody=true
    "contentType": "json",
    "content": {
      "name": "John Doe",
      "email": "john@example.com"
    }
  }
}
javascript
{
  "method": "POST",
  "url": "https://api.example.com/users",
  "authentication": "none",
  "sendBody": true,                     // POST 请求必填
  "body": {                             // 当 sendBody=true 时必填
    "contentType": "json",
    "content": {
      "name": "John Doe",
      "email": "john@example.com"
    }
  }
}

IF Node Examples

IF 节点示例

String Comparison (Binary)

字符串比较(二元运算符)

javascript
{
  "conditions": {
    "string": [
      {
        "value1": "={{$json.status}}",
        "operation": "equals",
        "value2": "active"              // Binary: needs value2
      }
    ]
  }
}
javascript
{
  "conditions": {
    "string": [
      {
        "value1": "={{$json.status}}",
        "operation": "equals",
        "value2": "active"              // 二元运算符需要 value2
      }
    ]
  }
}

Empty Check (Unary)

空值检查(一元运算符)

javascript
{
  "conditions": {
    "string": [
      {
        "value1": "={{$json.email}}",
        "operation": "isEmpty",
        // No value2 - unary operator
        "singleValue": true             // Auto-added by sanitization
      }
    ]
  }
}

javascript
{
  "conditions": {
    "string": [
      {
        "value1": "={{$json.email}}",
        "operation": "isEmpty",
        // 一元运算符不需要 value2
        "singleValue": true             // 自动清理功能会添加此字段
      }
    ]
  }
}

Handling Conditional Requirements

处理条件性必填项

Example: HTTP Request Body

示例:HTTP 请求节点的 body 字段

Scenario: body field required, but only sometimes
Rule:
body is required when:
  - sendBody = true AND
  - method IN (POST, PUT, PATCH, DELETE)
How to discover:
javascript
// Option 1: Read validation error
validate_node({...});
// Error: "body required when sendBody=true"

// Option 2: Search for the property
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "body"
});
// Shows: body property with displayOptions rules

// Option 3: Try minimal config and iterate
// Start without body, validation will tell you if needed
场景:body 字段仅在特定条件下必填
规则
body 字段必填的条件:
  - sendBody = true 且
  - method 属于 (POST, PUT, PATCH, DELETE)
发现方法
javascript
// 方法1:查看验证错误信息
validate_node({...});
// 错误提示:"body required when sendBody=true"

// 方法2:搜索该属性
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "body"
});
// 显示:包含 displayOptions 规则的 body 属性

// 方法3:从最简配置开始逐步迭代
// 先不配置 body 字段,验证会提示你是否需要

Example: IF Node singleValue

示例:IF 节点的 singleValue 字段

Scenario: singleValue property appears for unary operators
Rule:
singleValue should be true when:
  - operation IN (isEmpty, isNotEmpty, true, false)
Good news: Auto-sanitization fixes this!
Manual check:
javascript
get_node({
  nodeType: "nodes-base.if",
  detail: "full"
});
// Shows complete schema with operator-specific rules

场景:一元运算符会显示 singleValue 属性
规则
当满足以下条件时,singleValue 应设为 true:
  - operation 属于 (isEmpty, isNotEmpty, true, false)
好消息:自动清理功能会修复这个问题!
手动检查方法
javascript
get_node({
  nodeType: "nodes-base.if",
  detail: "full"
});
// 显示包含运算符特定规则的完整架构

Configuration Anti-Patterns

配置反模式

❌ Don't: Over-configure Upfront

❌ 不要:过度配置(提前添加所有字段)

Bad:
javascript
// Adding every possible field
{
  "method": "GET",
  "url": "...",
  "sendQuery": false,
  "sendHeaders": false,
  "sendBody": false,
  "timeout": 10000,
  "ignoreResponseCode": false,
  // ... 20 more optional fields
}
Good:
javascript
// Start minimal
{
  "method": "GET",
  "url": "...",
  "authentication": "none"
}
// Add fields only when needed
错误做法
javascript
// 添加所有可能的字段
{
  "method": "GET",
  "url": "...",
  "sendQuery": false,
  "sendHeaders": false,
  "sendBody": false,
  "timeout": 10000,
  "ignoreResponseCode": false,
  // ... 另外20个可选字段
}
正确做法
javascript
// 从最简配置开始
{
  "method": "GET",
  "url": "...",
  "authentication": "none"
}
// 仅在需要时添加字段

❌ Don't: Skip Validation

❌ 不要:跳过验证

Bad:
javascript
// Configure and deploy without validating
const config = {...};
n8n_update_partial_workflow({...});  // YOLO
Good:
javascript
// Validate before deploying
const config = {...};
const result = validate_node({...});
if (result.valid) {
  n8n_update_partial_workflow({...});
}
错误做法
javascript
// 配置完成后直接部署,不进行验证
const config = {...};
n8n_update_partial_workflow({...});  // 直接上线
正确做法
javascript
// 部署前先验证
const config = {...};
const result = validate_node({...});
if (result.valid) {
  n8n_update_partial_workflow({...});
}

❌ Don't: Ignore Operation Context

❌ 不要:忽略操作上下文

Bad:
javascript
// Same config for all Slack operations
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",
  "text": "..."
}

// Then switching operation without updating config
{
  "resource": "message",
  "operation": "update",  // Changed
  "channel": "#general",  // Wrong field for update!
  "text": "..."
}
Good:
javascript
// Check requirements when changing operation
get_node({
  nodeType: "nodes-base.slack"
});
// See what update operation needs (messageId, not channel)

错误做法
javascript
// 所有 Slack 操作使用相同的配置
{
  "resource": "message",
  "operation": "post",
  "channel": "#general",
  "text": "..."
}

// 切换操作类型但不更新配置
{
  "resource": "message",
  "operation": "update",  // 已更改操作类型
  "channel": "#general",  // 这是发布操作的字段,更新操作不需要!
  "text": "..."
}
正确做法
javascript
// 更改操作类型时检查必填项
get_node({
  nodeType: "nodes-base.slack"
});
// 查看更新操作需要的字段(messageId,而不是 channel)

Best Practices

最佳实践

✅ Do

✅ 推荐做法

  1. Start with get_node (standard detail)
    • ~1-2K tokens response
    • Covers 95% of configuration needs
    • Default detail level
  2. Validate iteratively
    • Configure → Validate → Fix → Repeat
    • Average 2-3 iterations is normal
    • Read validation errors carefully
  3. Use search_properties mode when stuck
    • If field seems missing, search for it
    • Understand what controls field visibility
    • get_node({mode: "search_properties", propertyQuery: "..."})
  4. Respect operation context
    • Different operations = different requirements
    • Always check get_node when changing operation
    • Don't assume configs are transferable
  5. Trust auto-sanitization
    • Operator structure fixed automatically
    • Don't manually add/remove singleValue
    • IF/Switch metadata added on save
  1. 从 get_node(标准详情)开始
    • 响应内容约1-2K令牌
    • 覆盖95%的配置需求
    • 默认详情级别
  2. 迭代式验证
    • 配置 → 验证 → 修复 → 重复
    • 平均2-3次迭代是正常的
    • 仔细阅读验证错误信息
  3. 遇到问题时使用属性搜索模式
    • 如果字段似乎缺失,搜索该字段
    • 理解控制字段可见性的规则
    • 使用
      get_node({mode: "search_properties", propertyQuery: "..."})
  4. 尊重操作上下文
    • 不同的操作类型有不同的必填项
    • 更改操作类型时始终检查 get_node 的返回结果
    • 不要假设配置可以直接复用
  5. 信任自动清理功能
    • 运算符结构会自动修复
    • 不要手动添加/移除 singleValue 字段
    • 保存时会自动添加 IF/Switch 元数据

❌ Don't

❌ 不推荐做法

  1. Jump to detail="full" immediately
    • Try standard detail first
    • Only escalate if needed
    • Full schema is 3-8K tokens
  2. Configure blindly
    • Always validate before deploying
    • Understand why fields are required
    • Use search_properties for conditional fields
  3. Copy configs without understanding
    • Different operations need different fields
    • Validate after copying
    • Adjust for new context
  4. Manually fix auto-sanitization issues
    • Let auto-sanitization handle operator structure
    • Focus on business logic
    • Save and let system fix structure

  1. 直接使用 detail="full"
    • 先尝试标准详情
    • 仅在需要时升级到完整详情
    • 完整架构的响应内容有3-8K令牌
  2. 盲目配置
    • 部署前始终验证配置
    • 理解字段必填的原因
    • 对于条件性字段,使用属性搜索模式
  3. 复制配置但不理解其含义
    • 不同的操作类型需要不同的字段
    • 复制后进行验证
    • 根据新的上下文调整配置
  4. 手动修复自动清理功能可以处理的问题
    • 让自动清理功能处理运算符结构
    • 专注于业务逻辑
    • 保存后让系统修复结构

Detailed References

详细参考文档

For comprehensive guides on specific topics:
  • DEPENDENCIES.md - Deep dive into property dependencies and displayOptions
  • OPERATION_PATTERNS.md - Common configuration patterns by node type

有关特定主题的全面指南:
  • DEPENDENCIES.md - 深入解析属性依赖和 displayOptions
  • OPERATION_PATTERNS.md - 按节点类型分类的常见配置模式

Summary

总结

Configuration Strategy:
  1. Start with
    get_node
    (standard detail is default)
  2. Configure required fields for operation
  3. Validate configuration
  4. Search properties if stuck
  5. Iterate until valid (avg 2-3 cycles)
  6. Deploy with confidence
Key Principles:
  • Operation-aware: Different operations = different requirements
  • Progressive disclosure: Start minimal, add as needed
  • Dependency-aware: Understand field visibility rules
  • Validation-driven: Let validation guide configuration
Related Skills:
  • n8n MCP Tools Expert - How to use discovery tools correctly
  • n8n Validation Expert - Interpret validation errors
  • n8n Expression Syntax - Configure expression fields
  • n8n Workflow Patterns - Apply patterns with proper configuration
配置策略
  1. get_node
    开始(默认是标准详情)
  2. 配置当前操作类型的必填字段
  3. 验证配置
  4. 遇到问题时搜索属性
  5. 迭代直到验证通过(平均2-3次循环)
  6. 放心部署
核心原则
  • 感知操作:不同的操作类型有不同的需求
  • 渐进式披露:从最简配置开始,根据需要逐步增加
  • 感知依赖:理解字段可见性规则
  • 验证驱动:让验证结果指导配置
相关技能
  • n8n MCP 工具专家 - 如何正确使用发现工具
  • n8n 验证专家 - 解读验证错误信息
  • n8n 表达式语法 - 配置表达式字段
  • n8n 工作流模式 - 通过正确的配置应用模式