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

# Discord

> Team messaging via Discord bot integration

## Overview

Connect Discord to enable TierZero to receive alerts, interact with your team, and manage incidents directly in Discord channels. The Discord integration works through a bot that bridges Discord and TierZero via webhooks.

## Prerequisites

* A Discord Developer Application and Bot Token
* An HTTPS endpoint for webhook reception
* A TierZero API key (32-character hex string)

## How It Works

The Discord bot acts as a bridge between Discord and TierZero:

* **Outbound** (Discord → TierZero): Bot forwards mentions, reactions, and server events to TierZero via webhooks
* **Inbound** (TierZero → Discord): TierZero sends messages, reactions, and updates back through the bot

## Setup Instructions

### Step 1: Create a Discord Bot

1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
2. Create a new application and add a bot
3. Enable the required intents: **Server Members**, **Message Content**, **Guild Messages**, **Guild Message Reactions**
4. Copy the bot token

### Step 2: Configure TierZero

1. Go to **Settings → Integrations** in TierZero
2. Click **Connect** next to Discord
3. Enter your bot token and webhook endpoint URL
4. Copy the TierZero API key provided

### Step 3: Deploy Your Bot

Deploy a bot that:

1. Listens to Discord events (mentions, reactions, server joins/leaves)
2. Forwards events to TierZero's webhook endpoints
3. Exposes webhook endpoints for TierZero to send messages back

### Authentication

All communication between TierZero and your bot uses the header:

```http theme={null}
x-tierzero-discord-key: <32-char-hex-api-key>
```

## Events

### Discord → TierZero

| Event            | Trigger                  | Endpoint                                |
| ---------------- | ------------------------ | --------------------------------------- |
| `server_joined`  | Bot added to a server    | `POST /discord/webhooks/server_joined`  |
| `bot_mentioned`  | User mentions the bot    | `POST /discord/webhooks/bot_mentioned`  |
| `reaction_added` | User reacts to a message | `POST /discord/webhooks/reaction_added` |
| `server_left`    | Bot removed from server  | `POST /discord/webhooks/server_left`    |

### TierZero → Discord

| Operation      | Bot Endpoint                          |
| -------------- | ------------------------------------- |
| Send message   | `POST /webhooks/send_message`         |
| Add reaction   | `POST /webhooks/add_reaction`         |
| Edit message   | `POST /webhooks/edit_message`         |
| Delete message | `POST /webhooks/delete_message`       |
| Get users      | `POST /webhooks/get_users`            |
| Get channels   | `POST /webhooks/get_server_channels`  |
| Get messages   | `POST /webhooks/get_channel_messages` |
| Get threads    | `POST /webhooks/get_channel_threads`  |

For detailed webhook specifications, payload schemas, and implementation examples, see the full [Discord Bot reference](/integrations/discord-bot).

## Security

* **HTTPS 1.2+** required for all communications
* **Replay protection**: Each event includes a UUID idempotency key; duplicates are rejected within 24 hours
* Store your API key securely and never expose it in client-side code

## Troubleshooting

### Bot Not Responding

* Verify the bot is online and the webhook endpoint is reachable
* Check that the `x-tierzero-discord-key` header matches
* Ensure the bot has the required Discord intents enabled
