Integrate with Discord
To chat with your agent remotely, connect it to a Discord bot.
Prerequisites
- Discord account: Required to create the bot application.
- Discord server: A server where you have permissions to add bots.
Step 1: Create a Discord bot
Log in to the Discord Developer Portal with your Discord account.
Click New Application.

Enter a name for the new app, agree to terms, and then click Create.

From the left sidebar, select Bot.
Scroll down to the Privileged Gateway Intents section and enable the following settings:
- Presence Intent
- Server Members Intent
- Message Content Intent
Click Save Changes.
Scroll up to the Token section, click Reset Token, and then copy the generated token for your Discord bot. You need the token for channel configuration later in Control UI.

Step 2: Invite the bot to server
From the left sidebar, select OAuth2, and then find the OAuth2 URL Generator section:
a. In Scopes, select Bot and applications.commands.

b. In Bot Permissions, set as the following image. You can modify the settings later.

Copy the Generated URL at the bottom.
Paste the URL into a new browser tab, select your Discord server, and then click Authorize. The bot is added to your server.

Step 3: Configure channel
Connect OpenClaw to your Discord bot by adding its configuration in the Control UI.
About channel configuration
This tutorial provides the basic setup to get your bot running in Discord quickly. For more detailed configurations, see the official OpenClaw documentation.
Return to the Control UI > Config > Raw tab.
Add the following
channelssection to the configuration file.This configuration enables Discord Direct Messages (DMs) and sets the DM policy to pairing for security.
json"channels": { "discord": { "enabled": true, "token": "{YOUR_BOT_TOKEN}", "allowBots": true, "dm": { "enabled": true, "policy": "pairing" } } },
Replace
{YOUR_BOT_TOKEN}with your Discord bot token.Click Save.
From the left sidebar, select Channels. On the Discord card, Probe ok indicates successful connection.

Step 4: Authorize your account
For security, the bot does not talk to unauthorized users. You must pair your Discord account with the bot.
Open Discord and send a Direct Message to your new bot. The bot will reply with an error message containing a Pairing Code.
Open the OpenClaw CLI and enter the following command:
bashopenclaw pairing approve discord {Your-Pairing-Code}Once approved, you can start chatting with your agent in Discord.