DEV Community

Pirate Prentice
Pirate Prentice

Posted on

n8n Discord Node: Send Messages, Manage Members, and Build Bot Workflows [Free Workflow JSON]

Discord has grown far beyond gaming — it's now the default community platform for developer tools, SaaS products, open source projects, and creator communities. n8n's Discord node lets you send messages, manage channels, react to events, and build moderation bots without writing a full-time bot process. This guide covers every operation, the gotchas, and three workflow patterns ready to import.


What the Discord Node Does

The n8n Discord node supports two authentication modes and several resource types:

Resource Operations
Message Send, Delete, Get, Get All, React with Emoji, Remove Reaction
Channel Create, Delete, Get, Get All, Update
Member Get, Get All, Role Add, Role Remove
Webhook Execute (send message via webhook URL)

Two auth modes:

  • Bot Token (recommended) — full API access; requires creating a Discord App and Bot
  • Webhook — simpler, send-only; no bot needed, just a webhook URL from channel settings

Setting Up the Credential

Bot Token (Full Access)

  1. Go to discord.com/developers/applicationsNew Application
  2. Name your app (e.g. "n8n Bot") → go to Bot tab → Add Bot
  3. Copy the Token (keep it secret)
  4. Under Privileged Gateway Intents, enable Server Members Intent and Message Content Intent if your workflows read messages
  5. Invite the bot to your server: OAuth2 → URL Generator, select scopes bot + applications.commands, select permissions (at minimum: Send Messages, Read Message History, Manage Roles if needed), copy and visit the generated URL
  6. In n8n, add a Discord Bot credential and paste the token + your Bot ID (from the General Information tab)

Webhook (Send-Only, Simpler)

  1. In Discord, right-click a channel → Edit Channel → Integrations → Webhooks → New Webhook
  2. Name it, copy the webhook URL
  3. In n8n, use the Discord credential → Webhook type and paste the URL
  4. Use the Execute Webhook operation to send messages

Key Operations

Send Message

{
  "channelId": "1234567890",
  "content": "Deployment complete: v2.4.1 shipped to production at {{$now.toISO()}}",
  "embeds": [
    {
      "title": "Deploy Summary",
      "color": 3066993,
      "fields": [
        {"name": "Version", "value": "v2.4.1", "inline": true},
        {"name": "Duration", "value": "2m 14s", "inline": true}
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Embeds support title, description, color (decimal integer), fields (array), footer, thumbnail, and image.

React with Emoji

Adds an emoji reaction to a message. Useful for bot-driven poll tracking or acknowledgement workflows:

{
  "channelId": "1234567890",
  "messageId": "9876543210",
  "emoji": "✅"
}
Enter fullscreen mode Exit fullscreen mode

For custom server emojis use the format emojiName:emojiId.

Member Role Management

Add or remove roles from server members — useful for automating access control when a user purchases, subscribes, or completes onboarding:

{
  "guildId": "1122334455",
  "userId": "9988776655",
  "roleId": "5544332211"
}
Enter fullscreen mode Exit fullscreen mode

6 Gotchas

  1. Channel IDs and Guild IDs are not the same as names. Right-click any channel in Discord → Copy Channel ID (requires Developer Mode: Settings → Advanced → Developer Mode). Same for server (guild) and message IDs.

  2. Message Content Intent required for reading messages. If your workflow involves reading message content (not just sending), the bot needs the Message Content Intent enabled in the Developer Portal. Without it, message.content returns an empty string for messages not directed at the bot.

  3. sendLegacy operation can cause "[item 0]" errors. If you see [item 0] in the message content, it usually means you passed an n8n expression like {{ $json.message }} but the field was empty or undefined. Always add a null check before sending.

  4. Rate limits are per-channel. Discord rate-limits message sends per channel (roughly 5 messages/5 seconds for bots). For bulk announcements to multiple channels, add a Wait node (1 second) between sends to avoid 429 errors.

  5. Bot must have the right permissions in the channel. Even if the bot is invited with broad permissions, individual channels can override them with permission overwrites. If a message send returns 403 Missing Permissions, check the specific channel's permission settings for the bot's role.

  6. Embeds don't work with webhooks in the same way. Webhook-based sends support embeds, but the embed format is slightly different (passed as an array). Bot-based sends use the node's built-in embed fields. If you're switching between modes, test embed rendering separately.


3 Workflow Patterns

Pattern 1: Stripe Payment → Discord Role Grant + Welcome Message

When a customer purchases, give them a paid-member Discord role and send them a welcome DM.

Trigger: Webhook Trigger (payment_intent.succeeded from Stripe)
Steps:

  1. Parse customer.email and metadata.discord_user_id (store Discord ID in Stripe customer metadata at checkout)
  2. Discord node → Member Role Add: grant paid-member role to the Discord user ID
  3. Discord node → Send Message (in #welcome channel): "@{username} just joined as a paid member! 🎉"
  4. (Optional) HTTP Request → Discord DM: send a direct message with onboarding links

Note: This requires collecting the Discord user ID at checkout. Add a custom field in your Stripe Payment Link or checkout form: "Discord username (optional)".


Pattern 2: GitHub Action → Discord Deploy Alert

Post structured deploy notifications to a Discord #deployments channel every time CI/CD completes.

Trigger: Webhook Trigger (GitHub Actions workflow_run event, conclusion = success or failure)
Steps:

  1. Code node — determine embed color: 3066993 (green) for success, 15158332 (red) for failure
  2. Discord node → Send Message with embed:
    • Title: "Deploy {status}: {repo_name} {tag}"
    • Color: from step 1
    • Fields: Branch, Commit SHA, Author, Duration
    • Footer: "Triggered by GitHub Actions"
  3. IF node (failure only) → Discord node → Send Message in #incidents: "@here Deploy failed for {repo_name}"

Pattern 3: Daily Community Digest

Post a daily summary of the past 24 hours of activity in a Discord server — top threads, new members, pinned announcements.

Trigger: Schedule Trigger — every day at 9 AM
Steps:

  1. Discord node → Get All Messages from #announcements channel, since yesterday
  2. Discord node → Get All Members who joined in the past 24 hours (filter by joined_at)
  3. Code node — format digest: list announcement titles, count new members
  4. Discord node → Send Message in #daily-digest:
   **Daily Digest — July 14**
   📢 3 new announcements
   👋 12 new members joined
Enter fullscreen mode Exit fullscreen mode

Related Articles


Free Resource

Free: n8n Integration Checklist — 10-point checklist to audit any n8n integration before you ship it to production. Covers auth, error handling, rate limits, data validation, and monitoring. → Get it free here


Footer

Discord + n8n is the fastest way to build event-driven community automation without running a persistent bot process. Deploy alerts, member management, and daily digests all run on demand from n8n's workflow engine.

Need this built for your community? I offer a done-for-you n8n workflow build — you describe what you need, I build and test it, you import and run it. $99 flat. → Book here

Or grab the n8n Workflow Pack (30+ pre-built automations): → pirateprentice.gumroad.com/l/sxcoe ($29)

Top comments (1)

Collapse
 
pirateprentice profile image
Pirate Prentice

Are you using the n8n Discord node to send deploy alerts, manage community roles, or post daily digests? Drop your pattern in the comments — always curious what automation setups people are running in their Discord servers.