Discord Interaction icon

Discord Interaction

Sends messages, embeds and prompts to Discord

Overview

The Discord Interaction node enables sending messages, embeds, and interactive prompts to Discord servers. It supports multiple interaction types including sending plain messages, performing actions like reacting with emojis or managing roles, and requesting user confirmations.

This node is useful for automating Discord server management and communication workflows such as:

  • Sending announcements or updates to specific channels.
  • Moderation tasks like removing recent messages or adjusting user roles.
  • Adding or removing emoji reactions on messages.
  • Prompting users for confirmation before proceeding with an action.

For example, you could use it to automatically send a welcome message with an embed when a new user joins, or to ask for confirmation before deleting messages in a channel.

Properties

Name Meaning
Type Choose the type of interaction:
- Action: Perform an action (e.g., remove messages, add/remove role, react with emoji).
- Message: Send a simple message.
- Confirmation: Ask user to confirm continuation.
Action When Type is "Action", select the specific action:
- Remove Messages
- Add Role to User
- Remove Role from User
- React with Emoji
Server Name or ID Select or specify the Discord server (guild) where the action/message will occur.
Reaction Operation For "React with Emoji" action, choose whether to add or remove the reaction.
Message ID For "React with Emoji" action, specify the ID of the message to react to.
Emoji For "React with Emoji" action, specify the emoji to use (Unicode or custom emoji format).
Channel Name or ID Specify the text channel where the message or action should be sent/performed.
How Many? For "Remove Messages" action, number of last messages to delete (max 100, only messages less than 4 weeks old).
User ID For adding/removing roles, specify the user ID to modify.
Which Role Names or IDs For adding/removing roles, select one or more roles to add or remove from the user.
Content Text content of the message or confirmation prompt. Required if using buttons or select prompts.
Embed Whether to send the message as an embed instead of plain text.
Color Embed color (shown if Embed is true).
Title Embed title.
URL URL linked from the embed title.
Author Name Embed author name.
Author Icon URL or Base64 Image URL or base64 string for the embed author icon (requires Author Name).
Author URL URL linked from the author name (requires Author Name).
Description Embed description text.
Thumbnail URL or Base64 URL or base64 image for embed thumbnail.
Fields Embed fields: multiple entries each with Title, Value, and Inline flag.
Image URL or Base64 URL or base64 image for embed main image.
Footer Text Embed footer text.
Footer Icon URL or Base64 URL or base64 image for embed footer icon (requires Footer Text).
Displayed Date Timestamp shown in the embed.
Files Attach up to 5 images to the message by specifying URLs or base64 strings.
Mention Role Names or IDs Roles to mention/tag in the message.
Additional Fields (Confirm type only) Confirmation-specific options:
- Timeout (seconds) for user response.
- Custom labels for Yes and No buttons.

Output

The node outputs JSON data containing details about the interaction result. The output structure includes:

  • value: The main response or result value from the Discord API or bot.
  • channelId: The ID of the channel where the interaction took place.
  • userId: The ID of the user involved in the interaction (if applicable).
  • userName: The username of the user involved.
  • userTag: The user's tag (username#discriminator).
  • messageId: The ID of the message related to the interaction.
  • action: The action performed (e.g., message sent, reaction added).

If the interaction type is "confirm," the output is split into three outputs representing confirmed, canceled, or no response states.

Binary data output is not indicated; the node primarily deals with JSON structured data.

Dependencies

  • Requires a valid Discord Bot API token credential configured in n8n.
  • Uses a helper module to fetch guilds, channels, and roles dynamically.
  • Relies on a socket connection to a bot process via IPC (Inter-Process Communication) for sending commands and receiving callbacks.
  • The bot must be running and connected for the node to function properly.
  • Requires network access to Discord's API endpoints.

Troubleshooting

  • No guild selected error: When loading channels or roles, if no guild/server is selected, the node throws an error prompting to select at least one server.
  • Bot connection issues: If the bot process is not running or IPC connection fails, interactions will fail. Ensure the bot is active and accessible.
  • Invalid IDs: Using incorrect or non-existent channel, message, user, or role IDs will cause errors or no effect.
  • Message removal limits: Discord API restricts bulk deletion to messages younger than 4 weeks and max 100 messages at once.
  • Missing required parameters: Some actions require mandatory fields (e.g., messageId for emoji reactions, userId for role changes). Omitting these causes errors.
  • Timeouts on confirmation: If the user does not respond within the specified timeout, the confirmation interaction expires and returns a "no response" output.
  • Embed formatting errors: Incorrect embed field values or missing required embed properties may cause the message to fail.

Links and References

Discussion