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

# Discord Bots

> Deploy a Bothive agent as a secure Discord slash-command app.

## What this deployment supports

Bothive connects Discord through its HTTP Interactions endpoint. Your agent receives signed slash-command interactions without maintaining a persistent gateway connection.

<Info>
  This is command-first Discord support. It is ideal for `/ask`, FAQ, community support, and internal server assistants. It does not read every ordinary server message through the Discord Gateway.
</Info>

## Before you start

You need a Discord application and these values from the Discord Developer Portal:

| Bothive field        | Where to find it                                             |
| -------------------- | ------------------------------------------------------------ |
| Bot Token            | **Bot** > Reset Token                                        |
| Application ID       | **General Information**                                      |
| Public Key           | **General Information**                                      |
| Server ID (optional) | Enable Discord Developer Mode, then copy your test server ID |

Never share the bot token. Bothive uses the public key only to verify Discord's signed interaction requests.

## Deploy to Discord

<Steps>
  <Step title="Create a Discord application">
    Open the [Discord Developer Portal](https://discord.com/developers/applications), select **New Application**, give it a name, and create a bot under **Bot**.
  </Step>

  <Step title="Add a Discord channel in Bothive">
    Open your agent in Bothive, then **Channels** > **Discord**. Enter the Bot Token, Application ID, and Public Key. Add a Server ID only if you want to restrict the agent to one server.
  </Step>

  <Step title="Set the Interactions Endpoint URL">
    Back in Discord, open **General Information** and set **Interactions Endpoint URL** to the URL shown after saving the Bothive channel. On the standard production domain it is:

    ```
    https://bothive.cloud/api/channels/discord/webhook
    ```

    Discord immediately sends a signed `PING`. Bothive answers it and verifies the request signature with the Public Key you provided. Do not use a URL from a local development server.
  </Step>

  <Step title="Install the app in a server">
    In **Installation**, enable **Guild Install** and include the `applications.commands` scope. Include the `bot` scope if you also want a bot user in the server. Install the app into a test server first.
  </Step>

  <Step title="Create and test a slash command">
    Create a command such as `/ask` in the Developer Portal or with Discord's application-command API. Send a real question through that command, then inspect the run in Bothive Observability.
  </Step>
</Steps>

## Recommended first command

| Command   | Description                          | Use case                         |
| --------- | ------------------------------------ | -------------------------------- |
| `/ask`    | Ask the agent a question             | Docs, FAQ, and community support |
| `/help`   | Show the agent's supported tasks     | Onboarding new members           |
| `/status` | Ask for a concise operational status | Internal operations bots         |

Start with a single `/ask` command. Add more commands only when a distinct workflow needs a clearer entry point.

## Security and testing

<Checklist>
  <Check>Use the Public Key from the same Discord application as the Bot Token.</Check>
  <Check>Confirm Discord accepts the endpoint URL before sharing the install link.</Check>
  <Check>Test in a private server before inviting a wider community.</Check>
  <Check>Review the first run in Bothive Observability and adjust the agent instructions if needed.</Check>
</Checklist>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Discord rejects the endpoint URL">
    Recopy the Public Key and ensure the URL uses your deployed Bothive domain. Discord validates the endpoint with a signed PING request, so it must be publicly reachable.
  </Accordion>

  <Accordion title="The slash command does not appear">
    Confirm the application is installed with `applications.commands`. Use a guild-scoped command while testing; Discord recommends guild commands for fast iteration.
  </Accordion>

  <Accordion title="The agent does not respond to normal messages">
    This deployment handles Discord interactions such as slash commands. Use `/ask` rather than expecting it to read every message in a channel.
  </Accordion>
</AccordionGroup>

## Next reads

<CardGroup cols={3}>
  <Card title="Deploy to Channels" icon="rocket" href="./deploy-to-channels" />

  <Card title="Slack Bots" icon="slack" href="./slack-bots" />

  <Card title="Read Your First Trace" icon="chart-line" href="./read-your-first-trace" />
</CardGroup>
