Skip to content

n8n 中的代码#

¥Code in n8n

n8n 是一款低代码工具。这意味着你可以无需编写代码即可完成许多操作,并在需要时添加代码。

¥n8n is a low-code tool. This means you can do a lot without code, then add code when needed.

工作流中的代码#

¥Code in your workflows

你可以在工作流程中的两个位置使用代码:

¥There are two places in your workflows where you can use code:

  • 表达式

¥Expressions

使用 expressions 转换节点中的 data。你可以在表达式中使用 JavaScript,以及 n8n 的 内置方法和变量数据转换函数

¥Use expressions to transform data in your nodes. You can use JavaScript in expressions, as well as n8n's Built-in methods and variables and Data transformation functions.

表达式

¥ Expressions

  • 代码节点

¥Code node

使用代码节点将 JavaScript 或 Python 添加到你的工作流中。

¥Use the Code node to add JavaScript or Python to your workflow.

代码节点

¥ Code node

其他技术资源#

¥Other technical resources

这些功能与技术用户相关。

¥These are features that are relevant to technical users.

技术节点#

¥Technical nodes

n8n 提供核心节点,简化了添加关键功能(例如 API 请求、Webhook、调度和文件处理)的过程。

¥n8n provides core nodes, which simplify adding key functionality such as API requests, webhooks, scheduling, and file handling.

  • 编写后端

¥Write a backend

HTTP 请求Webhook代码 节点可帮助你进行 API 调用、响应 Webhook 以及在工作流中编写任何 JavaScript 代码。

¥The HTTP Request, Webhook, and Code nodes help you make API calls, respond to webhooks, and write any JavaScript in your workflow.

使用此组件执行类似 创建 API 端点 的操作。

¥Use this do things like Create an API endpoint.

核心节点

¥ Core nodes

  • 表示复杂逻辑

¥Represent complex logic

你可以使用 如果Switch合并 等节点构建复杂的流程。

¥You can build complex flows, using nodes like If, Switch, and Merge nodes.

流程逻辑

¥ Flow logic

其他开发者资源#

¥Other developer resources

  • n8n API

n8n 提供一个 API,你可以通过编程方式执行许多与 GUI 相同的任务。工作流中有一个 n8n API 节点 用于访问 API。

¥n8n provides an API, where you can programmatically perform many of the same tasks as you can in the GUI. There's an n8n API node to access the API in your workflows.

API

  • 自托管

¥Self-host

你可以自行托管 n8n。这会将你的数据保留在你自己的基础设施上。

¥You can self-host n8n. This keeps your data on your own infrastructure.

托管

¥ Hosting

  • 构建你自己的节点

¥Build your own nodes

你可以构建自定义节点,将其安装到你的 n8n 实例上,并发布到 npm

¥You can build custom nodes, install them on your n8n instance, and publish them to npm.

创建节点

¥ Creating nodes