코드 노드 이해
중급
이것은Engineering분야의자동화 워크플로우로, 11개의 노드를 포함합니다.주로 Set, Code, ManualTrigger 등의 노드를 사용하며. 코드 노드를 통해 JavaScript 데이터 처리를 배우기: 필터링, 분석 및 내보내기 예제
사전 요구사항
- •특별한 사전 요구사항 없이 가져와 바로 사용 가능합니다
사용된 노드 (11)
카테고리
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"id": "1zR4oui3G7cMRnsP",
"meta": {
"instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
},
"name": "Understanding the code node",
"tags": [],
"nodes": [
{
"id": "735caeb3-82d9-4e58-aa90-d284a90a6100",
"name": "스티키 노트",
"type": "n8n-nodes-base.stickyNote",
"position": [
-600,
-100
],
"parameters": {
"color": 7,
"width": 460,
"height": 700,
"content": "## 🎯 WORKFLOW PURPOSE\nThis workflow demonstrates practical Code node usage for:\n\n• **Data filtering & transformation**\n• **Statistical calculations** \n• **Formatting for external systems**\n• **Real-world business scenarios**\n\n💡 Perfect for learning JavaScript data manipulation in n8n!\n\nAuthor : **David Olusola**\n\n🚀 **n8n Coaching**\nUnlock the full potential of n8n with personalized, one-on-one coaching. Whether you're just getting started or need help solving a specific challenge, I’ll guide you step-by-step so you can build confidently and efficiently.\n👉 [Book Coaching Session](mailto:david@daexai.com?subject=n8n%20Coaching%20Request)\n\n **n8n Consulting**\nHave a complex automation project, unique integration needs, or want a custom workflow built from scratch? Let’s collaborate to design and implement a robust solution tailored to your business.\n📩 [Inquire About Consulting Services](mailto:david@daexai.com?subject=n8n%20Consultation%20Request)\n"
},
"typeVersion": 1
},
{
"id": "69eeeaa0-490c-4cab-937c-edb266e6a0ed",
"name": "스티키 노트1",
"type": "n8n-nodes-base.stickyNote",
"position": [
620,
-200
],
"parameters": {
"color": 7,
"width": 680,
"height": 340,
"content": "## 🔧 CODE NODE BASICS\n\n**Key Points:**\n• Access input data via `items[0].json`\n• Always return array of objects\n• Use `.map()` to create multiple outputs\n• Return `[{ json: data }]` format\n\n**Common Patterns:**\n```javascript\n// Single output\nreturn [{ json: result }];\n\n// Multiple outputs\nreturn array.map(item => ({ json: item }));\n```"
},
"typeVersion": 1
},
{
"id": "d7cafddc-1fb0-47c0-80a5-9584c781432d",
"name": "스티키 노트2",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
120
],
"parameters": {
"color": 7,
"width": 480,
"height": 180,
"content": "## 📊 EXAMPLE 1: FILTER & TRANSFORM\n\n**What it does:**\n• Filters users over 18 years old\n• Adds calculated bonus field (10% of salary)\n• Creates formatted email addresses\n• Outputs each user as separate item\n\n**Use cases:**\n• Lead qualification\n• Customer segmentation\n• Data enrichment"
},
"typeVersion": 1
},
{
"id": "91e465df-24e5-49e9-8253-08d95c3d8860",
"name": "스티키 노트3",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
320
],
"parameters": {
"color": 7,
"width": 480,
"content": "## 📈 EXAMPLE 2: CALCULATE STATS\n\n**What it does:**\n• Aggregates team data into statistics\n• Calculates averages, totals, distributions\n• Creates single summary object\n\n**Use cases:**\n• Dashboard data preparation\n• Report generation\n• KPI calculations\n• Business intelligence"
},
"typeVersion": 1
},
{
"id": "15f8afd0-7694-490e-909a-1cccb1aad8b6",
"name": "스티키 노트4",
"type": "n8n-nodes-base.stickyNote",
"position": [
700,
540
],
"parameters": {
"color": 7,
"width": 280,
"height": 340,
"content": "## 🔄 EXAMPLE 3: FORMAT FOR EXPORT\n\n**What it does:**\n• Formats data for multiple output types\n• Creates CSV, email lists, API payloads\n• Adds metadata and timestamps\n\n**Use cases:**\n• API integrations\n• Email marketing prep\n• Data export functions\n• Multi-format reporting"
},
"typeVersion": 1
},
{
"id": "c56969b0-8ce9-4f12-a5ab-81571dfe5c37",
"name": "스티키 노트5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-40,
-80
],
"parameters": {
"color": 7,
"width": 300,
"height": 280,
"content": "## 🚀 QUICK START GUIDE\n\n**1. Click \"Test workflow\" to run**\n**2. Check each Code node's output**\n**3. Edit JavaScript code to experiment**\n**4. Copy patterns for your own workflows**\n\n**Pro Tips:**\n• Use `console.log()` for debugging\n• Test with small datasets first\n• Always handle edge cases\n• Return proper n8n format"
},
"typeVersion": 1
},
{
"id": "11c7822e-f7ef-4417-a489-24528b50d189",
"name": "워크플로우 실행 시",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-140,
360
],
"parameters": {},
"typeVersion": 1
},
{
"id": "8e750afa-737c-4cc9-bcd6-a886e247f545",
"name": "샘플 데이터 설정",
"type": "n8n-nodes-base.set",
"position": [
100,
340
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "99a2c0ab-5fdf-4d40-b989-492fc2393504",
"name": "scenario",
"type": "string",
"value": "user_data"
},
{
"id": "272adb73-f810-4f23-af05-f6f66fe6add8",
"name": "usersJson",
"type": "string",
"value": "[{\"name\": \"Alice Johnson\", \"age\": 28, \"email\": \"alice@example.com\", \"role\": \"developer\", \"salary\": 75000}, {\"name\": \"Bob Smith\", \"age\": 17, \"email\": \"bob@example.com\", \"role\": \"intern\", \"salary\": 25000}, {\"name\": \"Charlie Brown\", \"age\": 35, \"email\": \"charlie@example.com\", \"role\": \"manager\", \"salary\": 95000}, {\"name\": \"Diana Ross\", \"age\": 22, \"email\": \"diana@example.com\", \"role\": \"designer\", \"salary\": 60000}]"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "29e2b762-60ea-4262-b64b-691cafceacaa",
"name": "코드: 필터 및 변환",
"type": "n8n-nodes-base.code",
"position": [
340,
160
],
"parameters": {
"jsCode": "// EXAMPLE 1: Filter adults (age > 18) and add bonus field\nconst users = JSON.parse(items[0].json.usersJson);\n\n// Filter users over 18 and add calculated bonus\nconst adults = users\n .filter(user => user.age > 18)\n .map(user => ({\n ...user,\n bonus: user.salary * 0.1, // 10% bonus\n fullEmail: `${user.name} <${user.email}>`,\n isEligible: true\n }));\n\n// Return each user as separate item for n8n\nreturn adults.map(user => ({ json: user }));"
},
"typeVersion": 2
},
{
"id": "14efb99d-7522-4c7b-bb84-4f96e67cbdba",
"name": "코드: 통계 계산",
"type": "n8n-nodes-base.code",
"position": [
420,
440
],
"parameters": {
"jsCode": "// EXAMPLE 2: Aggregate data - calculate team statistics\nconst users = JSON.parse(items[0].json.usersJson);\n\n// Calculate team stats\nconst stats = {\n totalEmployees: users.length,\n averageAge: users.reduce((sum, user) => sum + user.age, 0) / users.length,\n totalSalary: users.reduce((sum, user) => sum + user.salary, 0),\n averageSalary: users.reduce((sum, user) => sum + user.salary, 0) / users.length,\n roleDistribution: users.reduce((acc, user) => {\n acc[user.role] = (acc[user.role] || 0) + 1;\n return acc;\n }, {}),\n minAge: Math.min(...users.map(u => u.age)),\n maxAge: Math.max(...users.map(u => u.age)),\n eligibleForBonus: users.filter(u => u.age > 18).length\n};\n\n// Return single item with all statistics\nreturn [{ json: stats }];"
},
"typeVersion": 2
},
{
"id": "f497b70c-805c-4efd-afb6-e1ec6c2adfa0",
"name": "코드: 내보내기 형식 지정",
"type": "n8n-nodes-base.code",
"position": [
380,
720
],
"parameters": {
"jsCode": "// EXAMPLE 3: Format data for external API or email\nconst users = JSON.parse(items[0].json.usersJson);\n\n// Create formatted output for different use cases\nconst emailList = users.map(user => user.email).join(', ');\nconst csvFormat = users.map(user => \n `${user.name},${user.age},${user.email},${user.role},${user.salary}`\n).join('\\n');\n\n// Create summary report\nconst report = {\n reportDate: new Date().toISOString(),\n teamOverview: {\n totalMembers: users.length,\n departments: [...new Set(users.map(u => u.role))],\n payrollTotal: users.reduce((sum, u) => sum + u.salary, 0)\n },\n formattedData: {\n emailList,\n csvFormat,\n jsonForApi: users.map(user => ({\n id: user.name.toLowerCase().replace(' ', '_'),\n displayName: user.name,\n contact: user.email,\n position: user.role,\n compensation: user.salary,\n eligibleForVoting: user.age >= 18\n }))\n }\n};\n\nreturn [{ json: report }];"
},
"typeVersion": 2
}
],
"active": false,
"pinData": {
"Set Sample Data": [
{
"json": {
"scenario": "user_data",
"usersJson": "[{\"name\": \"Alice Johnson\", \"age\": 28, \"email\": \"alice@example.com\", \"role\": \"developer\", \"salary\": 75000}, {\"name\": \"Bob Smith\", \"age\": 17, \"email\": \"bob@example.com\", \"role\": \"intern\", \"salary\": 25000}, {\"name\": \"Charlie Brown\", \"age\": 35, \"email\": \"charlie@example.com\", \"role\": \"manager\", \"salary\": 95000}, {\"name\": \"Diana Ross\", \"age\": 22, \"email\": \"diana@example.com\", \"role\": \"designer\", \"salary\": 60000}]"
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "bb114702-f10c-42ed-90e4-dd9ff6421c8e",
"connections": {
"8e750afa-737c-4cc9-bcd6-a886e247f545": {
"main": [
[
{
"node": "29e2b762-60ea-4262-b64b-691cafceacaa",
"type": "main",
"index": 0
},
{
"node": "14efb99d-7522-4c7b-bb84-4f96e67cbdba",
"type": "main",
"index": 0
},
{
"node": "f497b70c-805c-4efd-afb6-e1ec6c2adfa0",
"type": "main",
"index": 0
}
]
]
},
"11c7822e-f7ef-4417-a489-24528b50d189": {
"main": [
[
{
"node": "8e750afa-737c-4cc9-bcd6-a886e247f545",
"type": "main",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
중급 - 엔지니어링
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
JavaScript 마스터 클래스 2
JavaScript 배열 메서드 사용하여 데이터 레코드 중복 제거
Code
Manual Trigger
Code
Manual Trigger
9 노드David Olusola
엔지니어링
인터랙티브 코드 튜토리얼
교환형 RPG 스타일 튜토리얼 게임을 통해 JavaScript 프로그래밍을 배우기
Code
Manual Trigger
Code
Manual Trigger
11 노드David Olusola
엔지니어링
자동화된 리드 수집기: Apify에서 Google Sheets로
Apify에서 Google Sheets로의 데이터 정제를 통한 비즈니스 리드 수집 자동화
Set
Code
Http Request
+
Set
Code
Http Request
6 노드David Olusola
영업
Google Suite, PDF, 이메일을 사용한 비즈니스 보험 제출 자동화
Google Suite, PDF, 이메일을 통한 비즈니스 보험 제출 프로세스 자동화
If
Set
Code
+
If
Set
Code
37 노드David Olusola
문서 추출
HR 날짜 관리
JavaScript를 사용한 HR 직원 날짜 추적 및 알림 자동화
Set
Code
Gmail
+
Set
Code
Gmail
18 노드David Olusola
인사
AI 리드 봇 프로: Google Maps→Slack→HubSpot→$$$
Google 지도, GPT-4, HubSpot를 사용한 자동 잠재 고객 생성 및 자격 평가
If
Set
Code
+
If
Set
Code
16 노드David Olusola
영업
워크플로우 정보
난이도
중급
노드 수11
카테고리1
노드 유형4
저자
David Olusola
@dae221I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com
외부 링크
n8n.io에서 보기 →
이 워크플로우 공유