n8n-code-javascript

Implement JavaScript logic in n8n Code nodes to transform input data.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/accutrust1688-maker/accu --skill n8n-code-javascript-accutrust1688-maker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/accutrust1688-maker/accu/tree/main/skills/n8n-code-javascript
Command: npx skills add https://github.com/accutrust1688-maker/accu --skill n8n-code-javascript-accutrust1688-maker

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing JavaScript in n8n Code nodes can be challenging due to data access patterns, webhook data nesting, and strict return formats. This guide explains how to safely transform data, access inputs, call APIs with $helpers, and handle errors while choosing the right Code node mode.

Core Features & Use Cases

  • Data access patterns: $input.all(), $input.first(), $input.item
  • Built-in utilities: $helpers.httpRequest(), DateTime (Luxon), $jmespath()
  • Return structure and safety: ensure [{json: {...}}] output
  • Real-world workflows: API integration, data transformation, and validation

Quick Start

Process all input items and return each transformed item in the standard [{json: {...}}] format.

Frequently Asked Questions about n8n-code-javascript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I transform data in n8n Code nodes using JavaScript?

To transform data in n8n Code nodes using JavaScript, use $input.all() for batch processing or $input.item for per-item processing, then return results in the standard [{json: {...}}] format.

Can I make HTTP requests inside an n8n Code node?

Yes, you can make HTTP requests in an n8n Code node by calling $helpers.httpRequest(). This enables API integration directly within your JavaScript logic without needing an external HTTP node.

What is the correct return format for n8n Code node JavaScript?

The correct return format for n8n Code node JavaScript is an array of objects structured as [{json: {...}}]. Ensuring this exact output structure prevents workflow errors and safely passes data downstream.

How does $input.all() differ from $input.first() in n8n?

$input.all() retrieves every incoming item for batch processing in n8n, whereas $input.first() accesses only the initial item. Choose $input.item instead for per-item processing mode.

Do I need external npm packages for date handling in n8n Code nodes?

No, you do not need external npm packages for date handling in n8n Code nodes. The environment provides DateTime via Luxon and other built-in utilities like $jmespath() for self-contained workflows.

Why does my n8n Code node fail when processing webhook data?

n8n Code nodes often fail due to webhook data nesting and incorrect return formats. Access nested data safely and always return the standard [{json: {...}}] array to resolve execution errors.