Overview
The Discord Trigger node for n8n allows workflows to be triggered by a wide range of Discord events, such as messages, commands, user interactions, and changes in user presence or roles. This node is highly configurable, enabling you to listen to specific channels, filter by user roles, and fine-tune the event types that should trigger your workflow.
Common scenarios:
- Automate responses to specific messages or commands in Discord channels.
- Monitor when users join or leave a server, or when their presence/roles change.
- React to button or select menu interactions within Discord messages.
- Build moderation bots, notification systems, or custom integrations between Discord and other services.
Practical examples:
- Trigger a workflow when someone sends a message containing "help" in a support channel.
- Start an approval process when a user clicks a button in a Discord message.
- Log every time a user with a certain role joins or leaves the server.
Properties
Name | Meaning |
---|---|
Listen to | Select the text channels to monitor for triggering the workflow. If none are selected, all channels are monitored. Requires bot credentials and at least one available text channel. |
From roles | (For certain event types) Optionally restrict triggers to users with specific roles. If none are selected, listens to everyone. Applies to: Message, Command, User Leaves, User Presence Update, User Role Added/Removed, Interaction. |
Trigger type | The type of Discord event to listen for: - Message - Command - Interaction - User joins - User leaves - User presence update - User role added - User role removed |
Which roles | (For User Role Added/Removed) Specify which roles to monitor for addition/removal. If none are selected, listens to all roles. |
Presence | (For User Presence Update) Type of presence change to listen for: - Any change - Online - Offline - Do not disturb - Idle |
Pattern | (For Message) How to match the message content: - Equals - Starts with - Contains - Ends with - Regex |
Value | (For Message) The value to test against incoming messages, according to the selected pattern. Required. |
Name | (For Command) The name of the command to listen for (alphanumeric only). Required. |
Description | (For Command) The description of the command. Required. |
Input field type | (For Command) The type of input field for the command: - None - Text - Number - Integer - Boolean. Required. |
Input field description | (For Command with input field) Description of the input field. Required if an input field is specified. |
Input field required | (For Command with input field) Whether the input field is required. |
Case Sensitive | (For Message) Whether message matching should be case sensitive. |
Bot Mention | (For Message) If true, the message must mention the bot to trigger the workflow (in addition to other criteria). |
Message ID | (For Interaction) The message ID of the button/select to listen to. Required. |
Placeholder | A placeholder message shown in the channel while the workflow runs. Can be replaced by a response from a Discord Send node. |
Output
The node outputs a single item per trigger event, with the following possible fields in the json
object:
{
"content": "Message content (if applicable)",
"channelId": "ID of the channel where the event occurred",
"userId": "ID of the user involved",
"userName": "Username of the user involved",
"userTag": "User tag (e.g., username#1234)",
"messageId": "ID of the message (if applicable)",
"presence": "Presence status (if applicable)",
"addedRoles": ["Array of role IDs added (if applicable)"],
"removedRoles": ["Array of role IDs removed (if applicable)"],
"interactionMessageId": "ID of the interaction message (if applicable)",
"interactionValues": ["Array of values from the interaction (if applicable)"],
"userRoles": ["Array of current user role IDs (if applicable)"],
"attachments": [
{
// Attachment objects, if any (e.g., files/images sent with a message)
}
]
}
- Not all fields will be present for every event; only those relevant to the triggered event type will be included.
- If there are attachments (such as images or files), they will be included in the
attachments
array.
Dependencies
- External Service: Requires a Discord bot and valid Discord API credentials (
discordApi
). - n8n Configuration: The bot must be running and have access to the relevant Discord server and channels.
- Environment: At least one text channel must be available in the Discord server.
Troubleshooting
Common issues:
- No channels/roles listed: Ensure your Discord credentials are set, the bot is running, and you have at least one text channel. Try closing and reopening the node modal to reload options.
- Workflow not triggering: Double-check that the correct event type, channels, and roles are selected. For commands, ensure the command is registered and the bot has permissions.
- Command not showing up in Discord: Make sure the trigger is active and restart your Discord client.
- Missing fields in output: Some fields are only present for specific event types (e.g.,
presence
for presence updates).
Error messages:
- Credential errors: "Invalid credentials" or similar—verify your Discord API key and bot permissions.
- Connection errors: Issues connecting to the Discord bot may indicate network problems or incorrect configuration.