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

# Discord

> Connect a Discord server to Oleria to discover members, bots, roles, webhooks, installed apps, and audit log activity, and take remediation actions directly from Oleria.

Discord is a community and team chat platform organized into servers. Connect a Discord server to Oleria to see who is in it, which roles they hold, which of those roles carry administrator permissions, and which bots, apps, and webhooks can act in it. Oleria connects with a bot that you create in the Discord Developer Portal and install in your server, so Oleria's API calls don't run as any person's account. Optionally, the admin who connects Discord can also sign in to Discord once, so Oleria records that admin's own verified email address.

One Oleria integration covers one Discord server.

## What Oleria discovers

Once connected, Oleria continuously discovers and maps the following from your Discord server:

* **Members** - every person in the server, with their username, display name, and the date they joined. The server owner is shown with the **Owner** account role, and members who hold a role with the **Administrator** permission are marked as administrators. Oleria also shows whether a member is still pending membership screening, their server nickname, and whether they're timed out. Discord doesn't share members' email addresses with bots. If you connect with **Bot token with admin sign-in**, the admin who signs in has their own verified email address on their account. No other member has one.
* **Server** - the server itself, shown as a group that every member belongs to, including bots that are members. Discord has no groups inside a server, so roles control access.
* **Roles** - every role in the server, including `@everyone`, roles managed by bots and integrations, and the members who hold each one. Each role shows its permissions. Roles with **Administrator** are shown as super administrator roles, and roles with permissions such as **Manage Server**, **Manage Roles**, **Ban Members**, or **Manage Webhooks** are shown as administrator roles.
* **Non-human identities (NHIs)**:
  * **Bots** - bots in the server, shown as applications, with the OAuth scopes they were installed with and the member who installed them.
  * **Installed apps** - apps added to the server that have no bot in it, such as apps that only add commands, and Twitch, YouTube, or server subscription integrations.
  * **Webhooks** - incoming webhooks, shown as API tokens with the member or bot that created them and the channel they post to. Oleria records that each webhook holds a secret but never reads or stores the secret itself. Channel-follower webhooks are shown as system accounts.
* **Activity** - events from the server's audit log, such as:

  * members banned, unbanned, kicked, or timed out
  * roles granted to or removed from members
  * roles created, changed, or deleted
  * bots and apps added or removed
  * webhooks created, changed, or deleted
  * channel permission changes, and channels, invites, and threads created or deleted
  * server setting changes

  Events Oleria doesn't recognize are kept as custom events.

Oleria refreshes members, roles, and NHIs on its [regular sync schedule](/integrations/overview.md#sync-model).

> [!NOTE]
>
> Oleria doesn't import channels, messages, or invites. This integration covers identity and access governance for members, roles, and NHIs only.

## Prerequisites

* A Discord server where you can install apps. You need the **Manage Server** permission in that server, or be its owner.
* A Discord account to create an application in the [Discord Developer Portal](https://discord.com/developers/applications).
* Admin access on the Oleria platform to add a new integration.

### Bot permissions

Install the bot with these permissions:

| Permission | Used for |
| :- | :- |
| **Server Members Intent** (privileged intent, set on the app's **Bot** page) | Members and role holders. Required. |
| **View Audit Log** | Activity. Required. |
| **Manage Server** | Installed apps and who installed each bot. Required. Without it, members and webhooks still sync, but installed apps don't and bots show no installer. |
| **Manage Webhooks** | Webhooks. Required. |
| **View Channel** on private channels | Webhooks in private channels. From November 16, 2026, Discord may hide them from bots that can't view the channel. Give the bot this permission on those channels, or the **Administrator** permission. |
| **Manage Roles** | **Add user to role** and **Remove user from role**. |
| **Ban Members** | **Disable user accounts** and **Enable user accounts**. |
| **Kick Members** | **Delete user**. |

The last three permissions are needed only for [remediation actions](#remediation-actions). Without them, Oleria still syncs, and actions fail validation with a list of the missing permissions.

## Create the Discord bot

**1. Create an application**

Sign in to the [Discord Developer Portal](https://discord.com/developers/applications), select **New Application**, enter a name such as `Oleria`, accept the Developer Terms of Service, and select **Create**.

**2. Turn on the Server Members Intent**

On the app's **Bot** page, under **Privileged Gateway Intents**, turn on **Server Members Intent** and select **Save Changes**.

**3. Copy the bot token**

On the same page, select **Reset Token** and copy the token. Discord shows it only once.

**4. Install the bot in your server**

On the app's **OAuth2** page, open the URL generator, select the `bot` scope and the permissions in [Bot permissions](#bot-permissions), and open the generated URL. Choose your server and select **Authorize**.

**5. Copy the server ID**

In Discord, turn on **Developer Mode** under **User Settings** -> **Advanced**. Right-click your server's icon and select **Copy Server ID**.

> [!NOTE]
>
> The Developer Portal changes over time. If these steps don't match what you see, refer to Discord's [getting started guide](https://docs.discord.com/developers/quick-start/getting-started).

### Set up admin sign-in (optional)

Skip this section if you connect with **Bot token**. With **Bot token with admin sign-in**, the bot token still does every read and every action. The sign-in only identifies the admin who connects Discord, so Oleria can record that admin's verified email address. It uses the same Discord application as the bot.

**1. Add the redirect URLs**

In the [Discord Developer Portal](https://discord.com/developers/applications), open the app's **OAuth2** page. Under **Redirects**, add both of these URLs, then select **Save Changes**:

* `https://<your Oleria tenant>/workspace/integrations/discord/connect`
* `https://<your Oleria tenant>/workspace/integrations/edit`

**2. Copy the client credentials**

On the same page, copy the **Client ID**. Then reset and copy the **Client Secret**.

When you authenticate, Discord asks you to approve the `identify` and `email` scopes. Oleria reads your Discord user ID and email address, then revokes the Discord token right away. It doesn't store the token. See Discord's [OAuth2 documentation](https://docs.discord.com/developers/topics/oauth2).

## Connect Discord to Oleria

**1. Open the integration**

Sign in to your Oleria workspace, navigate to **Integrations**, and select **Discord**.

**2. Complete the connection form**

Fill in the connection form:

| Field | Notes |
| :- | :- |
| Authentication Method | **Bot token** (default), or **Bot token with admin sign-in** to also record your own verified email address. |
| Bot token | Required. The token you copied from the app's **Bot** page. |
| Server ID | Required. The numeric ID of your Discord server. |
| Client ID | **Bot token with admin sign-in** only. The **Client ID** from the app's **OAuth2** page. |
| Client Secret | **Bot token with admin sign-in** only. The **Client Secret** from the app's **OAuth2** page. |

**3. Authenticate**

Select **Authenticate**. Oleria checks that Discord accepts the bot token, that the bot is a member of the server, and that the bot has **View Audit Log**, **Manage Server**, and **Manage Webhooks**. Oleria saves the integration only if all checks pass, and names it after your server.

With **Bot token with admin sign-in**, Oleria runs the same checks, then sends you to Discord. Sign in and approve the request. Oleria records your email address only if Discord has verified it.

### Edit the connection

You can replace the **Bot token** or the **Client Secret** of an existing integration, for example after you reset it. Leave them blank to keep the current values. To connect a different server, add a new integration.

With **Bot token with admin sign-in**, to sign in again, enter the **Client Secret** and select **Update**. Oleria sends you to Discord to sign in. The admin who signs in replaces the recorded admin and email address. Switching the integration back to **Bot token** removes the recorded email address.

## Verify the integration

Confirm the Discord integration appears on the **Connected** tab of your Oleria **Integrations** page. After the first sync completes, review the discovered members, roles, NHIs, and activity in your Oleria workspace, and check that the server owner and your administrators are marked correctly.

> [!NOTE]
>
> If the bot is removed from the server, its token is reset, or the **Server Members Intent** is turned off, Oleria can't sync. The **Capabilities** tab shows **Read users** and **Read roles** as needing permission when the intent is off.

## Remediation actions

Oleria runs actions as the bot. Discord only lets the bot manage roles below its own highest role, and members whose highest role is below the bot's. Move the bot's role up in **Server Settings** -> **Roles** if an action fails for that reason.

| Action | What it does | Revert |
| :- | :- | :- |
| Add user to role | Grants a role to the member. | Supported - removes the role. |
| Remove user from role | Removes a role from the member. | Supported - grants the role again. |
| Disable user accounts | Bans the user from the server, which also removes them from it. | Supported - lifts the ban. The user must rejoin with an invite, and their roles aren't restored. |
| Enable user accounts | Lifts a ban. | Supported - bans the user again. |
| Delete user | Kicks the member from the server. | Not supported - the user must rejoin with an invite. |
| Disable NHI accounts | Deletes an incoming webhook, or removes an installed app, which also removes its bot and its webhooks. Discord lists at most 50 installed apps. Apps past that can't be removed here, and their bots show no installer: remove them in **Server Settings** -> **Integrations**. | Not supported - recreate the webhook or reinstall the app. |

Each action needs these bot permissions:

| Action | Required permissions |
| :- | :- |
| Add user to role, Remove user from role | **Manage Roles** |
| Disable user accounts, Enable user accounts | **Ban Members** |
| Delete user | **Kick Members** |
| Disable NHI accounts | **Manage Webhooks** for webhooks; **Manage Server** and **Manage Webhooks** for apps |

Oleria refuses these actions and sends no change to Discord:

* Banning or kicking the server owner, or the bot Oleria connects with.
* Changing the roles of the bot Oleria connects with.
* Removing the app Oleria connects with, or deleting webhooks it owns.
* Disabling system accounts, channel-follower webhooks, and server subscriptions, which Discord manages.
* Changing the `@everyone` role, which every member holds.

If the target is already in the requested state, the action succeeds without making a change, and there's nothing to revert.

## Known limitations

* **No member email, MFA, single sign-on, or last activity data.** Discord doesn't share members' email addresses or two-factor authentication status with bots, has no single sign-on, and doesn't report when a member was last active. Oleria shows MFA as unavailable rather than not required.
* **Admin sign-in records one email address.** Only the admin who signs in gets an email address, and only when Discord has verified it. The address is a snapshot from sign-in: if the admin changes it in Discord, edit the integration and sign in again to update it.
* **Activity covers 45 days.** Discord keeps audit log entries for 45 days. The audit log has no sign-in events, IP addresses, or user agents.
* **Actors who left the server.** Audit log events by people who later left the server keep their Discord user ID, but those people aren't shown as members.
* **Channels aren't synced.** Channel permission overwrites aren't modeled, so access granted only through a channel's permissions isn't shown. Channel changes still appear in activity.
* **Private channels after November 16, 2026.** From that date Discord hides channels the bot can't view. Oleria doesn't read channels, but webhooks in private channels may stop appearing. To keep them, give the bot **View Channel** in those channels, or the **Administrator** permission.
* **At most 50 installed apps.** Discord returns at most 50 integrations per server. Past that, Oleria can't show who installed those bots, and **Disable NHI accounts** can't remove those apps; remove them in **Server Settings** -> **Integrations**.

## Contact us

For questions about this integration, contact us at [support@oleria.com](mailto:support@oleria.com).


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