AutomationFlowsSlack & Telegram › Discord Setup Guidelines - Get All Channels & Categories of a Discord Server

Discord Setup Guidelines - Get All Channels & Categories of a Discord Server

Original n8n title: Discord Setup Guidelines 📜 - Get All Channels & Categories of a Discord Server

ByEoCi - Mr.Eo @eocimreo on n8n.io

Trying to connect n8n to your Discord server but not sure where to start? 🤔 Setting up a Discord Bot and its credentials can be confusing. This workflow provides the perfect starting point, guiding you through the connection and running a test to fetch all channels from your…

Event trigger★★★★☆ complexity22 nodesDiscordExecute Workflow Trigger
Slack & Telegram Trigger: Event Nodes: 22 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #10198 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "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": "## \ud83c\udfaf **Goal: Test Your Discord Connection**\nThis workflow demonstrates advanced Discord bot capabilities:\n\u2713 Fetch ALL channels from your Discord server at once\n\u2713 Automatically separate text channels from categories\n\u2713 Merge channel data with category metadata\n\u2713 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": "## \ud83d\udca1 **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": "## \ud83c\udf1f 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": "## \u2699\ufe0f Workflow Configuration\n### Get Server ID:\n  \u2022 Enable Developer Mode: Discord Settings \u2192 Advanced \u2192 \u2611 Developer Mode\n  \u2022 Right-click your server icon \u2192 Copy Server ID\n  \u2022 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  \u2022 Credential: Select \"Testing\" (or your credential name)\n  \u2022 Guild ID: Uses ={{ $json.server_id }} (from previous node)\n  \u2022 Limit: 20 (increase if you have more than 20 channels)\n  \u2022 Returns ALL channel types: Text, Voice, Categories, Forums\n### Understanding the Flow:\n  \ud83d\udccc \"Separate Category & Channel\" checks parent_id:\n     \u2022 Has parent_id = Text Channel \u2192 Goes to \"Get Channels\"\n     \u2022 No parent_id = Category \u2192 Goes to \"Get Server's Categories\"\n\n  \ud83d\udccc \"Merge\" combines both paths:\n     \u2022 Matches channels to their parent categories\n     \u2022 Creates complete channel + category metadata\n     \u2022 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 \u2192 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": "## \ud83e\udd14 Troubleshooting Guide\n### Error 401 (Invalid Token):\n  Problem: Your Bot Token in n8n is wrong\n  \u2713 Fix: Reset token in Discord Developer Portal \u2192 Bot \u2192 Reset Token\n  \u2713 Update your n8n credential with new token\n### Error 403 (Missing Access):\n  Problem: Bot doesn't have View Channels permission\n  \u2713 Fix: Server Settings \u2192 Roles \u2192 Enable \"View Channels\" for bot role\n  \u2713 Check channel-specific permissions if needed\n### Error 404 (Not Found):\n  Problem: Server (ID) is incorrect\n  \u2713 Fix: Double-check Server (ID) in \"Set - Server ID\" node\n  \u2713 Enable Developer Mode: Settings > Advanced > Developer Mode\n  \u2713 Right-click server \u2192 Copy Server ID\n### Empty Results from \"Get channels list\":\n  Problem: Bot not in server or no channels visible\n  \u2713 Fix: Verify bot is invited to the server\n  \u2713 Check bot can see at least one channel\n  \u2713 Ensure limit is set high enough (default: 20)\n### Merge Node Returns No Data:\n  Problem: category_id mismatch between branches\n  \u2713 Fix: Check \"Get Channels\" has parent_id \u2192 category_id\n  \u2713 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 \u2192 Applications\n  2. Click \"New Application\" \u2192 Name your bot\n  3. Navigate to \"Bot\" tab \u2192 Click \"Add Bot\"\n  4. Under Token section \u2192 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 \u2192 URL Generator\n  2. Scopes section: \u2611 bot\n  3. Bot Permissions: \n     \u2611 View Channels (required for v1.2)\n     \u2611 Read Message History (for future extensions)\n     \u2611 Send Messages (if you add messaging later)\n  4. Copy the generated URL\n  5. Paste in browser \u2192 Select your server \u2192 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) \u2192 Create New\n  2. Search for \"Discord Bot API\" \u2192 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\" \u2192 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
      ],
      "parameters": {
        "limit": 20,
        "guildId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.server_id}}"
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "discordBotApi": {
          "name": "<your 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 \u2018Execute workflow\u2019",
      "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": "## \ud83d\ude4f 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- \ud83d\udca1 Suggestions for improvement\n- \ud83c\udd95 Ideas for new features  \n- \ud83d\udcdd Requests for other automation workflows\n#### Please share your thoughts! Every idea helps shape the next update.\n### \ud83d\ude4b\u200d\u2642\ufe0f Join & Follow For More Free Templates!\n- #### Discord Community: We Work Together\n\u2192 https://discord.gg/sEHaKcqBWY\nGet help, share builds, collaborate!\n- #### Facebook Fanpage: Automation Together\n\u2192 facebook.com/profile.php?id=61581574203648\n  Daily tips, tutorials, and updates\n- #### Youtube Channel: Automation Together\n\u2192 youtube.com/@AutomationTogether\nVideo guides for all templates\n### Thank you again for being part of this journey! \ud83d\ude80\n### Together, we automate better! \ud83e\udd16\u2728"
      },
      "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  \u2022 Update \"Set - Server ID\" node with different server\n  \u2022 Bot must be invited to that server first\n  \u2022 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  \u26a0\ufe0f Known Issue: \"channe_id\" has typo (missing 'l')\n     \u2022 Keep it for compatibility with existing workflows\n     \u2022 Or fix: Change in \"Get Channels\" node to \"channel_id\"\n  \n  \ud83d\udca1 The parent_id logic is clever:\n     \u2022 Categories have no parent (they ARE parents)\n     \u2022 Text channels reference their category as parent\n     \u2022 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  \ud83d\udcac Send Messages to All Channels:\n     \u2022 Add \"Split In Batches\" after Merge\n     \u2022 Add \"Discord: Send message\" inside loop\n     \u2022 Use ={{ $json.channe_id }} (note the typo!)\n  \n  \ud83d\udcca Export to Spreadsheet:\n     \u2022 Add \"Google Sheets\" or \"Excel\" node\n     \u2022 Map fields: channel_name, category_name, etc.\n     \u2022 Great for server documentation\n  \n  \ud83d\udd0d Fetch Last Messages:\n     \u2022 Add IF node: Check last_message_id not empty\n     \u2022 Add \"Discord: Get message\" node\n     \u2022 Use ={{ $json.last_message_id }}\n  \n  \ud83c\udfaf Category-Based Actions:\n     \u2022 Add Switch node based on category_name\n     \u2022 Route to different actions per category\n     \u2022 Example: Announcements \u2192 Log, Support \u2192 Alert"
      },
      "typeVersion": 1
    }
  ],
  "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 \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set - Server ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Trying to connect n8n to your Discord server but not sure where to start? 🤔 Setting up a Discord Bot and its credentials can be confusing. This workflow provides the perfect starting point, guiding you through the connection and running a test to fetch all channels from your…

Source: https://n8n.io/workflows/10198/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

Unlock low-cost, high-control generative media workflows directly from n8n by integrating with ComfyUI. Ideal for indie creators, AI developers, or small teams seeking scalable media automation—from i

Execute Workflow Trigger, HTTP Request, Read Write File +2
Slack & Telegram

This workflow will backup all of your existed workflows to a single Github repository.

Execute Workflow Trigger, n8n, GitHub +1
Slack & Telegram

Uses the rentcast.io api to get approximate value of real estate. Updates the asset in YNAB. Get Rentcast.io api key Get YNAB API Key Get YNAB and

HTTP Request, Crypto, Execute Workflow Trigger +1
Slack & Telegram

Absen Otomatis. Uses discord, ssh, executeWorkflowTrigger, scheduleTrigger. Event-driven trigger; 13 nodes.

Discord, Ssh, Execute Workflow Trigger
Slack & Telegram

Handle_Todo_Status. Uses executeWorkflowTrigger, discord. Event-driven trigger; 2 nodes.

Execute Workflow Trigger, Discord