Overview
The Discord Trigger node listens for specific events in a Discord server and triggers n8n workflows when those events occur. It is highly configurable, allowing you to specify which channels, roles, message patterns, commands, or user actions (such as joining/leaving, role changes, presence updates, or interactions) should activate the workflow.
Common scenarios:
- Automate responses to messages or commands in Discord.
- Monitor user activity (joins, leaves, presence changes).
- React to role assignments or removals.
- Handle button/select menu interactions.
- Build moderation bots, notification systems, or custom integrations between Discord and other services.
Practical examples:
- Start a workflow when someone sends a message containing "help" in a support channel.
- Trigger an action when a user joins the server.
- Listen for a specific slash command and process its input.
- Respond to a button click on a bot's message.
Properties
| Name | Meaning |
|---|---|
| Listen to | Select the text channels to listen to for triggering the workflow. If none are selected, all channels will be monitored. Requires bot credentials and at least one available text channel. |
| From roles | (For certain trigger types) Optionally restrict listening to users with specific roles. If none are selected, listens to everyone. |
| Trigger type | Type of event to listen to: - Message - Message Update - Command - Interaction - User joins - User leaves - User presence update - User role added - User role removed |
| Which roles | (For "User role added"/"User role removed") Restrict to specific roles; if none, listens to all. |
| Presence | (For "User presence update") Type of presence change to listen to: - Any change - Online - Offline - Do not disturb - Idle |
| Pattern | (For "Message"/"Message Update") How to match the value: - Equals - Starts with - Contains - Ends with - Regex |
| Value | (For "Message"/"Message Update") The value to test against incoming messages. Required. |
| Name | (For "Command") The name of the command to listen to (alphanumeric only). Required. |
| Description | (For "Command") The description of the command. Required. |
| Input field type | (For "Command") Type of input field: - None - Text - Number - Integer - Boolean. Required. |
| Input field description | (For "Command" with input field) Description of the input field. Required if input field is present. |
| Input field required | (For "Command" with input field) Whether the input field is required. |
| Case Sensitive | (For "Message"/"Message Update") Whether matching is case sensitive. |
| Bot Mention | (For "Message"/"Message Update") If true, message must mention the bot to trigger. |
| Message ID | (For "Interaction") The message ID of the button/select to listen to. Required. |
| Placeholder | Optional 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 json structure (fields may be present depending on the event type):
{
"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",
"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": "Values from the interaction (if applicable)",
"userRoles": ["Array of user's role IDs (if applicable)"],
"attachments": [
{
// Attachment objects, if any (e.g., files/images sent)
}
]
}
- If the event includes file attachments (e.g., images), these are included in the
attachmentsarray.
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 channels/roles.
- 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 there is at least one text channel/role available. 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. Make sure the bot has permissions and is online.
- Command not showing up in Discord: Ensure the trigger is active and restart your Discord client.
- Missing fields in output: Some fields are only present for specific event types (e.g.,
contentfor messages,presencefor presence updates).
Error messages:
- Credential errors: "Invalid credentials" or similar—verify your Discord API key and base URL.
- Connection errors: "Failed to connect to bot"—ensure the bot is running and reachable.
- Missing required property: For example, missing "Value" for message triggers or "Name" for commands—fill in all required fields.