# Discord

Discord is a real-time communication platform that enables users to connect via text, voice, and video within communities called servers (guilds). It is widely used for social networking, gaming, and business collaboration, offering features like customizable channels, roles, and bot integrations. With Discord, users can streamline conversations, automate tasks, and foster engagement within their communities.

### **How to Connect Discord to ZBrain Flow?** <a href="#how-to-connect-discord-to-zbrain-flow" id="how-to-connect-discord-to-zbrain-flow"></a>

To integrate Discord with ZBrain Flow, follow these steps:

#### **Step 1: Create a Connection** <a href="#step-1-create-a-connection" id="step-1-create-a-connection"></a>

1. **Enter a Connection Name** – Choose a name to identify your Discord connection.
2. **Enter the Bot Token** – To obtain a Discord Bot Token, follow these steps:
   * Go to the [**Discord Developer Portal**](https://discord.com/developers/applications).
   * Click on an existing application or create a new one.
   * Navigate to the Bot tab.
   * Click ‘Reset Token’ to generate a new token.
   * Copy and paste the token into the Bot Token field.
3. **Click ‘Save’** – Your Discord connection is now successfully established in ZBrain Flow.

### **Triggers Available in ZBrain Flow** <a href="#triggers-available-in-zbrain-flow" id="triggers-available-in-zbrain-flow"></a>

#### **New Message Posted** <a href="#new-message-posted" id="new-message-posted"></a>

This trigger activates when a new message is posted in a specified Discord channel.

**How to Set Up the Trigger?**

1. **Select a Connection** – Choose an existing Discord connection or create a new one by following the connection setup steps.
2. **Enter the Channel ID** – The Channel ID can be found in the channel’s URL.
3. **Save and Activate** – Once configured, the trigger will monitor for new messages in the selected channel and initiate the associated workflow.

### **Actions Available in ZBrain Flow** <a href="#actions-available-in-zbrain-flow" id="actions-available-in-zbrain-flow"></a>

Below are the available Discord actions that can be automated using ZBrain Flow.

#### **1. Send Message with Bot** <a href="#id-1.-send-message-with-bot" id="id-1.-send-message-with-bot"></a>

Automate sending messages from your Discord bot to a specific channel or thread.

**Configuration Steps:**

1. **Select the Channel** – Choose a channel from the list of available Discord channels.
2. **Enter the Message** – Input the text message to be sent.
3. **Add Attachments (Optional)** – Upload files to send along with the message.

#### **2. Send Message via Webhook** <a href="#id-2.-send-message-via-webhook" id="id-2.-send-message-via-webhook"></a>

Send a message using a Discord Webhook URL instead of a bot.

**Configuration Steps:**

1. **Enter the Webhook URL** – Provide the Webhook URL from your Discord server.
2. **Enter Name** – Define the display name for the webhook sender.
3. **Enter Message** – Input the message text.
4. **Enter Avatar URL (Optional)** – Set a custom avatar for the webhook message.
5. **Enter Embeds (Optional)** – Structure the message with embeds.
6. **Enable Text-to-Speech (TTS)** – Toggle ON/OFF to make the bot read the message aloud.

#### **3. Request Approval in a Channel** <a href="#id-3.-request-approval-in-a-channel" id="id-3.-request-approval-in-a-channel"></a>

Send a message requesting approval from users and wait for a response.

**Configuration Steps:**

1. **Enter the Bot Token.**
2. **Enter the Approval Request Message** – Type the message requesting approval.
3. **Select the Channel** – Choose where to send the request.

#### **4. Add Role to a Member** <a href="#id-4.-add-role-to-a-member" id="id-4.-add-role-to-a-member"></a>

Assign a specific role to a member in a Discord server (guild).

**Configuration Steps:**

1. **Enter the Bot Token.**
2. **Enter the Guild ID** – Select the server where the user is located.
3. **Enter the User ID** – Provide the Discord user’s ID.
4. **Select the Role** – Choose the role to assign.

#### **5. Remove Role from a Member** <a href="#id-5.-remove-role-from-a-member" id="id-5.-remove-role-from-a-member"></a>

Remove a previously assigned role from a user.

**Configuration Steps:**

1. Enter the Bot Token.
2. Enter the Guild ID.
3. Enter the User ID.
4. Select the role to remove.

#### **6. Remove Member from Guild** <a href="#id-6.-remove-member-from-guild" id="id-6.-remove-member-from-guild"></a>

Remove a member from a Discord server (guild).

**Configuration Steps:**

1. Enter the Bot Token.
2. Enter the Guild ID.
3. Input the User ID.

#### **7. List Guild Members** <a href="#id-7.-list-guild-members" id="id-7.-list-guild-members"></a>

Retrieve a list of all members in a specific Discord guild.

**Configuration Steps:**

1. Enter the Bot Token.
2. Enter the Guild ID.
3. Search for a member and select from the list.

#### **8. Rename a Channel** <a href="#id-8.-rename-a-channel" id="id-8.-rename-a-channel"></a>

Change the name of a text or voice channel.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the channel.
3. Enter the new name for the channel.

#### **9. Create a New Channel** <a href="#id-9.-create-a-new-channel" id="id-9.-create-a-new-channel"></a>

Create a new text or voice channel in a server.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the channel name.

#### **10. Delete a Channel** <a href="#id-10.-delete-a-channel" id="id-10.-delete-a-channel"></a>

Permanently remove a text or voice channel from Discord.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the channel to be deleted.

#### **11. Find a Channel** <a href="#id-11.-find-a-channel" id="id-11.-find-a-channel"></a>

Locate a channel by name within a specific guild (server).

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the channel name.

#### **12. Remove Ban from a User** <a href="#id-12.-remove-ban-from-a-user" id="id-12.-remove-ban-from-a-user"></a>

Lift a ban on a previously banned Discord user.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the User ID.
4. Enter the reason for unbanning.

#### **13. Create a Guild Role** <a href="#id-13.-create-a-guild-role" id="id-13.-create-a-guild-role"></a>

Create a new custom role in a Discord server.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the role name.
4. Enable/disable ‘Display Separated’ – Show the role separately in the sidebar.
5. Enable/disable ‘Mentionable’ – Allow users to mention this role.
6. Enter the reason for creating the role.

#### **14. Delete a Guild Role** <a href="#id-14.-delete-a-guild-role" id="id-14.-delete-a-guild-role"></a>

Remove a role from a Discord server.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the role name.
4. Enter the reason for deleting the role.

#### **15. Ban a Guild Member** <a href="#id-15.-ban-a-guild-member" id="id-15.-ban-a-guild-member"></a>

Ban a user from a Discord server.

**Configuration Steps:**

1. Enter the Bot Token.
2. Select the Guild ID.
3. Enter the User ID.
4. Enter the reason for banning.

#### **16. Custom API Call** <a href="#id-16.-custom-api-call" id="id-16.-custom-api-call"></a>

Send a custom request to a Discord API endpoint.

**Configuration Steps:**

1. Enter the Bot Token.
2. Enter the API URL – Provide the full or relative API URL.
3. Select the HTTP Method:
   * GET (Retrieve data)
   * POST (Send data)
   * PATCH (Modify data)
   * PUT (Update or replace data)
   * DELETE (Remove data)
   * HEAD (Fetch headers only)
4. Add Headers – Define request headers.
5. Add Query Parameters – Define query parameters.
6. Enter JSON Body – Provide request data in JSON format.
7. Enable/Disable ‘No Error on Failure’ – Ignore errors if the API call fails.
8. Enter Timeout – Define timeout in seconds.

***Note:** Click 'f' to insert dynamic values wherever needed.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/discord.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
