> For the complete documentation index, see [llms.txt](https://cylexdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cylexdev.gitbook.io/docs/cylex_mdt/guides/discord-webhooks.md).

# Discord Webhooks

Route every MDT action — incidents, BOLOs, officer changes, and more — to dedicated Discord channels using per-category webhook URLs.

Cylex MDT can log every action taken inside the terminal to Discord. Each category of action has its own channel field, so you can send incident reports to one channel, permission changes to another, and general system events to a catch-all. Configuration lives entirely in `editable/sv_config.lua`.

### Configuration structure <a href="#id-9b9bac20-d013-4191-aa13-c64f602e92a3" id="id-9b9bac20-d013-4191-aa13-c64f602e92a3"></a>

Open `editable/sv_config.lua` and find the `Config.DiscordWebhooks` table. The top-level fields control global behaviour; the `channels` sub-table maps each action category to a webhook URL.

```lua
-- editable/sv_config.lua
Config.DiscordWebhooks = {
    enabled    = true,
    botName    = 'Cylex MDT',   -- Display name shown on Discord embeds
    botAvatar  = '',              -- Bot avatar URL (leave empty to use default)
    serverName = 'Cylex MDT',     -- Appears in the embed footer

    channels = {
        incidents     = '',   -- Incident report create / update / delete
        evidence      = '',   -- Evidence records
        bolos         = '',   -- BOLO and warrant events
        citizens      = '',   -- Citizen profile changes
        vehicles      = '',   -- Vehicle record changes
        officers      = '',   -- Officer profile and roster changes
        notes         = '',   -- Internal note records
        charges       = '',   -- Charge and category changes
        fto           = '',   -- FTO report events
        weapons       = '',   -- Weapon record changes
        exams         = '',   -- Exam events
        units         = '',   -- Unit changes
        announcements = '',   -- Dashboard announcement events
        permissions   = '',   -- Permission updates
        uniforms      = '',   -- Uniform changes
        templates     = '',   -- Template changes
        tags          = '',   -- Tag changes
        system        = '',   -- Fallback for other / general system logs
    }
}
```

### Available channels <a href="#id-5d4d3329-1b5e-4c3f-9ccc-c8c48aad7de2" id="id-5d4d3329-1b5e-4c3f-9ccc-c8c48aad7de2"></a>

| Channel key     | What it logs                                              |
| --------------- | --------------------------------------------------------- |
| `incidents`     | Incident report created, updated, or deleted              |
| `evidence`      | Evidence records added, updated, or removed               |
| `bolos`         | BOLO created, updated, closed, and warrant events         |
| `citizens`      | Citizen profile changes (photo, status, notes, licenses)  |
| `vehicles`      | Vehicle record changes                                    |
| `officers`      | Officer profile updates and roster edits                  |
| `notes`         | Internal note created, updated, or deleted                |
| `charges`       | Charge definitions and charge category changes            |
| `fto`           | FTO report created, updated, or deleted                   |
| `weapons`       | Weapon record created, updated, or deleted                |
| `exams`         | Exam created, updated, deleted, and submissions           |
| `units`         | Unit created or deleted                                   |
| `announcements` | Dashboard announcements created, updated, or deleted      |
| `permissions`   | Permission updates saved via the Permissions page         |
| `uniforms`      | Uniform code changes                                      |
| `templates`     | Template created, edited, or deleted                      |
| `tags`          | Tag created, updated, or deleted                          |
| `system`        | General system events and fallback for uncategorised logs |

### How the fallback works <a href="#aaf70e4a-4bea-4103-be7a-58cafbe4d908" id="aaf70e4a-4bea-4103-be7a-58cafbe4d908"></a>

If a channel's URL is left as an empty string, the MDT falls back to the `system` channel for that category. If `system` is also empty, actions in that category are silently skipped and not sent to Discord at all. This lets you consolidate lower-traffic categories (such as `tags` or `templates`) into a single general-purpose channel while keeping high-traffic ones like `incidents` separate.

### Setting it up <a href="#id-889a7a33-b78b-4d26-b078-8182f8b1073c" id="id-889a7a33-b78b-4d26-b078-8182f8b1073c"></a>

{% stepper %}
{% step %}

### Create a webhook in Discord

In your Discord server, open the channel you want logs sent to. Go to **Edit Channel → Integrations → Webhooks → New Webhook**. Copy the webhook URL.
{% endstep %}

{% step %}

### Paste the URL into sv\_config.lua

Open `editable/sv_config.lua` and paste the copied URL into the appropriate channel field inside `Config.DiscordWebhooks.channels`. Repeat for each category you want to log separately.
{% endstep %}

{% step %}

### Set enabled to true

Confirm that `enabled = true` is set at the top of the `Config.DiscordWebhooks` table. Set it to `false` to disable all Discord logging without removing your URLs.
{% endstep %}

{% step %}

### Optionally customise the bot appearance

Set `botName` to the display name you want on Discord embeds, and supply a `botAvatar` URL if you want a custom avatar. The `serverName` value appears in the footer of every embed.
{% endstep %}

{% step %}

### Restart the resource

Run `ensure cylex_mdt` in the server console (or restart your server) for the new webhook URLs to take effect.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
Webhook URLs are server-side only — they live in `sv_config.lua` and are never sent to clients.
{% endhint %}
