{
  "meta": {
    "instanceId": "cd9bb7894b11bab249a60976239056d06e4831b51d7348f6790a85241c21fc56",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2cf75639-0528-49cc-85f5-37f0b5e27596",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 512,
        "height": 272,
        "content": "## 🎯 **Goal: Test Your Discord Connection**\nThis workflow demonstrates advanced Discord bot capabilities:\n✓ Fetch ALL channels from your Discord server at once\n✓ Automatically separate text channels from categories\n✓ Merge channel data with category metadata\n✓ Prepare structured data for bulk operations\n\nPerfect for: Building multi-channel bots, server management automation, \nand advanced Discord integrations.\n\nWhat you'll learn: Channel enumeration, conditional logic, data merging, \nand preparing for bulk message operations."
      },
      "typeVersion": 1
    },
    {
      "id": "7cd1a882-fa13-4636-8a32-e21a4bd76989",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        400
      ],
      "parameters": {
        "color": 7,
        "width": 960,
        "height": 432,
        "content": "## 💡 **Setup: Get Discord Credentials**\n\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5257df00-7033-46a6-9444-0b8858658548",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -384
      ],
      "parameters": {
        "width": 928,
        "height": 528,
        "content": "## 🌟 Customization Guide.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d9164460-ea58-4030-ac85-b3fc7b22ed2a",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 672,
        "content": "## ⚙️ Workflow Configuration\n### Get Server ID:\n  • Enable Developer Mode: Discord Settings → Advanced → ☑ Developer Mode\n  • Right-click your server icon → Copy Server ID\n  • Example format: 012345678911121314(18-19 digit number)\n### Configure \"Set - Server ID\" Node:\n  1. Open the \"Set - Server ID\" node\n  2. Replace the server_id value with YOUR server ID\n  3. Keep the field name as \"server_id\" (used by next node)\n### Configure \"Get channels list\" Node:\n  • Credential: Select \"Testing\" (or your credential name)\n  • Guild ID: Uses ={{ $json.server_id }} (from previous node)\n  • Limit: 20 (increase if you have more than 20 channels)\n  • Returns ALL channel types: Text, Voice, Categories, Forums\n### Understanding the Flow:\n  📌 \"Separate Category & Channel\" checks parent_id:\n     • Has parent_id = Text Channel → Goes to \"Get Channels\"\n     • No parent_id = Category → Goes to \"Get Server's Categories\"\n\n  📌 \"Merge\" combines both paths:\n     • Matches channels to their parent categories\n     • Creates complete channel + category metadata\n     • Output: [{ channel_name, channe_id, category_name, category_id, last_message_id }]\n### Test the Workflow:\n  1. Click \"Execute workflow\" (top-right)\n  2. Check each node for green success checkmarks\n  3. Click \"Merge\" node → View output to see combined data\n  4. You should see channels grouped by category"
      },
      "typeVersion": 1
    },
    {
      "id": "a162b3c2-b458-4cd5-b589-51df7317086f",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -304
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 560,
        "content": "## 🤔 Troubleshooting Guide\n### Error 401 (Invalid Token):\n  Problem: Your Bot Token in n8n is wrong\n  ✓ Fix: Reset token in Discord Developer Portal → Bot → Reset Token\n  ✓ Update your n8n credential with new token\n### Error 403 (Missing Access):\n  Problem: Bot doesn't have View Channels permission\n  ✓ Fix: Server Settings → Roles → Enable \"View Channels\" for bot role\n  ✓ Check channel-specific permissions if needed\n### Error 404 (Not Found):\n  Problem: Server (ID) is incorrect\n  ✓ Fix: Double-check Server (ID) in \"Set - Server ID\" node\n  ✓ Enable Developer Mode: Settings > Advanced > Developer Mode\n  ✓ Right-click server → Copy Server ID\n### Empty Results from \"Get channels list\":\n  Problem: Bot not in server or no channels visible\n  ✓ Fix: Verify bot is invited to the server\n  ✓ Check bot can see at least one channel\n  ✓ Ensure limit is set high enough (default: 20)\n### Merge Node Returns No Data:\n  Problem: category_id mismatch between branches\n  ✓ Fix: Check \"Get Channels\" has parent_id → category_id\n  ✓ Verify \"Get Server's Categories\" has matching category_id"
      },
      "typeVersion": 1
    },
    {
      "id": "b7444a18-f092-41e6-8f28-4a019fe3eef1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        496
      ],
      "parameters": {
        "width": 272,
        "height": 288,
        "content": "### Part 1: Create Bot & Get Token\n  1. Go to Discord Developer Portal → Applications\n  2. Click \"New Application\" → Name your bot\n  3. Navigate to \"Bot\" tab → Click \"Add Bot\"\n  4. Under Token section → Click \"Reset Token\"\n  5. COPY THE TOKEN IMMEDIATELY (you won't see it again!)\n  6. Keep this token secure - treat it like a password"
      },
      "typeVersion": 1
    },
    {
      "id": "7238a674-f1ef-4dba-8890-52742cc308f4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        480
      ],
      "parameters": {
        "width": 288,
        "height": 320,
        "content": "### Part 2: Invite Bot to Your Server\n  1. Go to OAuth2 → URL Generator\n  2. Scopes section: ☑ bot\n  3. Bot Permissions: \n     ☑ View Channels (required for v1.2)\n     ☑ Read Message History (for future extensions)\n     ☑ Send Messages (if you add messaging later)\n  4. Copy the generated URL\n  5. Paste in browser → Select your server → Authorize\n  6. Verify bot appears in member list (may show as offline)"
      },
      "typeVersion": 1
    },
    {
      "id": "8d113480-89c5-465b-9f05-bc8e8eeba211",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        496
      ],
      "parameters": {
        "width": 304,
        "height": 288,
        "content": "### Part 3: Add Credentials to n8n\n  1. In n8n: Click \"Credentials\" (top-right) → Create New\n  2. Search for \"Discord Bot API\" → Select it\n  3. Credential Name: \"Testing\" (or match what's in workflow)\n  4. Bot Token field: Paste the token from Part 1\n  5. Click \"Save\" → Test connection if available\n  6. Use this credential in all Discord nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "947ad189-629a-498f-8e92-ad36a58ef4fd",
      "name": "Set - Server ID",
      "type": "n8n-nodes-base.set",
      "position": [
        192,
        -64
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "faa25e7c-59d3-4477-a029-c72ecc8ac860",
              "name": "server_id",
              "type": "string",
              "value": "={{ $json.server_id || \"Server ID\"}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9d4e20eb-6f49-4106-826d-8188df5762d4",
      "name": "Get Server's Categories",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "60c38119-9db5-4eae-a414-321eddc7634e",
              "name": "category_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "1ae100b1-3e04-4eec-9181-04b274ab73a0",
              "name": "category_name",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "65992ac6-8f49-463d-a5eb-7c6ae91edfd2",
      "name": "Get Channels",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a55e56b6-13f0-469a-b776-e0414822f272",
              "name": "channe_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "ae72b909-2115-471a-bc7d-0e1c2e40b041",
              "name": "channel_name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "7b2bb958-ac46-4993-84a4-18ddfe178f81",
              "name": "category_id",
              "type": "string",
              "value": "={{ $json.parent_id }}"
            },
            {
              "id": "1ab3b201-9817-4815-8653-68776de4529a",
              "name": "last_message_id",
              "type": "string",
              "value": "={{ $json.last_message_id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "16d6cb20-01ff-445c-9141-8fd5b6e534a0",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        752,
        32
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "fieldsToMatchString": "category_id"
      },
      "typeVersion": 3.2
    },
    {
      "id": "5cab8a2c-7c05-4bf9-96a0-e342c33d121f",
      "name": "Separate Category & Channel",
      "type": "n8n-nodes-base.if",
      "position": [
        384,
        32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fda5a320-ba7f-4992-a5f5-6a46b068e260",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{$input.item.json.parent_id}}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dde1d5e6-3ee6-4d68-8e92-05a54ad36f6f",
      "name": "Get channels list",
      "type": "n8n-nodes-base.discord",
      "position": [
        192,
        160
      ],
      "webhookId": "1dffb8cd-24f6-4699-a2cd-b900b400e0cd",
      "parameters": {
        "limit": 20,
        "guildId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.server_id}}"
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "discordBotApi": {
          "id": "credential-id",
          "name": "discordBotApi Credential"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2db98987-f832-4fe9-a472-939e999f0b34",
      "name": "Next Step !",
      "type": "n8n-nodes-base.noOp",
      "position": [
        768,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e8bbcf8e-e95d-4103-9a8f-1faa7988b1df",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -16,
        -64
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "aad42190-9fa4-4d9d-8fad-223e2f2ae766",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        272
      ],
      "parameters": {
        "width": 512,
        "height": 560,
        "content": "## 🙏 Thank You for Trying This Workflow!\nYour time and trust mean a lot! I truly appreciate you using this \nadvanced Discord template.\n### Your feedback shapes future updates:\n- 💡 Suggestions for improvement\n- 🆕 Ideas for new features  \n- 📝 Requests for other automation workflows\n#### Please share your thoughts! Every idea helps shape the next update.\n### 🙋‍♂️ Join & Follow For More Free Templates!\n- #### Discord Community: We Work Together\n→ https://discord.gg/sEHaKcqBWY\nGet help, share builds, collaborate!\n- #### Facebook Fanpage: Automation Together\n→ facebook.com/profile.php?id=61581574203648\n  Daily tips, tutorials, and updates\n- #### Youtube Channel: Automation Together\n→ youtube.com/@AutomationTogether\nVideo guides for all templates\n### Thank you again for being part of this journey! 🚀\n### Together, we automate better! 🤖✨"
      },
      "typeVersion": 1
    },
    {
      "id": "e53db057-8a54-4547-9634-9abaf960ef8c",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -16,
        144
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "server_id"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "47076256-50ff-499e-85a0-2a4075df5479",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -336
      ],
      "parameters": {
        "width": 400,
        "height": 112,
        "content": "### **Change Server ID:**\n  • Update \"Set - Server ID\" node with different server\n  • Bot must be invited to that server first\n  • You can duplicate workflow for multiple servers"
      },
      "typeVersion": 1
    },
    {
      "id": "401028dc-b871-4d42-b75c-9f148a91538c",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -208
      ],
      "parameters": {
        "width": 400,
        "height": 128,
        "content": "### **Advanced: Multi-Server Operations:**\n  1. Replace \"Set - Server ID\" with \"Code\" node\n  2. Create array: [server_id_1, server_id_2, ...]\n  3. Add \"Loop Over Items\" before \"Get channels list\"\n  4. Process multiple servers in one execution"
      },
      "typeVersion": 1
    },
    {
      "id": "806b1acf-1261-4f3f-9727-05aa0267c88b",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -64
      ],
      "parameters": {
        "width": 400,
        "height": 192,
        "content": "### **Pro Tips:**\n  ⚠️ Known Issue: \"channe_id\" has typo (missing 'l')\n     • Keep it for compatibility with existing workflows\n     • Or fix: Change in \"Get Channels\" node to \"channel_id\"\n  \n  💡 The parent_id logic is clever:\n     • Categories have no parent (they ARE parents)\n     • Text channels reference their category as parent\n     • This is Discord's native structure"
      },
      "typeVersion": 1
    },
    {
      "id": "6936190f-3147-4aa8-af8b-cb2fc60f77d3",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        -320
      ],
      "parameters": {
        "width": 400,
        "height": 400,
        "content": "### **Extend \"Next Step !\" Placeholder:**\n  Current workflow stops at data merging. You can add:\n  \n  💬 Send Messages to All Channels:\n     • Add \"Split In Batches\" after Merge\n     • Add \"Discord: Send message\" inside loop\n     • Use ={{ $json.channe_id }} (note the typo!)\n  \n  📊 Export to Spreadsheet:\n     • Add \"Google Sheets\" or \"Excel\" node\n     • Map fields: channel_name, category_name, etc.\n     • Great for server documentation\n  \n  🔍 Fetch Last Messages:\n     • Add IF node: Check last_message_id not empty\n     • Add \"Discord: Get message\" node\n     • Use ={{ $json.last_message_id }}\n  \n  🎯 Category-Based Actions:\n     • Add Switch node based on category_name\n     • Route to different actions per category\n     • Example: Announcements → Log, Support → Alert"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Next Step !",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Next Step !": {
      "main": [
        []
      ]
    },
    "Get Channels": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Server ID": {
      "main": [
        [
          {
            "node": "Get channels list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get channels list": {
      "main": [
        [
          {
            "node": "Separate Category & Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Server's Categories": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Separate Category & Channel": {
      "main": [
        [
          {
            "node": "Get Channels",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Server's Categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Set - Server ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set - Server ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}