Skip to content

标准参数#

¥Standard parameters

这些是 node 基础文件 的标准参数。它们对所有节点类型都相同。

¥These are the standard parameters for the node base file. They're the same for all node types.

displayName#

字符串 | 必填

¥String | Required

这是用户在 n8n 图形用户界面中看到的名称。

¥This is the name users see in the n8n GUI.

name#

字符串 | 必填

¥String | Required

对象的内部名称。用于从节点中的其他位置引用它。

¥The internal name of the object. Used to reference it from other places in the node.

icon#

字符串或对象 |必填

¥String or Object | Required

指定特定节点的图标。n8n 建议上传你自己的图片文件。

¥Specifies an icon for a particular node. n8n recommends uploading your own image file.

你可以将图标文件名作为字符串提供,也可以作为对象提供,以便处理浅色和夜间模式下的不同图标。如果图标在浅色和夜间模式下均有效,请使用以 file: 开头的字符串,该字符串指示图标文件的路径。例如:

¥You can provide the icon file name as a string, or as an object to handle different icons for light and dark modes. If the icon works in both light and dark modes, use a string that starts with file:, indicating the path to the icon file. For example:

1
icon: 'file:exampleNodeIcon.svg'

要为浅色和夜间模式提供不同的图标,请使用具有 lightdark 属性的对象。例如:

¥To provide different icons for light and dark modes, use an object with light and dark properties. For example:

1
2
3
4
icon: { 
  light: 'file:exampleNodeIcon.svg', 
  dark: 'file:exampleNodeIcon.dark.svg' 
}

n8n recommends using an SVG for your node icon, but you can also use PNG. If using PNG, the icon resolution should be 60x60px. Node icons should have a square or near-square aspect ratio.

Don't reference Font Awesome

If you want to use a Font Awesome icon in your node, download and embed the image.

group#

字符串数组 | 必需

¥Array of strings | Required

告知 n8n 工作流运行时节点的行为方式。选项包括:

¥Tells n8n how the node behaves when the workflow runs. Options are:

  • trigger:节点等待触发器。

¥trigger: node waits for a trigger.

  • schedule:节点等待定时器超时。

¥schedule: node waits for a timer to expire.

  • input, output, transform:这些目前无效。

¥input, output, transform: these currently have no effect.

  • 空数组 []。如果你不需要 triggerschedule,请使用此选项作为默认选项。

¥An empty array, []. Use this as the default option if you don't need trigger or schedule.

description#

字符串 | 必填

¥String | Required

节点的简短描述。n8n 在 GUI 中使用此主机。

¥A short description of the node. n8n uses this in the GUI.

defaults#

对象 | 必需

¥Object | Required

包含必要的品牌和名称设置。

¥Contains essential brand and name settings.

对象可以包含:

¥The object can include:

  • name:字符串。如果 displayName 过长,则用作画布上的节点名称。

¥name: String. Used as the node name on the canvas if the displayName is too long.

  • color:字符串。十六进制颜色代码。提供集成的品牌颜色,以便在 n8n 中使用。

¥color: String. Hex color code. Provide the brand color of the integration for use in n8n.

forceInputNodeExecution#

布尔值 | 可选

¥Boolean | Optional

构建多输入节点时,你可以选择强制所有分支上的所有前置节点在运行该节点之前执行。默认值为 false(仅需一个输入分支即可运行)。

¥When building a multi-input node, you can choose to force all preceding nodes on all branches to execute before the node runs. The default is false (requiring only one input branch to run).

inputs#

字符串数组 | 必需

¥Array of strings | Required

输入连接器的名称。控制节点输入端的连接器数量。如果你只需要一个连接器,请使用 input: ['main']

¥Names the input connectors. Controls the number of connectors the node has on the input side. If you need only one connector, use input: ['main'].

outputs#

字符串数组 | 必需

¥Array of strings | Required

输出连接器的名称。控制节点输出端的连接器数量。如果你只需要一个连接器,请使用 output: ['main']

¥Names the output connectors. Controls the number of connectors the node has on the output side. If you need only one connector, use output: ['main'].

requiredInputs#

整数或数组 | 可选

¥Integer or Array | Optional

用于多输入节点。指定节点执行前必须有数据的输入字段(即其分支必须运行)。

¥Used for multi-input nodes. Specify inputs by number that must have data (their branches must run) before the node can execute.

credentials#

对象数组 | 必需

¥Array of objects | Required

此参数告知 n8n 凭据选项。每个对象都定义了一种身份验证类型。

¥This parameter tells n8n the credential options. Each object defines an authentication type.

对象必须包含:

¥The object must include:

  • name:凭据名称。必须与凭据文件中的 name 属性匹配。例如,Asana.node.ts 中的 name: 'asanaApi' 链接到 AsanaApi.credential.ts 中的 name = 'asanaApi'

¥name: the credential name. Must match the name property in the credential file. For example, name: 'asanaApi' in Asana.node.ts links to name = 'asanaApi' in AsanaApi.credential.ts.

  • required:布尔值。指定使用此节点是否需要身份验证。

¥required: Boolean. Specify whether authentication is required to use this node.

requestDefaults#

对象 | 必需

¥Object | Required

设置节点发出的 API 调用的基本信息。

¥Set up the basic information for the API calls the node makes.

此对象必须包含:

¥This object must include:

  • baseURL:API 基本 URL。

¥baseURL: The API base URL.

你还可以添加:

¥You can also add:

  • headers:描述 API 调用标头的对象,例如内容类型。

¥headers: an object describing the API call headers, such as content type.

  • url:字符串。附加到 baseURL。通常情况下,你可以省略此步骤。通常在 operations 中提供。

¥url: string. Appended to the baseURL. You can usually leave this out. It's more common to provide this in the operations.

properties#

对象数组 | 必需

¥Array of objects | Required

此选项包含定义节点行为的资源对象和操作对象,以及用于设置可接收用户输入的必填字段和可选字段的对象。

¥This contains the resource and operations objects that define node behaviors, as well as objects to set up mandatory and optional fields that can receive user input.

资源对象#

¥Resource objects

资源对象包含以下参数:

¥A resource object includes the following parameters:

  • displayName:字符串。此设置应始终为 Resource

¥displayName: String. This should always be Resource.

  • name:字符串。此设置应始终为 resource

¥name: String. This should always be resource.

  • type:字符串。告知 n8n 要使用的 UI 元素以及预期的输入类型。例如,options 会导致 n8n 添加一个下拉列表,允许用户选择一个选项。有关更多信息,请参阅 节点 UI 元素

¥type: String. Tells n8n which UI element to use, and what input type to expect. For example, options results in n8n adding a dropdown that allows users to choose one option. Refer to Node UI elements for more information.

  • noDataExpression:布尔值。阻止使用表达式作为参数。resource 必须始终为 true

¥noDataExpression: Boolean. Prevents using an expression for the parameter. Must always be true for resource.

操作对象#

¥Operations objects

操作对象定义了资源的可用操作。

¥The operations object defines the available operations on a resource.

  • displayName:字符串。此设置应始终为 Options

¥displayName: String. This should always be Options.

  • name:字符串。此设置应始终为 option

¥name: String. This should always be option.

  • type:字符串。告知 n8n 要使用的 UI 元素以及预期的输入类型。例如,dateTime 会导致 n8n 添加日期选择器。有关更多信息,请参阅 节点 UI 元素

¥type: String. Tells n8n which UI element to use, and what input type to expect. For example, dateTime results in n8n adding a date picker. Refer to Node UI elements for more information.

  • noDataExpression:布尔值。阻止使用表达式作为参数。operation 必须始终为 true

¥noDataExpression: Boolean. Prevents using an expression for the parameter. Must always be true for operation.

  • options:对象数组每个对象描述操作的行为,例如其路由、使用的 REST 动词等等。options 对象包含:

¥options: Array of objects. Each objects describes an operation's behavior, such as its routing, the REST verb it uses, and so on. An options object includes:

  • name。字符串。

    ¥name. String.

  • value。字符串。

    ¥value. String.

  • action:字符串。此参数组合了资源和操作。你应该始终包含它,因为 n8n 将在未来版本中使用它。例如,给定一个名为 "Card" 的资源和一个名为 "Get all" 的操作,你的操作是 "Get all cards"

    ¥action: String. This parameter combines the resource and operation. You should always include it, as n8n will use it in future versions. For example, given a resource called "Card" and an operation "Get all", your action is "Get all cards".

  • description:字符串。

    ¥description: String.

  • routing:包含请求详细信息的对象。

    ¥routing: Object containing request details.

附加字段对象#

¥Additional fields objects

这些对象定义可选参数。n8n 会在 GUI 的“附加字段”下显示这些值。用户可以选择要设置的参数。

¥These objects define optional parameters. n8n displays them under Additional Fields in the GUI. Users can choose which parameters to set.

对象必须包含:

¥The objects must include:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
displayName: 'Additional Fields',
name: 'additionalFields',
// The UI element type
type: ''
placeholder: 'Add Field',
default: {},
displayOptions: {
  // Set which resources and operations this field is available for
  show: {
    resource: [
      // Resource names
    ],
    operation: [
      // Operation names
    ]
  },
}

有关 UI 元素类型的更多信息,请参阅 UI 元素

¥For more information about UI element types, refer to UI elements.