技能 编程开发 n8n 代码节点 JavaScript 指南

n8n 代码节点 JavaScript 指南

v20260928
n8n-code-javascript
本技能提供在 n8n 代码节点中编写 JavaScript 代码的专业指导。涵盖使用 $input、$json 和 $node 语法,利用 $helpers 发送 HTTP 请求,以及使用 DateTime 处理日期。适用于复杂转换、自定义计算、递归操作及数据聚合等场景,帮助解决代码节点错误并选择合适的节点模式。
获取技能
309 次下载
概览

JavaScript Code Node

Expert guidance for writing JavaScript code in n8n Code nodes.


Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use Code Node

Use Code node when:

  • ✅ Complex transformations requiring multiple steps
  • ✅ Custom calculations or business logic
  • ✅ Recursive operations
  • ✅ API response parsing with complex structure
  • ✅ Multi-step conditionals
  • ✅ Data aggregation across items

Consider other nodes when:

  • ❌ Simple field mapping → Use Set node
  • ❌ Basic filtering → Use Filter node
  • ❌ Simple conditionals → Use IF or Switch node
  • ❌ HTTP requests only → Use HTTP Request node

Code node excels at: Complex logic that would require chaining many simple nodes


Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
信息
Category 编程开发
Name n8n-code-javascript
版本 v20260928
大小 6.34KB
更新时间 2026-09-28
语言