Discord Trigger
AI-generatedOverview
This node acts as a Discord event trigger within n8n workflows. It listens for various Discord events such as messages, direct messages, reaction additions/removals, role changes, and user join/leave events on specified servers, channels, or roles. When the specified event occurs, the node emits the event data to trigger subsequent workflow actions. This is useful for automating responses or actions based on Discord server activity, such as moderating content, logging events, or interacting with users.
Use Case Examples
- Trigger a workflow when a user sends a direct message to the bot.
- Trigger a workflow when a reaction is added to a message in a specific channel.
- Trigger a workflow when a new role is created on the server.
Properties
| Name | Meaning |
|---|---|
| Trigger Type | Specifies the type of Discord event to listen for, such as messages, reactions, role changes, or user join/leave events. |
| Server Names or IDs | Specifies one or more Discord servers (guilds) to listen to for events. |
| Listen To Categories | Filters channels by selected categories to monitor only those channels for events. |
| Listen To Channels | Specifies which text channels to listen to for triggering the workflow. |
| Listen to Roles | Filters events by roles; if none selected, listens to @everyone. |
| Listen to Message | For reaction events, restricts triggers to specific message IDs. |
| Pattern | Defines how the message content is matched to trigger the event (e.g., starts with, contains, regex). |
| Value | The string or pattern value to match against messages for triggering. |
| Case Sensitive | Determines if the message matching is case sensitive. |
| Trigger Only on Message Replies | Triggers only if the message is a reply to another message. |
| Message ID | For interaction events, specifies the message ID of the button or select to listen to. |
| Additional Fields | Optional settings such as triggering on other bots' messages, requiring attachments, debounce time to prevent spam, and cooldown time between triggers. |
Output
JSON
id- ID of the Discord message or event.content- Content of the message.guildId- ID of the Discord server (guild) where the event occurred.channelId- ID of the channel where the event occurred.authorId- ID of the user who triggered the event.authorName- Username of the user who triggered the event.timestamp- Timestamp when the event occurred.listenValue- The value used for matching the message content.authorIsBot- Boolean indicating if the author is a bot or system user.memberRoles- List of roles the member has.referenceId- ID of the referenced message if the event is a reply.referenceContent- Content of the referenced message.referenceAuthorId- ID of the author of the referenced message.referenceAuthorName- Username of the author of the referenced message.referenceTimestamp- Timestamp of the referenced message.attachments- Attachments included in the message, if any.
Dependencies
- An API key credential for Discord bot authentication is required.
Troubleshooting
- Ensure the Discord bot token is correctly configured in the credentials; missing or invalid tokens will prevent connection.
- Make sure the bot has the necessary permissions on the selected servers, channels, and roles to listen to events.
- If no servers are selected when choosing channels, roles, or categories, the node will throw an error prompting to select at least one server.
- The bot must be running and connected to Discord for the trigger to work; check logs for connection errors.
- When using message pattern matching, ensure the pattern and value are correctly set to avoid missed triggers.
- Cooldown and debounce settings should be configured carefully to avoid unintended delays or missed events.
Links
- Discord Developer Documentation - Official Discord API documentation for understanding events and bot interactions.
- n8n Discord Trigger Node Documentation - Official documentation for configuring and using the Discord Trigger node in n8n.