Overview
This node enables sending various types of messages and performing actions within Discord channels using a bot. It supports sending plain text messages, rich embedded messages, interactive prompts with buttons or dropdown selects, and executing specific actions like removing messages or managing user roles. The node is useful for automating communication and moderation tasks in Discord servers, such as posting announcements, collecting user input via interactive components, or managing user permissions programmatically.
Practical examples include:
- Sending an announcement message with rich embed formatting to a specific channel.
- Prompting users with buttons or select menus to gather responses interactively.
- Automatically assigning or removing roles from users based on workflow logic.
- Cleaning up recent messages in a channel by bulk deleting them.
Properties
Name | Meaning |
---|---|
Replace the trigger placeholder | If enabled, the message sent will replace a previously set placeholder message (from a Discord Trigger node or another Discord Send node). |
Send to the trigger channel | If enabled, sends the message to the same channel where the workflow was triggered, without replacing any placeholder. |
Send to | Selects the target text channel to send the message or perform the action. Requires valid credentials and bot presence in the server. |
Type | Defines the interaction type: Message (plain or embed), Button Prompt, Select Prompt, Action (perform role/message removal), or None (clear placeholder or update bot status). |
Action | When Type is "Action", choose the specific action: Remove messages, Add role to user, or Remove role from user. |
User ID | The Discord user ID to add or remove roles from (required for role management actions). |
Which roles | Roles to add or remove from the specified user (required for role management actions). |
How many? | Number of last messages to remove when performing message removal action (max 150, only messages less than 4 weeks old). |
Content | Text content of the message or prompt. Required for button/select prompts. |
Embed | Enables creation of rich embedded messages with additional fields like title, description, images, etc. |
Color | Color accent for the embed message. |
Title | Title text for the embed. |
URL | URL associated with the embed title. |
Author name | Name displayed as the author of the embed. |
Author icon URL or base64 | Image URL or base64 string for the author's icon in the embed. |
Author URL | URL linked to the author name in the embed. |
Description | Description text inside the embed. |
Thumbnail URL or base64 | Thumbnail image URL or base64 string for the embed. |
Fields | Custom fields inside the embed, each with a title, value, and optional inline display. |
Image URL or base64 | Main image URL or base64 string displayed in the embed. |
Buttons | Up to 5 buttons for button prompts, each with label, return value, and style (Primary, Secondary, Success, Danger). |
Select | Options for select prompts, each with label, optional description, and return value. |
Persistent | For button/select prompts, keeps the interactive component visible after workflow completion. |
Min select | Minimum number of options that must be selected in a persistent select prompt. |
Max select | Maximum number of options selectable in a persistent select prompt. |
Message ID | ID of the message to update when persistent is enabled; if empty, sends a new message. |
Footer text | Footer text for embed messages. |
Footer icon URL or base64 | Image URL or base64 string for the footer icon in embeds. |
Displayed date | Timestamp to show in the embed footer. |
Timeout | Time in seconds the workflow waits for a button/select response before continuing or stopping execution. Zero means wait indefinitely. |
Restrict to triggering user | Limits interaction to the user who triggered the workflow (for button/select prompts). |
Restrict to mentioned roles | Limits interaction to users having one of the specified roles (for button/select prompts). |
Files | Attach up to 5 images (png, jpg) to the message by URL or base64. |
Mention roles | Roles to mention in the message. |
Placeholder | Placeholder text shown while waiting for a button/select response, with animated dots indicating workflow running. |
Bot customization | Enables customizing the bot's activity and status. |
Bot activity | Text describing the bot's current activity (e.g., "Playing X"). |
Bot activity type | Type of bot activity: Playing, Streaming, Listening, Watching. |
Bot status | Bot's online status: Online, Idle, Do not disturb, Invisible. |
Audit Log Reason | Reason logged in Discord audit logs for performed actions. |
Output
The node outputs JSON objects containing information about the result of the sent message or performed action. The output JSON includes:
value
: The main returned value or response from Discord.channelId
: The ID of the channel where the message or action occurred.userId
: The ID of the user involved (e.g., for role changes or interactions).userName
: Username of the interacting user.userTag
: Full Discord tag of the user.messageId
: ID of the message sent or updated.action
: The action performed (if applicable).
If the node sends interactive prompts (buttons or selects), it waits for user interaction and returns the user's response accordingly.
Binary data output is not explicitly handled by this node; attachments are sent as URLs or base64 strings but not output as binary data.
Dependencies
- Requires a valid Discord bot API key credential configured in n8n.
- The bot must be invited and active in the target Discord server with appropriate permissions to send messages, manage roles, and delete messages.
- The node uses Discord API v10 endpoints.
- Requires network access to Discord API.
- The node depends on internal helper functions for fetching channels and roles dynamically.
Troubleshooting
- Invalid Credentials: If the provided API key is invalid or lacks permissions, the node will throw connection errors. Verify the bot token and ensure the bot has necessary permissions in the server.
- Channel or Role Not Found: If the selected channel or role does not exist or the bot cannot access it, loading options may fail or actions may error out. Ensure the bot is present in the server and has access.
- Message Removal Limitations: Discord API restricts bulk deletion to messages younger than 2 weeks and a maximum of 150 messages at once. Attempting to delete older messages or more than allowed will cause errors.
- Timeout Handling: For button/select prompts, if timeout is set to zero, the workflow waits indefinitely. Setting a reasonable timeout prevents hanging executions.
- Placeholder Replacement Conflicts: Using "Replace the trigger placeholder" requires a placeholder to exist; otherwise, the replacement will not occur.
- Role Management Errors: Adding/removing roles requires correct user IDs and role IDs. Invalid IDs or insufficient permissions will cause failures.
- API Rate Limits: Excessive requests may hit Discord rate limits, causing temporary failures. Implement retry logic or reduce request frequency.