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

# Discord bot

> Add the Sazabi bot to your Discord server so your team can mention it, message it directly, or use /sazabi to investigate without leaving Discord.

## Supported capabilities

Core integration

* **Core integration**: [Discord bot](https://docs.sazabi.com/catalogs/integrations/discord-bot.md#core-integration) — Add the Sazabi bot to your Discord server so your team can mention it, message it directly, or use /sazabi to investigate without leaving Discord.

Each connection method has its own setup and permissions. Connecting one method does not enable the others.

## Core integration

## About

The Sazabi bot brings the Sazabi agent into your Discord server. Mention it in a channel, send it a direct message, or use the `/sazabi` command, and it answers grounded in your project's data.

Each server you add is its own connection. The bot is separate from the [Discord](https://docs.sazabi.com/catalogs/integrations/discord.md) integration, which posts issue alerts to channels through webhooks; you can use either or both.

> [!WARNING]
>
> **Limited release**
>
> The Discord bot is in limited release and is not yet enabled for every organization. [Contact support](https://docs.sazabi.com/guides/administer/support.md) to request access.

## Prerequisites

* **Manage Server** permission in the Discord server you add the bot to. Discord only lists servers you can manage.
* Organization admin access in Sazabi.

### Permissions the bot requests

The bot asks for a fixed set of permissions when you add it. It never asks for Administrator, Manage Messages, or Mention Everyone.

| Permission | Why the bot needs it |
| - | - |
| View Channels | See the channels where people mention it |
| Send Messages | Answer in channels and direct messages |
| Send Messages in Threads | Reply inside the thread it starts for a conversation |
| Create Public Threads | Start a thread under the message that mentioned it |
| Embed Links | Show previews for links back to Sazabi |
| Add Reactions | React to show it picked up a request and when it is done |
| Read Message History | Read earlier messages in a thread for context |

The bot also registers the `/sazabi` slash command in your server.

## Set up in the dashboard

**Step 1**

### Open the Discord bot integration

In the dashboard, go to [**Settings > Integrations > Discord bot**](https://app.sazabi.com/settings/integrations/discord-bot).

**Step 2**

### Add to Discord

Click **Add to Discord**. On Discord's screen, pick the server, review the permissions, then authorize. Discord adds the bot to the server and sends you back to Sazabi. Repeat to add the bot to more servers.

**Step 3**

### Choose a default project

Open the new connection and pick a **Default project**. Conversations started from this server land in that project unless their channel is routed to another one.

Adding the bot to a server that is already connected refreshes that connection instead of creating a second one. A Discord server can be connected to only one Sazabi organization; if another organization already has it, Sazabi asks before moving it.

## Set up with the CLI

The Discord bot is added from the dashboard only, because Discord shows its server picker and permissions in the browser. The [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) lists the connection once it exists:

```bash theme={"system"}
sazabi integrations list
```

## Chat with Sazabi

* **Mention the bot.** Write `@Sazabi` and your question in any channel the bot can see. It answers in a thread under your message. Reply in that thread to continue; you don't need to mention it again.
* **Send a direct message.** Message the bot directly for a private conversation. If you belong to more than one Sazabi organization, it asks which one to use and remembers your choice.
* **Use `/sazabi`.** `/sazabi ask` starts a thread with your question. `/sazabi status` shows which Sazabi organization and project the channel you run it in uses and whether your account is linked, `/sazabi link` links your Discord account, and `/sazabi org` changes the organization your direct messages use.

The bot never pings `@everyone`, `@here`, roles, or users in its answers. See [Chat outside the dashboard](https://docs.sazabi.com/guides/investigate/chat.md).

## Route channels to projects

On the connection's page, **Channel routing** sends conversations in a channel to a specific project. Click **Add channel routing**, pick a text or announcement channel the bot can see, then pick the project. A mention of the bot in that channel, or in any thread under it, then runs in that project. Channels without a route and direct messages use the default project, and conversations that already started keep their project.

You can manage the same routes with the public API (`integrations.discordChannelProjectMappings.list`, `.upsert` and `.delete`; `integrations.discordChannels.list` lists the channels a route can name) the CLI (`sazabi integrations discord-routes`), or the [`sazabi_integration_discord_channel_project_mapping`](https://docs.sazabi.com/reference/terraform/sazabi_integration_discord_channel_project_mapping) Terraform resource. Deleting a project removes its routes, and disconnecting the bot removes the connection's routes.

## Link your Discord account

Discord does not share email addresses with bots, so Sazabi identifies you by your linked Discord account. The first time you talk to the bot, it replies with a link to connect your Discord account to your Sazabi account. After you connect, the bot works with your Sazabi permissions.

## Alerts and threads

Issue alerts go to the Discord channels you set up in the [Discord](https://docs.sazabi.com/catalogs/integrations/discord.md) integration's delivery rules. When the bot is in the same server and can post in that channel, it sends the alert itself: updates (resolved, ignored, updated, still ongoing) go into a thread on the alert, the original alert shows the issue's current status, and the alert has **Resolve**, **Ignore**, and **Investigate** buttons. Clicking a button requires a linked Discord account. If the bot can't post in the channel, the alert goes through the channel webhook as before.

Conversations with the bot stay in their thread, so each investigation keeps its own history.

## Verify

Mention `@Sazabi` in a channel the bot can see. It reacts to your message, starts a thread, and answers there.

## Troubleshooting

**The bot doesn't answer in a channel** — Check that the bot's role can view the channel, send messages, and create threads there. Channel permission overrides can hide a channel from the bot.

**The bot asks me to connect my account again** — Your Discord account link was removed, or you are writing from a different Discord account. Follow the link the bot sends.

**Connection shows needs attention** — The bot was removed from the server. Click **Add to Discord** again on [**Settings > Integrations > Discord bot**](https://app.sazabi.com/settings/integrations/discord-bot).

## Further reading

> [card] [Chat](https://docs.sazabi.com/guides/investigate/chat.md)
>
> Ask the Sazabi agent questions from Discord.

> [card] [Discord](https://docs.sazabi.com/catalogs/integrations/discord.md)
>
> Post issue alerts to Discord channels.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.