Discord Trigger icon

Discord Trigger

Trigger based on Discord events

Overview

This node triggers workflows based on various Discord events. It listens to specific Discord server activities such as messages, threads, commands, user joins/leaves, role changes, presence updates, and interactions with buttons or selects. This is useful for automating responses, logging, notifications, or integrations triggered by real-time Discord events.

Common scenarios include:

  • Triggering a workflow when a message containing a certain keyword is sent in specified channels.
  • Starting automation when a new thread is created.
  • Responding to custom slash commands issued by users.
  • Reacting to user presence changes (e.g., online/offline status).
  • Handling user role assignments or removals.
  • Processing button or select menu interactions on messages.

For example, you could use this node to automatically welcome new users joining the server, log messages containing specific content, or trigger workflows when users interact with bot-generated buttons.

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 an active bot.
From roles Filter events to only those involving users with selected roles. If none selected, listens to everyone (@everyone). Only applies to certain event types like messages, threads, commands, user leaves, presence updates, nick updates, role changes, and interactions.
Trigger type Type of Discord event to listen for. Options: Message, Thread, Command, Interaction, User joins, User leaves, User presence update, User nick updated, User role added, User role removed.
Which roles For "User role added" or "User role removed" events, filter by specific roles. If none selected, listens to everyone.
Presence For "User presence update" event, specify which presence change to listen for: Any change, Online, Offline, Do not disturb, Idle.
Pattern For "Message" or "Thread" events, how to match the value: Equals, Starts with, Contains, Ends with, Regex. The message is tested after removing mentions and trimming whitespace.
Value The string value to test against messages or threads according to the selected pattern. Required for message/thread triggers.
Name For "Command" event, the name of the command to listen to (alphanumeric only). Required.
Description For "Command" event, description of the command. Required.
Input field type For "Command" event, type of input field: None, Text, Number, Integer, Boolean. Required.
Input field description For "Command" event, description of the input field if applicable. Required if input field type is not None.
Input field required For "Command" event, whether the input field is required. Optional.
Case Sensitive For "Message" or "Thread" events, whether matching the value should be case sensitive. Default false.
Bot Mention For "Message" or "Thread" events, require the message to mention the bot to trigger the workflow. Does not exclude other criteria.
Message ID For "Interaction" event, the message ID of the button/select to listen to. Required.
Placeholder A placeholder message shown in the channel that triggers the workflow. Can be replaced by a response message from a Discord Send node.

Output

The node outputs JSON data representing the Discord event that triggered the workflow. The output fields may include:

  • content: The message content (for message events).
  • guild: The guild/server ID where the event occurred.
  • channelId: The ID of the channel where the event happened.
  • userId: The ID of the user involved.
  • userName: The username of the user.
  • userTag: The user's tag (username#discriminator).
  • messageId: The ID of the message related to the event.
  • presence: User presence status (online, offline, etc.) for presence update events.
  • nick: User's nickname if updated.
  • addedRoles: Roles added to the user.
  • removedRoles: Roles removed from the user.
  • interactionMessageId: For interaction events, the message ID of the button/select.
  • interactionValues: Values selected in interaction components.
  • userRoles: Current roles of the user.
  • attachments: Any attachments included in the message.

If binary data (such as file attachments) is present, it will be included accordingly.

Dependencies

  • Requires a valid Discord API credential with a bot token.
  • The bot must be running and connected to the Discord server.
  • At least one accessible text channel must exist for listening.
  • The node uses a webhook endpoint to receive Discord events.
  • Requires n8n environment configured with the Discord API credentials and proper webhook setup.

Troubleshooting

  • No channels listed: Ensure your credentials are set correctly, the bot is running, and you have at least one text channel available. After fixing, close and reopen the node modal to reload channels.
  • Commands not showing up: Verify the trigger is active and restart your Discord client.
  • Authentication errors: Check that the provided API key/bot token is valid and has necessary permissions.
  • Workflow not triggering: Confirm the event type matches the actual Discord event, and filters (channels, roles, patterns) are correctly set.
  • Regex pattern issues: Make sure the regex syntax is correct and tested outside before applying.
  • Missing required properties: Some event types require specific properties (e.g., message ID for interaction events); ensure these are filled.

Links and References

Discussion