Overview
This node triggers workflows based on various Discord events. It listens to specific types of events occurring in a Discord server, such as messages sent in text channels, commands issued by users, user interactions with buttons or selects, and user presence or role changes. This node is useful for automating responses or actions in Discord communities, such as moderating chats, responding to commands, tracking user activity, or integrating Discord events with other systems.
Practical examples:
- Trigger a workflow when a user sends a message starting with a certain keyword.
- Execute an action when a specific slash command is used.
- Respond to button clicks or select menu interactions in Discord messages.
- Track when users join or leave the server.
- Monitor changes in user presence status (online, offline, idle, etc.).
- React to role assignments or removals for users.
Properties
| Name | Meaning |
|---|---|
| Listen to | Select one or more text channels to listen to for triggering the workflow. If none selected, all channels are listened to. Requires valid credentials and a running bot with access to at least one text channel. |
| From roles | Filter events by user roles. If no roles are selected, it listens to everyone (@everyone). Only applicable for certain event types like messages, commands, user leaves, presence updates, role changes, and interactions. |
| Trigger type | The type of Discord event to listen for. Options include: Message, Command, Interaction, User joins, User leaves, User presence update, User role added, User role removed. |
| Which roles | For role added/removed events, specify which roles to listen for. Defaults to listening to everyone if none selected. |
| Presence | For presence update events, specify which presence state changes to listen for: any change, online, offline, do not disturb, or idle. |
| Pattern | For message events, how to match the message content against the specified value: equals, starts with, contains, ends with, or regex. The message is tested after removing mentions and trimming whitespace. |
| Value | The string value to test messages against according to the selected pattern. Required for message trigger type. |
| Name | The name of the command to listen for. Must be alphanumeric. Required for command trigger type. |
| Description | Description of the command. Required for command trigger type. |
| Input field type | Type of input field for the command: None, Text, Number, Integer, Boolean. Required for command trigger type. |
| Input field description | Description of the command's input field. Required if input field type is not None. |
| Input field required | Whether the command's input field is required. Optional boolean. |
| Case Sensitive | For message triggers, whether matching the value should be case sensitive. Default is false. |
| Bot Mention | For message triggers, whether the message must mention the bot to trigger the workflow. Does not exclude other criteria. |
| Message ID | For interaction triggers, the ID of the message containing the button or select menu to listen to. Required for interaction trigger type. |
| Placeholder | A placeholder message shown in the channel that triggered the workflow, indicating the workflow is running. Can be replaced by a response message from a Discord Send node. |
Output
The node outputs a JSON object representing the Discord event data that triggered the workflow. The output fields may include:
content: The message content (for message events).channelId: The ID of the channel where the event occurred.userId: The ID of the user involved in the event.userName: The username of the user.userTag: The user's tag (username#discriminator).messageId: The ID of the message (if applicable).presence: The user's presence status (for presence update events).addedRoles: Roles added to the user (for role added events).removedRoles: Roles removed from the user (for role removed events).interactionMessageId: The message ID related to the interaction (for interaction events).interactionValues: Values selected or submitted in the interaction.userRoles: The roles of the user.attachments: Any attachments included in the message.
If binary data were supported, it would be summarized here, but this node only outputs JSON data.
Dependencies
- Requires a valid Discord API credential with appropriate permissions.
- Requires a running Discord bot connected to the server.
- The bot must have access to the channels and events being listened to.
- The node uses an internal IPC mechanism to communicate with the bot process.
- The node depends on helper functions to load available channels and roles dynamically.
Troubleshooting
- No channels listed: Ensure your credentials are set correctly, the bot is running, and you have at least one accessible text channel. After fixing, close and reopen the modal to reload channels.
- Commands not showing up in Discord: Make sure the trigger is active and restart your Discord client.
- Workflow not triggering: Verify the selected channels, roles, and event types match the actual events happening in Discord.
- Permission errors: Confirm the bot has sufficient permissions to read messages, receive events, and interact in the specified channels.
- Regex pattern issues: When using regex patterns, ensure they are valid ECMAScript regular expressions.
- Bot mention requirement: If enabled, messages must mention the bot explicitly to trigger the workflow.