Discord icon

Discord

Interact with Discord API - Full Bot Features

Overview

This node allows sending direct messages (DMs) to Discord users using a bot. It supports sending plain text messages, messages with embedded JSON content, and messages with attachments either from 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

  1. Send a simple text DM to a user by specifying their user ID and message content.
  2. Send a DM with a rich embed by providing a JSON embed object.
  3. Send a DM with an attached file by either uploading binary data or linking to a file URL.

Properties

Name Meaning
Message Content The text content of the direct message to send.
Embed (JSON) A JSON string representing a Discord embed object to include 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 (required if attachment type is binary).
File URL The URL of the file to attach (required if attachment type is URL).
File Name Optional custom name for the attached file.
User ID The Discord user ID of the recipient to whom the DM will be sent.

Output

JSON

  • id - ID of the sent message.
  • content - Content of the sent message.
  • userId - ID of the user who received the DM.
  • username - Username of the user who received the DM.
  • recipient
    • id - ID of the recipient user.
    • username - Username of the recipient user.

Dependencies

  • Discord API with bot token authentication

Troubleshooting

  • Invalid embed JSON will cause an error; ensure the JSON is correctly formatted.
  • If attachment type is binary but the specified binary property does not exist, an error will be thrown.
  • If the user ID is invalid or the bot cannot send a DM to the user, the operation will fail.
  • Ensure the bot token credential is valid and has permissions to send DMs.

Links

Discussion