docs/usage/channels/discord.mdx
By connecting a Discord channel to your LobeHub agent, users can interact with the AI assistant directly through Discord server channels and direct messages.
Visit the Discord Developer Portal and click New Application. Give your application a name (e.g., "LobeHub Assistant") and click Create.
In the left sidebar, click Bot. Customize the bot's username and avatar as needed.
On the Bot settings page, scroll down to Privileged Gateway Intents and enable:
Click Save Changes.
On the Bot page, click Reset Token to generate your bot token. Copy and save it securely.
Important: Treat your bot token like a password. Never share it publicly or commit it to version control.
Go to General Information in the left sidebar. Copy and save:
You will need all three values (Bot Token, Application ID, Public Key) in the next step. </Steps>
In LobeHub, navigate to your agent's settings, then select the Channels tab. Click Discord from the platform list.
Enter the following fields:
Your token will be encrypted and stored securely.
Click Save Configuration. Your credentials will be saved and LobeHub will start listening for Discord events. </Steps>
In the Discord Developer Portal, go to OAuth2 → URL Generator. Select the following scopes:
botapplications.commandsUnder Bot Permissions, select:
Copy the generated URL, open it in your browser, select the server you want to add the bot to, and click Authorize. </Steps>
Back in LobeHub's channel settings for Discord, click Test Connection to verify everything is configured correctly. Then send a message to your bot in Discord to confirm it responds.
LobeHub gates inbound traffic with three layered settings, all under Advanced Settings and all defaulting to permissive.
A global user-level gate. When populated, only the listed users can interact with the bot — DM, group @mention, threads, all of it — regardless of DM Policy / Group Policy mode. Empty means "no user-level filter; let per-scope policies decide". Right-click a user → Copy User ID (Developer Mode must be enabled in Settings → Advanced) to grab an ID.
DMs from non-allowlisted users get a "you aren't authorized" notice. Group @mentions from non-allowlisted users get the same kind of notice posted inside the auto-created reply thread Discord makes for the @-mention — the parent channel stays quiet.
Controls 1:1 direct messages.
Open only when the list is empty: Allowlist fails closed (no DMs), Open still lets anyone DM.Discord bots can be reached by anyone in any shared server, so consider populating Allowed User IDs or switching DM Policy to Disabled if your bot is meant to be private.
Controls @mentions in server channels and threads.
The two policies are independent. You can run a DM-only bot with
groupPolicy=disabled, a channel-only bot withdmPolicy=disabled, or scope both with allowlists.
See the Channels overview for cross-platform details.
| Field | Required | Description |
|---|---|---|
| Application ID | Yes | Your Discord application's ID |
| Bot Token | Yes | Authentication token for your Discord bot |
| Public Key | Yes | Used to verify interaction requests from Discord |
| Allowed User IDs | No | Comma- or whitespace-separated Discord user IDs. Global gate — applies to DMs and group @mentions |
| DM Policy | No | open (default), allowlist, or disabled — who is allowed to DM the bot |
| Group Policy | No | open (default), allowlist, or disabled — where the bot responds to @mentions |
| Allowed Channel IDs | No | Comma- or whitespace-separated Discord channel IDs. Used when Group Policy is Allowlist |
Disabled or Allowlist, double-check the channel is in Allowed Channel IDs. If Allowed User IDs is set, the sender's user ID must be in it.Disabled. If Allowed User IDs is set, make sure the sender's Discord user ID is in it.