n8n-code-javascript

Write JavaScript in n8n Code nodes with data access and error handling.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/MaizeCobra/agentic-setup --skill n8n-code-javascript-maizecobra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/MaizeCobra/agentic-setup/tree/main/.opencode/skills/n8n-code-javascript
Command: npx skills add https://github.com/MaizeCobra/agentic-setup --skill n8n-code-javascript-maizecobra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill empowers you to write efficient and error-free JavaScript code within n8n Code nodes, transforming raw data into actionable insights and automating complex workflow logic.

Core Features & Use Cases

  • Data Transformation: Reshape, enrich, and normalize data from various sources.
  • Workflow Automation: Implement custom logic, complex conditionals, and batch processing.
  • API Integration: Make HTTP requests and parse responses directly within code nodes.
  • Use Case: Automatically process incoming webhook data, enrich it with external API calls, and format it for a CRM system, all within a single, robust Code node.

Quick Start

Use the n8n-code-javascript skill to write a JavaScript function that takes an array of user objects and returns only the active users.

Frequently Asked Questions about n8n-code-javascript

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

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

JavaScript in n8n Code nodes transforms raw data by accessing patterns like $input and $node, implementing custom logic, and returning structured arrays for workflow automation. Use it to reshape, enrich, and normalize data from various sources.

Why does my n8n Code node return an error when processing webhook data?

n8n Code node webhook data errors often stem from incorrect return formats or expression syntax confusion. You must properly structure the incoming webhook data and return a valid array of objects to prevent production errors.

What's the best way to make HTTP requests inside n8n workflow automation?

The best way to make HTTP requests in n8n workflow automation is using the built-in $helpers.httpRequest function within Code nodes. This allows you to fetch external API data and parse responses directly alongside your custom transformation logic.

Can I use built-in DateTime functions for data transformation in n8n?

Yes, you can use built-in DateTime functions in n8n Code nodes for data transformation. They allow you to parse, format, and manipulate date values directly within your JavaScript logic for accurate workflow automation.

How does $input differ from $node when accessing data in n8n?

$input and $node are data access patterns in n8n Code nodes. $input accesses data from the immediate previous node, while $node references data from specific named nodes, enabling complex conditionals and batch processing across the workflow.

How do I filter an array of user objects in an n8n Code node?

To filter an array of user objects in an n8n Code node, write a JavaScript function that iterates through $input data, applies a conditional filter like checking for active status, and returns only the matching objects as a structured array.