Table of Contents
- Video walkthrough
- Step 1: Create a Discord application (bot setup)
- Step 2: Invite the bot to your Discord server
- Step 3: Enable Developer Mode and copy your IDs
- Step 4: Allow DMs from server members
- Step 5: Configure OpenClaw for Discord
- Option A: Configure via config.json
- Option B: Configure via CLI
- Step 6: Test and pair
- A) Send a test message (optional)
- B) Pair via DM
Do not index
OpenClaw can integrate with Discord to send messages, reply to threads, add reactions, manage roles, and run slash commands. This guide walks you through connecting a Discord bot to OpenClaw so your agent can respond in a server or via DM.
Video walkthrough

Step 1: Create a Discord application (bot setup)
Discord bots run under an “Application” in the Discord Developer Portal.
- Go to the Discord Developer Portal and sign in.
- Click New Application.
- Name it something like “OpenClaw Bot”.
- Accept the terms.
- In the left sidebar, open Bot.
- Click Add Bot → Yes, do it!
- Under Token, click Copy (or Reset Token if needed). Keep this secret.
- Under Privileged Gateway Intents, enable Message Content Intent (required to read message content).
- Optional: Turn Public Bot off if you want a private bot, and set avatar/description.
- In the left sidebar, open OAuth2 → URL Generator.
- Scopes: select
botandapplications.commands. - Bot Permissions (pick what you need):
- Core:
View Channels,Send Messages,Read Message History - Optional:
Add Reactions,Manage Messages,Embed Links,Manage Roles - Copy the generated URL (you’ll use it to invite the bot).
Step 2: Invite the bot to your Discord server
- Paste the OAuth2 URL you generated into a browser.
- Select the server.
- Click Authorize.
- Confirm the bot appears in your server.
- You can verify under Server Settings → Integrations → Bots.
Step 3: Enable Developer Mode and copy your IDs
You’ll need IDs for the server and your user.
- In Discord, go to User Settings (gear) → Advanced → enable Developer Mode.
- Right-click your server icon → Copy Server ID.
- Right-click your own user → Copy User ID.
Save these along with your bot token:
- Bot Token
- Server ID
- User ID
Step 4: Allow DMs from server members
This makes it easier to pair/test via DM.
- Right-click your server icon → Privacy Settings.
- Turn on Direct Messages.
Step 5: Configure OpenClaw for Discord
- Go to the Agent37 dashboard.
- Open an existing instance (or create a new one).
- Open Terminal.
Option A: Configure via config.json
Edit (or create)
~/.openclaw/config.json:{
"channels": {
"discord": {
"enabled": true,
"token": "your-bot-token-here"
}
}
}Option B: Configure via CLI
openclaw config set channels.discord.token "your-bot-token"
openclaw config set channels.discord.enabled true
openclaw gatewayIf OpenClaw is already running as a background service, use:
openclaw gateway restartStep 6: Test and pair
A) Send a test message (optional)
openclaw message --action send --channel discord --target "your-channel-id" --message "Hello from OpenClaw!"- Replace
your-channel-idwith a real channel ID (e.g.,1234567890123456789).
B) Pair via DM
- DM your bot: “Hello from OpenClaw”.
- The bot responds with a pairing code.
- In your instance terminal, approve it:
openclaw pairing approve discord <CODE>You should now be able to chat with your OpenClaw agent in Discord via DM.
When prompted by your agent, send:
“I already set my Discord bot token in config. Please finish Discord setup with User ID
<user_id> and Server ID <server_id>.”Your Discord bot is now connected successfully.