Interaktiver Code-Tutorial

Fortgeschritten

Dies ist ein Engineering-Bereich Automatisierungsworkflow mit 11 Nodes. Hauptsächlich werden Code, ManualTrigger und andere Nodes verwendet. JavaScript-Programmierung lernen durch interaktive RPG-artige Tutorial-Spiele

Voraussetzungen
  • Keine besonderen Voraussetzungen, sofort nach Import nutzbar

Verwendete Nodes (11)

Kategorie

Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "KzoygRKiA5FU2t6W",
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "name": "interactive code tutorial",
  "tags": [],
  "nodes": [
    {
      "id": "ff379455-2bfc-4b10-86d3-34e6061e8e75",
      "name": "🎯 Spiel starten",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        240,
        280
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "342c8cd6-27af-4562-ba21-44576e76aa0a",
      "name": "Spielkopfzeile",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -60
      ],
      "parameters": {
        "width": 400,
        "height": 580,
        "content": "#  Code Challenge Adventure\n\n**Author:** David Olusola\n\n## 🎯 Game Rules\n1. Complete coding challenges to earn points\n2. Each level teaches different n8n concepts\n3. Collect power-ups and achievements\n4. Beat the final boss with your coding skills!\n\n## 🚀 n8n Coaching\nLevel up your n8n skills with personalized coaching!\n👉 [Book Session](mailto:david@daexai.com?subject=n8n%20Coaching%20Request)\n\n## 🔧 n8n Consulting\nNeed custom automation solutions?\n📩 [Get Consulting](mailto:david@daexai.com?subject=n8n%20Consultation%20Request)"
      },
      "typeVersion": 1
    },
    {
      "id": "a64d11d1-e7e1-4f08-a130-5bca37f68e09",
      "name": "Level-1-Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        500
      ],
      "parameters": {
        "width": 250,
        "height": 330,
        "content": "## 🎲 Level 1: Data Warrior\n\n**Challenge:** Deduplicate the corrupted user database!\n\n**Skills Learned:**\n- Array filtering\n- Data deduplication\n- JSON manipulation\n\n**Reward:** 100 XP + Data Shield 🛡️"
      },
      "typeVersion": 1
    },
    {
      "id": "995b3576-696f-435b-a9fd-3e811e25815d",
      "name": "Level-2-Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        500
      ],
      "parameters": {
        "width": 250,
        "height": 290,
        "content": "## ⚔️ Level 2: API Ninja\n\n**Challenge:** Transform and validate API responses!\n\n**Skills Learned:**\n- Data transformation\n- Validation logic\n- Error handling\n\n**Reward:** 200 XP + Speed Boost ⚡"
      },
      "typeVersion": 1
    },
    {
      "id": "f862073b-d3e5-460e-8d4f-6c6f040d2c83",
      "name": "Boss-Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        380
      ],
      "parameters": {
        "width": 250,
        "height": 330,
        "content": "## 🏆 Final Boss: Automation Master\n\n**Challenge:** Build a complete workflow system!\n\n**Skills Learned:**\n- Complex logic\n- Error handling\n- Performance optimization\n\n**Reward:** 500 XP + Master Badge 🏅"
      },
      "typeVersion": 1
    },
    {
      "id": "00297d14-9d74-4a5e-a48c-3c2795aeda6a",
      "name": "🎲 Level 1: Data Warrior",
      "type": "n8n-nodes-base.code",
      "position": [
        620,
        280
      ],
      "parameters": {
        "jsCode": "// 🎲 Level 1: Data Warrior Challenge\n// Challenge: Deduplicate corrupted user database\n\nconst gameData = items[0].json;\nconst player = gameData.player;\n\n// Corrupted database with duplicates (the challenge data)\nconst corruptedUsers = [\n  { id: 1, name: \"Knight Arthur\", email: \"arthur@camelot.com\", class: \"Warrior\" },\n  { id: 2, name: \"Wizard Merlin\", email: \"merlin@magic.com\", class: \"Mage\" },\n  { id: 3, name: \"Knight Arthur\", email: \"arthur@camelot.com\", class: \"Warrior\" }, // Duplicate\n  { id: 4, name: \"Archer Robin\", email: \"robin@forest.com\", class: \"Ranger\" },\n  { id: 5, name: \"Rogue Shadow\", email: \"shadow@dark.com\", class: \"Assassin\" },\n  { id: 6, name: \"Wizard Merlin\", email: \"merlin@magic.com\", class: \"Mage\" }, // Duplicate\n  { id: 7, name: \"Paladin Grace\", email: \"grace@light.com\", class: \"Healer\" },\n  { id: 8, name: \"Archer Robin\", email: \"robin@forest.com\", class: \"Ranger\" } // Duplicate\n];\n\n// THE CHALLENGE: Deduplicate based on email (player must implement this logic)\n// This is the solution - in a real game, the player would need to write this\nconst cleanedUsers = corruptedUsers.filter(\n  (user, index, self) => \n    index === self.findIndex(u => u.email === user.email)\n);\n\n// Calculate challenge results\nconst originalCount = corruptedUsers.length;\nconst cleanedCount = cleanedUsers.length;\nconst duplicatesRemoved = originalCount - cleanedCount;\n\n// Determine success and rewards\nconst isSuccess = duplicatesRemoved > 0;\nconst xpGained = isSuccess ? 100 : 0;\nconst powerUp = isSuccess ? \"Data Shield 🛡️\" : null;\n\n// Update player stats\nif (isSuccess) {\n  player.xp += xpGained;\n  player.level = Math.floor(player.xp / 100) + 1;\n  if (powerUp) player.inventory.push(powerUp);\n  player.achievements.push(\"Data Warrior\");\n}\n\nconst challengeResult = {\n  level: 1,\n  challengeName: \"Data Warrior Challenge\",\n  success: isSuccess,\n  stats: {\n    originalRecords: originalCount,\n    cleanedRecords: cleanedCount,\n    duplicatesRemoved: duplicatesRemoved\n  },\n  rewards: {\n    xp: xpGained,\n    powerUp: powerUp\n  },\n  message: isSuccess ? \n    `🎉 SUCCESS! You've cleaned the corrupted database and earned ${xpGained} XP!` :\n    \"💀 FAILED! The database is still corrupted. Try again!\"\n};\n\nreturn [{\n  json: {\n    ...challengeResult,\n    player,\n    cleanedData: cleanedUsers,\n    nextLevel: isSuccess ? 2 : 1\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "98162e1a-8f3e-418d-b1d5-e1b03f518e1d",
      "name": "⚔️ Level 2: API Ninja",
      "type": "n8n-nodes-base.code",
      "position": [
        900,
        280
      ],
      "parameters": {
        "jsCode": "// ⚔️ Level 2: API Ninja Challenge\n// Challenge: Transform and validate API responses\n\nconst gameData = items[0].json;\nconst player = gameData.player;\n\n// Mock API response with messy data (the challenge)\nconst apiResponse = {\n  users: [\n    { id: \"1\", full_name: \"  John Doe  \", email_address: \"JOHN@EXAMPLE.COM\", age: \"25\", status: \"active\" },\n    { id: \"2\", full_name: \"jane smith\", email_address: \"jane@example.com\", age: \"invalid\", status: \"INACTIVE\" },\n    { id: \"3\", full_name: \"Bob Johnson\", email_address: \"bob@test.com\", age: \"30\", status: \"active\" },\n    { id: \"4\", full_name: \"\", email_address: \"empty@test.com\", age: \"22\", status: \"pending\" },\n    { id: \"5\", full_name: \"Alice Brown\", email_address: \"alice@domain.com\", age: \"28\", status: \"active\" }\n  ]\n};\n\n// THE CHALLENGE: Transform and validate the data\n// This is the solution - in a real game, player would implement this\nconst transformedUsers = apiResponse.users.map(user => {\n  const transformed = {\n    id: parseInt(user.id),\n    name: user.full_name.trim(),\n    email: user.email_address.toLowerCase(),\n    age: parseInt(user.age) || 0,\n    status: user.status.toLowerCase(),\n    isValid: true\n  };\n  \n  // Validation rules\n  if (!transformed.name || transformed.name.length < 2) {\n    transformed.isValid = false;\n    transformed.errors = (transformed.errors || []).concat(['Invalid name']);\n  }\n  \n  if (!transformed.email.includes('@')) {\n    transformed.isValid = false;\n    transformed.errors = (transformed.errors || []).concat(['Invalid email']);\n  }\n  \n  if (transformed.age < 18 || transformed.age > 120) {\n    transformed.isValid = false;\n    transformed.errors = (transformed.errors || []).concat(['Invalid age']);\n  }\n  \n  return transformed;\n});\n\n// Calculate challenge results\nconst validUsers = transformedUsers.filter(user => user.isValid);\nconst invalidUsers = transformedUsers.filter(user => !user.isValid);\n\nconst isSuccess = validUsers.length >= 3; // Need at least 3 valid users to pass\nconst xpGained = isSuccess ? 200 : 0;\nconst powerUp = isSuccess ? \"Speed Boost ⚡\" : null;\n\n// Update player stats\nif (isSuccess) {\n  player.xp += xpGained;\n  player.level = Math.floor(player.xp / 100) + 1;\n  if (powerUp) player.inventory.push(powerUp);\n  player.achievements.push(\"API Ninja\");\n}\n\nconst challengeResult = {\n  level: 2,\n  challengeName: \"API Ninja Challenge\",\n  success: isSuccess,\n  stats: {\n    totalUsers: transformedUsers.length,\n    validUsers: validUsers.length,\n    invalidUsers: invalidUsers.length,\n    transformationAccuracy: Math.round((validUsers.length / transformedUsers.length) * 100)\n  },\n  rewards: {\n    xp: xpGained,\n    powerUp: powerUp\n  },\n  message: isSuccess ? \n    `⚡ SUCCESS! You've mastered data transformation and earned ${xpGained} XP!` :\n    \"🥷 FAILED! Your ninja skills need more practice. Try again!\"\n};\n\nreturn [{\n  json: {\n    ...challengeResult,\n    player,\n    validUsers,\n    invalidUsers,\n    nextLevel: isSuccess ? 3 : 2\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "3042b31c-2dec-45d3-8bdb-7487d8f22eaf",
      "name": "🏆 Endboss: Automation Master",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        280
      ],
      "parameters": {
        "jsCode": "// 🏆 Final Boss: Automation Master Challenge\n// Challenge: Build a complete workflow system\n\nconst gameData = items[0].json;\nconst player = gameData.player;\n\n// Complex workflow challenge data\nconst workflowChallenge = {\n  tasks: [\n    { id: 1, name: \"Data Ingestion\", status: \"pending\", priority: \"high\", assignee: \"system\" },\n    { id: 2, name: \"Data Validation\", status: \"pending\", priority: \"high\", assignee: \"validator\" },\n    { id: 3, name: \"Data Transformation\", status: \"pending\", priority: \"medium\", assignee: \"transformer\" },\n    { id: 4, name: \"Error Handling\", status: \"pending\", priority: \"high\", assignee: \"error_handler\" },\n    { id: 5, name: \"Data Output\", status: \"pending\", priority: \"low\", assignee: \"output\" },\n    { id: 6, name: \"Notification\", status: \"pending\", priority: \"medium\", assignee: \"notifier\" }\n  ],\n  workflow: {\n    name: \"Master Automation Pipeline\",\n    steps: 6,\n    complexity: \"Expert\",\n    timeLimit: \"5 minutes\"\n  }\n};\n\n// THE FINAL CHALLENGE: Process tasks in correct order with error handling\n// This is the solution - the ultimate test of n8n skills\nconst processWorkflow = (tasks) => {\n  const results = [];\n  const errors = [];\n  \n  try {\n    // Step 1: Sort by priority (high -> medium -> low)\n    const priorityOrder = { 'high': 3, 'medium': 2, 'low': 1 };\n    const sortedTasks = tasks.sort((a, b) => priorityOrder[b.priority] - priorityOrder[a.priority]);\n    \n    // Step 2: Process each task with error handling\n    sortedTasks.forEach(task => {\n      try {\n        // Simulate processing\n        const processed = {\n          ...task,\n          status: 'completed',\n          completedAt: new Date().toISOString(),\n          processingTime: Math.random() * 1000 + 500 // Random processing time\n        };\n        \n        // Add some business logic\n        if (task.name.includes('Error')) {\n          processed.errorHandlingActive = true;\n        }\n        \n        if (task.priority === 'high') {\n          processed.fastTrack = true;\n        }\n        \n        results.push(processed);\n      } catch (error) {\n        errors.push({\n          taskId: task.id,\n          error: error.message,\n          timestamp: new Date().toISOString()\n        });\n      }\n    });\n    \n    // Step 3: Generate workflow summary\n    const summary = {\n      totalTasks: tasks.length,\n      completedTasks: results.length,\n      failedTasks: errors.length,\n      highPriorityTasks: results.filter(t => t.priority === 'high').length,\n      averageProcessingTime: Math.round(results.reduce((sum, t) => sum + t.processingTime, 0) / results.length),\n      workflowEfficiency: Math.round((results.length / tasks.length) * 100)\n    };\n    \n    return { results, errors, summary };\n  } catch (error) {\n    return { results: [], errors: [{ general: error.message }], summary: null };\n  }\n};\n\n// Execute the workflow\nconst workflowResult = processWorkflow(workflowChallenge.tasks);\n\n// Determine success (need 100% completion and efficiency > 80%)\nconst isSuccess = workflowResult.summary && \n                  workflowResult.summary.completedTasks === workflowChallenge.tasks.length &&\n                  workflowResult.summary.workflowEfficiency >= 80;\n\nconst xpGained = isSuccess ? 500 : 0;\nconst powerUp = isSuccess ? \"Master Badge 🏅\" : null;\nconst finalTitle = isSuccess ? \"🏆 AUTOMATION MASTER\" : \"🎯 Aspiring Automator\";\n\n// Update player stats for final time\nif (isSuccess) {\n  player.xp += xpGained;\n  player.level = Math.floor(player.xp / 100) + 1;\n  if (powerUp) player.inventory.push(powerUp);\n  player.achievements.push(\"Automation Master\");\n  player.title = finalTitle;\n}\n\n// Calculate final game score\nconst finalScore = player.xp + (player.achievements.length * 50);\n\nconst bossResult = {\n  level: 3,\n  challengeName: \"Automation Master Boss Battle\",\n  success: isSuccess,\n  workflowResult,\n  rewards: {\n    xp: xpGained,\n    powerUp: powerUp,\n    title: finalTitle\n  },\n  finalStats: {\n    totalXP: player.xp,\n    finalLevel: player.level,\n    achievements: player.achievements.length,\n    finalScore: finalScore,\n    inventory: player.inventory\n  },\n  message: isSuccess ? \n    `🎉 VICTORY! You've become the ultimate Automation Master with ${finalScore} points!` :\n    \"⚔️ The boss was too powerful! Train more and try again!\"\n};\n\nreturn [{\n  json: {\n    ...bossResult,\n    player,\n    gameComplete: isSuccess,\n    playAgain: \"Click 'Start Game' to play again!\"\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "858b4392-6eb0-4e2d-a5a5-bcdc31f38fa8",
      "name": "🎊 Spielende-Bildschirm",
      "type": "n8n-nodes-base.code",
      "position": [
        1500,
        280
      ],
      "parameters": {
        "jsCode": "// 🎊 Game Over Screen\n// Display final results and achievements\n\nconst gameData = items[0].json;\nconst player = gameData.player;\n\n// Create achievement showcase\nconst achievementShowcase = {\n  playerName: player.name,\n  finalTitle: player.title || \"n8n Apprentice\",\n  totalXP: player.xp,\n  finalLevel: player.level,\n  achievements: player.achievements,\n  inventory: player.inventory,\n  gameComplete: gameData.gameComplete\n};\n\n// Generate performance report\nconst performanceReport = {\n  levelsCompleted: player.achievements.length,\n  totalChallenges: 3,\n  completionRate: Math.round((player.achievements.length / 3) * 100),\n  skillsLearned: [\n    \"Data Deduplication\",\n    \"API Response Transformation\",\n    \"Workflow Automation\",\n    \"Error Handling\",\n    \"JavaScript Array Methods\",\n    \"n8n Code Node Mastery\"\n  ],\n  nextSteps: [\n    \"Explore advanced n8n nodes\",\n    \"Build real-world automations\",\n    \"Learn webhook integrations\",\n    \"Master database operations\",\n    \"Implement error handling patterns\"\n  ]\n};\n\n// Create motivational message based on performance\nlet motivationalMessage = \"\";\nif (gameData.gameComplete) {\n  motivationalMessage = `🌟 Congratulations! You've mastered the art of automation and proven yourself worthy of the title '${player.title}'. Your journey in n8n has just begun!`;\n} else {\n  motivationalMessage = `🎯 Great effort! You've learned valuable skills and earned ${player.xp} XP. Keep practicing to become the ultimate Automation Master!`;\n}\n\n// Special rewards based on performance\nconst specialRewards = [];\nif (player.xp >= 800) specialRewards.push(\"🏆 Perfect Score Bonus\");\nif (player.achievements.includes(\"Data Warrior\")) specialRewards.push(\"🛡️ Data Protection Expert\");\nif (player.achievements.includes(\"API Ninja\")) specialRewards.push(\"⚡ Speed Optimization Master\");\nif (player.achievements.includes(\"Automation Master\")) specialRewards.push(\"🎖️ Workflow Architect\");\n\n// Create final game summary\nconst gameSummary = {\n  title: \"🎮 Code Challenge Adventure - Game Over!\",\n  subtitle: `Final Score: ${gameData.finalStats ? gameData.finalStats.finalScore : player.xp} Points`,\n  achievementShowcase,\n  performanceReport,\n  specialRewards,\n  motivationalMessage,\n  coachingOffer: {\n    message: \"Want to level up your n8n skills in real life?\",\n    coaching: \"👉 Book a coaching session: david@daexai.com\",\n    consulting: \"📩 Get custom automation help: david@daexai.com\"\n  },\n  playAgain: \"🔄 Ready for another adventure? Click 'Start Game' to play again!\"\n};\n\nreturn [{\n  json: gameSummary\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "4d626c17-abaf-40e1-bebb-37e9f0861515",
      "name": "Spielmerkmale",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        -220
      ],
      "parameters": {
        "width": 460,
        "height": 540,
        "content": "## Game Features\n\n**🎯 3 Challenging Levels**\n- Progressive difficulty\n- Real n8n scenarios\n- Practical coding challenges\n\n**🏆 Reward System**\n- XP and level progression\n- Power-ups and achievements\n- Performance tracking\n\n**📚 Learning Outcomes**\n- Data deduplication\n- API transformation\n- Error handling\n- Workflow design\n\n**🎪 Fun Elements**\n- RPG-style progression\n- Story-driven challenges\n- Achievement badges\n- Leaderboard scoring"
      },
      "typeVersion": 1
    },
    {
      "id": "7cba2d2f-3838-4a9f-abd0-7e4cd0686f32",
      "name": "Spiel initialisieren",
      "type": "n8n-nodes-base.code",
      "position": [
        460,
        280
      ],
      "parameters": {
        "jsCode": "// 🎮 Game Initialization\n// Create player profile and game state\n\nconst player = {\n  name: \"n8n Apprentice\",\n  level: 1,\n  xp: 0,\n  health: 100,\n  inventory: [],\n  achievements: []\n};\n\nconst gameState = {\n  currentLevel: 1,\n  totalLevels: 3,\n  startTime: new Date().toISOString(),\n  challenges: [\n    {\n      id: 1,\n      name: \"Data Warrior Challenge\",\n      description: \"Deduplicate the corrupted database\",\n      difficulty: \"Beginner\",\n      xpReward: 100,\n      powerUp: \"Data Shield 🛡️\"\n    },\n    {\n      id: 2,\n      name: \"API Ninja Challenge\",\n      description: \"Transform and validate API responses\",\n      difficulty: \"Intermediate\",\n      xpReward: 200,\n      powerUp: \"Speed Boost ⚡\"\n    },\n    {\n      id: 3,\n      name: \"Automation Master Boss\",\n      description: \"Build a complete workflow system\",\n      difficulty: \"Expert\",\n      xpReward: 500,\n      powerUp: \"Master Badge 🏅\"\n    }\n  ]\n};\n\n// Game introduction\nconst gameIntro = {\n  title: \"🎮 Welcome to Code Challenge Adventure!\",\n  story: \"The n8n kingdom is under attack by chaotic data! As a brave code warrior, you must complete challenges to restore order and become the ultimate Automation Master!\",\n  objective: \"Complete all 3 levels to save the kingdom!\"\n};\n\nreturn [{\n  json: {\n    ...gameIntro,\n    player,\n    gameState,\n    message: \"Game initialized! Ready to start your adventure?\"\n  }\n}];"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f08679b5-b4f7-4de2-ade4-aabf10ad6fe6",
  "connections": {
    "7cba2d2f-3838-4a9f-abd0-7e4cd0686f32": {
      "main": [
        [
          {
            "node": "00297d14-9d74-4a5e-a48c-3c2795aeda6a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ff379455-2bfc-4b10-86d3-34e6061e8e75": {
      "main": [
        [
          {
            "node": "7cba2d2f-3838-4a9f-abd0-7e4cd0686f32",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "98162e1a-8f3e-418d-b1d5-e1b03f518e1d": {
      "main": [
        [
          {
            "node": "3042b31c-2dec-45d3-8bdb-7487d8f22eaf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "00297d14-9d74-4a5e-a48c-3c2795aeda6a": {
      "main": [
        [
          {
            "node": "98162e1a-8f3e-418d-b1d5-e1b03f518e1d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3042b31c-2dec-45d3-8bdb-7487d8f22eaf": {
      "main": [
        [
          {
            "node": "858b4392-6eb0-4e2d-a5a5-bcdc31f38fa8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Engineering

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes11
Kategorie1
Node-Typen3
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
David Olusola

David Olusola

@dae221

I 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

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34