> ## Documentation Index
> Fetch the complete documentation index at: https://document.botsmith.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Your BotSmith AI Chatbot to Your Discord Server

> Connect BotSmith to Discord by creating a bot application, adding the bot token, and inviting it to your server so members can chat with your agent.

The Discord integration lets your BotSmith agent respond to messages in your Discord server. You create a Discord application and bot in the Discord Developer Portal, connect the bot token to BotSmith, invite the bot to your server, and then start the bot so it can listen for messages in real time.

## Step 1: Create a Discord Application

1. Go to [discord.com/developers/applications](https://discord.com/developers/applications) and sign in.
2. Click **New Application** in the top-right corner.
3. Give your application a name and click **Create**.
4. In the left sidebar, click **Bot**.
5. Click **Add Bot**, then confirm by clicking **Yes, do it!**
6. Under the bot's username, click **Reset Token** and confirm. Copy the token — you cannot see it again after leaving this page.

## Step 2: Enable Message Content Intent

Your bot needs the **Message Content Intent** to read the text of messages sent in channels.

1. On the **Bot** page in the Developer Portal, scroll down to **Privileged Gateway Intents**.
2. Enable the **Message Content Intent** toggle.
3. Click **Save Changes**.

<Warning>
  If Message Content Intent is not enabled, the bot will receive message events
  but cannot read the message text. Your agent will not be able to respond to
  any messages until this setting is turned on.
</Warning>

## Step 3: Connect to BotSmith

<Steps>
  <Step title="Open the Integrations tab">
    In the BotSmith chatbot editor, click the **Integrations** tab.
  </Step>

  <Step title="Open Discord configuration">
    Find the **Discord** card and click **Setup**.
  </Step>

  <Step title="Enter your bot details">
    Fill in the following fields:

    * **Bot Token** — Paste the token you copied from the Discord Developer Portal.
    * **Client ID** *(optional)* — Your application's Client ID, found on the **General Information** page of your Discord app.
    * **Server ID** *(optional)* — The ID of the Discord server where the bot will operate. Right-click your server name in Discord and select **Copy Server ID**. You may need to enable Developer Mode in Discord settings first (**User Settings → Advanced → Developer Mode**).
  </Step>

  <Step title="Save the integration">
    Click **Save Integration**.
  </Step>

  <Step title="Enable the integration">
    Toggle **Enable Integration** on.
  </Step>

  <Step title="Start the bot">
    Click the **⚡ Start Bot button** (the lightning bolt icon next to your saved integration). BotSmith starts the bot's Gateway connection so it can receive real-time message events. You will see a confirmation toast when the bot is online and listening.
  </Step>
</Steps>

## Step 4: Invite the Bot to Your Server

Generate an invite link to add the bot to your Discord server.

1. In the Discord Developer Portal, open your application and go to **OAuth2 → URL Generator**.
2. Under **Scopes**, select **`bot`**.
3. Under **Bot Permissions**, select:
   * **Read Messages / View Channels**
   * **Send Messages**
4. Copy the generated URL at the bottom of the page.
5. Open the URL in your browser, select your server from the dropdown, and click **Authorize**.

## Step 5: Test the Integration

1. Open your Discord server and navigate to a channel the bot has access to.
2. Send a message in the channel.
3. Your BotSmith agent should reply within a few seconds.

If the bot does not respond, check that:

* **Message Content Intent** is enabled in the Developer Portal (Step 2).
* The integration is toggled **on** and the bot has been started (Step 3).
* The bot has **Read Messages** and **Send Messages** permissions in the channel.
* Your chatbot is set to **Active** in BotSmith settings.

<Note>
  The bot must be started each time from the integration panel after saving or
  reconfiguring credentials. If you reconfigure your bot token, click the
  Start Bot button again to reconnect.
</Note>
