Actions30
- Message Actions
- User Actions
- Channel Actions
- Guild Actions
- Emoji Actions
- Analytics Actions
- Moderation Actions
- Backup Actions
- DM Actions
Overview
This node operation sends a direct message (DM) to a specified Discord user. It allows sending plain text messages, messages with embedded JSON content, and messages with attachments either as binary data or via a URL. This is useful for automating personalized communication with users on Discord, such as sending notifications, alerts, or custom messages directly to a user's inbox.
Use Case Examples
- Sending a simple text DM to a user by specifying their User ID and message content.
- Sending a DM with an embedded rich content message using JSON format for the embed.
- Sending a DM with an attached file either from binary data stored in the workflow or from a file URL.
Properties
| Name | Meaning |
|---|---|
| User ID | The ID of the Discord user to whom the direct message will be sent. |
| Message Content | The text content of the direct message to send. |
| Embed (JSON) | An optional embed object in JSON format to include rich content in the message. |
| Attachment Type | Specifies the type of attachment to send with the message: none, binary data, or URL. |
| Binary Property | The name of the binary property containing the file data to attach when attachment type is binary. |
| File URL | The URL of the file to attach when attachment type is URL. |
| File Name | Optional custom name for the attached file. |
| Additional Options | Additional optional parameters for message sending, such as including bots, message filters, and audit log settings. |
Output
JSON
id- ID of the sent direct message.content- Text content of the sent message.channelId- ID of the DM channel where the message was sent.createdTimestamp- Timestamp when the message was created.recipientid- ID of the recipient user.username- Username of the recipient user.
Dependencies
- discord.js library for interacting with the Discord API
- An API key credential for Discord bot authentication
Troubleshooting
- Ensure the User ID is correct and the bot has permission to send DMs to the user.
- Invalid embed JSON will cause an error; verify the JSON format before sending.
- If sending binary attachments, ensure the binary property exists and contains valid data.
- Network or permission issues may prevent the bot from sending messages; check bot permissions and connectivity.
Links
- Discord Message Object Documentation - Official Discord API documentation for message objects, useful for understanding message structure and embed formatting.
- discord.js Client Class - Documentation for the discord.js Client class used to interact with the Discord API in this node.