n8n 元数据#
处理 n8n 元数据的方法。
这包括:
Python 支持
您可以在代码节点中使用 Python。它在表达式中不可用。
| 方法 | 描述 | 在代码节点中可用? |
|---|---|---|
$env |
Contains n8n instance configuration environment variables. 包含 n8n 实例配置的环境变量。 | |
$execution.customData |
Set and get custom execution data. Refer to Custom executions data for more information. 设置和获取自定义执行数据。有关更多信息,请参阅自定义执行数据。 | |
$execution.id |
The unique ID of the current workflow execution. 当前工作流执行的唯一 ID。 | |
$execution.mode |
Whether the execution was triggered automatically, or by manually running the workflow. Possible values are test and production. 执行是自动触发的,还是通过手动运行工作流触发的。可能的值是 test 和 production。 |
|
$execution.resumeUrl |
The webhook URL to call to resume a workflow waiting at a Wait node. 用于恢复在 Wait 节点等待的工作流的 webhook URL。 | |
$getWorkflowStaticData(type) |
View an example. Static data doesn't persist when testing workflows. The workflow must be active and called by a trigger or webhook to save static data. This gives access to the static workflow data. 查看示例。测试工作流时静态数据不会持久化。工作流必须处于活动状态并由触发器或 webhook 调用才能保存静态数据。这提供对静态工作流数据的访问。 | |
$("<node-name>").isExecuted |
Check whether a node has already executed. 检查节点是否已执行。 | |
$itemIndex |
The index of an item in a list of items. 项目在项目列表中的索引。 | |
$nodeVersion |
Get the version of the current node. 获取当前节点的版本。 | |
$prevNode.name |
The name of the node that the current input came from. When using the Merge node, note that $prevNode always uses the first input connector. 当前输入来自的节点的名称。使用 Merge 节点时,请注意 $prevNode 始终使用第一个输入连接器。 |
|
$prevNode.outputIndex |
The index of the output connector that the current input came from. Use this when the previous node had multiple outputs (such as an If or Switch node). When using the Merge node, note that $prevNode always uses the first input connector. 当前输入来自的输出连接器的索引。当前一个节点有多个输出(例如 If 或 Switch 节点)时使用此选项。使用 Merge 节点时,请注意 $prevNode 始终使用第一个输入连接器。 |
|
$prevNode.runIndex |
The run of the previous node that generated the current input. When using the Merge node, note that $prevNode always uses the first input connector. 生成当前输入的前一个节点的运行次数。使用 Merge 节点时,请注意 $prevNode 始终使用第一个输入连接器。 |
|
$runIndex |
How many times n8n has executed the current node. Zero-based (the first run is 0, the second is 1, and so on). n8n 执行当前节点的次数。从零开始(第一次运行是 0,第二次是 1,依此类推)。 | |
$secrets |
Contains information about your External secrets setup. 包含有关你的外部密钥设置的信息。 | |
$vars |
Contains the Variables available in the active environment. 包含活动环境中可用的变量。 | |
$version |
The node version. 节点版本。 | |
$workflow.active |
Whether the workflow is active (true) or not (false). 工作流是否处于活动状态(true)或不活动状态(false)。 | |
$workflow.id |
The workflow ID. 工作流 ID。 | |
$workflow.name |
The workflow name. 工作流名称。 |
| Method | Description |
|---|---|
_items |
在"为所有项目运行一次"模式下包含传入的项目。 |
_item |
在"为每个项目运行一次"模式下包含正在迭代的项目。 |
| 方法 | 描述 |
|---|---|
_env |
包含 n8n 实例配置的环境变量。 |
_execution.customData |
设置和获取自定义执行数据。有关更多信息,请参考自定义执行数据。 |
_execution.id |
当前工作流执行的唯一 ID。 |
_execution.mode |
执行是自动触发的,还是通过手动运行工作流触发的。可能的值是 test 和 production。 |
_execution.resumeUrl |
用于恢复在 Wait 节点等待的工作流的 webhook URL。 |
_getWorkflowStaticData(type) |
查看示例。测试工作流时静态数据不会持久化。工作流必须处于活动状态并由触发器或 webhook 调用才能保存静态数据。这提供对静态工作流数据的访问。 |
_("<node-name>").isExecuted |
检查节点是否已执行。 |
_nodeVersion |
获取当前节点的版本。 |
_prevNode.name |
当前输入来自的节点的名称。使用 Merge 节点时,请注意 _prevNode 始终使用第一个输入连接器。 |
_prevNode.outputIndex |
当前输入来自的输出连接器的索引。当前一个节点有多个输出(例如 If 或 Switch 节点)时使用此选项。使用 Merge 节点时,请注意 _prevNode 始终使用第一个输入连接器。 |
_prevNode.runIndex |
生成当前输入的前一个节点的运行次数。使用 Merge 节点时,请注意 _prevNode 始终使用第一个输入连接器。 |
_runIndex |
n8n 执行当前节点的次数。从零开始(第一次运行是 0,第二次是 1,依此类推)。 |
_secrets |
包含有关你的外部密钥设置的信息。 |
_vars |
包含活动环境中可用的变量。 |
_workflow.active |
工作流是否处于活动状态(true)或不活动状态(false)。 |
_workflow.id |
工作流 ID。 |
_workflow.name |
工作流名称。 |