Overview
This node acts as a trigger for Discord events, specifically designed to start workflows when certain Discord events occur. In the provided configuration, it listens for the creation of new messages in a specified Discord channel. It can be configured to trigger only on messages sent by bots, and optionally filter by a specific bot ID. This is useful for automating responses, logging, or other workflow actions based on Discord message activity.
Use Case Examples
- Trigger a workflow whenever a new message is posted in a specific Discord channel.
- Trigger a workflow only when a bot posts a message in a Discord channel, optionally filtering by a specific bot ID.
Properties
| Name | Meaning |
|---|---|
| Event | The type of Discord event to listen for, currently supports 'Message Created' event. |
| Channel ID | The ID of the Discord channel to listen to for the event. |
| Only Messages from Bot | Whether to trigger the workflow only on messages sent by bots. |
| Bot ID | The ID of the bot to listen to. If empty, listens to messages from any bot. |
Output
JSON
messageId- The unique ID of the Discord message that triggered the event.content- The text content of the message.authorid- The ID of the message author.username- The username of the message author.bot- Boolean indicating if the author is a bot.
channelId- The ID of the channel where the message was posted.guildId- The ID of the Discord guild (server) where the message was posted.createdTimestamp- Timestamp when the message was created.attachments- Array of attachments included in the message, each with id, url, name, contentType, and size.
Dependencies
- Discord API via discord.js library
- OAuth2 API credentials for Discord authentication
Troubleshooting
- Ensure the OAuth2 API credentials are correctly configured and have the necessary permissions to access the Discord channel and read messages.
- Verify the channel ID is correct and the bot has access to that channel.
- If filtering by bot ID, ensure the bot ID is accurate and the bot is present in the channel.
- Common errors may include authentication failures or permission errors from Discord API, which require checking the OAuth2 token and bot permissions.
Links
- discord.js Client Documentation - Documentation for the Discord client library used to interact with Discord API.
- Discord Developer Portal - Official Discord developer documentation for API and bot setup.