OpenClaw Discord Setup Guide: Bot Running in 6 Steps
OpenClaw was previously known as Clawdbot and Moltbot. This guide applies to all versions.
Set up OpenClaw on Discord step by step: create a bot, configure intents, set permissions, add the token, invite to your server, and send your first message.
Key takeaways
Create a Discord app, enable message content intent, hand the token to your OpenClaw (previously known as Clawdbot and Moltbot) agent, add the bot to your server, approve pairing. Six steps. One sitting. Your AI agent lives in Discord now.
Always review commands your agent suggests before approving them. Don't paste prompts from sources you don't trust.
Fixes when it breaks. Workflows when it doesn't.
OpenClaw guides, configs, and troubleshooting notes. Every two weeks.
Introduction
I had OpenClaw running on Telegram for weeks before I tried Discord. Telegram worked fine for quick messages. But I wanted my agent in the same place where my dev community already hangs out.
Turns out Discord is the most capable channel OpenClaw supports. DMs, server channels, threads, slash commands, interactive buttons, modal forms, role-based routing. See the OpenClaw channels overview for a full comparison. No other channel gives you all of that in one place.
The setup took me one sitting. No webhook configuration, no public IP, no OAuth flows. The Discord channel docs confirm the gateway connects outbound over a WebSocket, so there is nothing to expose.
What You Will Need
Before starting:
- OpenClaw installed and gateway running. If you need a server, see How I Finally Got OpenClaw Running 24/7: $6/Month on DigitalOcean (use this referral link for $200 in free credit).
- A Discord account. Free tier works fine.
- About 7 minutes.
If your gateway is not running yet, start it first.
The Discord connection needs a running gateway to work.
OpenClaw Starter Kit: If you are just getting started, the OpenClaw Starter Kit bundles config templates, workspace file examples, and skills we actively use. It covers the setup steps in this guide.
Step 1: Create a Discord Application
Discord bots live inside "applications" that you create in the Developer Portal.
- Go to discord.com/developers/applications
- Click New Application in the top right
- Give it a name (e.g., "My AI Assistant")
- Click Create
You're now on the application's settings page.
- Click Bot in the left sidebar
- Click Reset Token (or Add Bot if this is your first time)
- Copy the bot token that appears
The token looks like this: MTIzNDU2Nzg5.GhIJkL.abcDEFghiJKLmnoPQRstuVWXyz
Keep this token secret. Anyone with the token controls your bot.
If it leaks, reset it in the Developer Portal immediately.
Step 2: Enable Message Content Intent
Discord requires you to explicitly enable "privileged gateway intents" for your bot to read message content.
Without this, your bot receives messages but cannot see what anyone typed. This is a Discord requirement, not an OpenClaw limitation.
- Stay on the Bot page in the Developer Portal
- Scroll down to Privileged Gateway Intents
- Enable Message Content Intent
- Click Save Changes
That's it. One toggle.
Skip this and your bot will silently ignore every message. The OpenClaw Discord docs note this as the most common setup issue.
Step 3: Connect Your Discord Bot to OpenClaw
The simplest approach: tell your agent.
Message your agent through whatever channel is already working:
"Set up Discord with this bot token: MTIzNDU2Nzg5.GhIJkL.abcDEFghiJKLmnoPQRstuVWXyz"
Your agent will add the token to your OpenClaw config and restart the gateway. OpenClaw agents can modify their own config via the config.patch command. It will confirm when Discord is connected.
Alternative: Environment variable
You can set the token as an environment variable instead of pasting it in chat.
This is better for production setups.
The token stays in the environment, outside config files.
export DISCORD_BOT_TOKEN="MTIzNDU2Nzg5.GhIJkL.abcDEFghiJKLmnoPQRstuVWXyz"Add this to your shell profile (.bashrc, .zshrc) or systemd service file.
This makes it persist across restarts.
On most Linux servers, edit ~/.bashrc and add the export line at the bottom.
Then restart the gateway to pick up the new variable:
openclaw gateway restartThe gateway reads DISCORD_BOT_TOKEN from the environment at startup.
If both the env var and config file have a token, the config file takes precedence per the configuration reference.
Alternative: Config file
You can also edit the OpenClaw config file directly.
This approach works well if you manage config through version control or deployment scripts.
Edit openclaw.json and add the Discord channel block:
{
"channels": {
"discord": {
"enabled": true,
"token": "MTIzNDU2Nzg5.GhIJkL.abcDEFghiJKLmnoPQRstuVWXyz"
}
}
}Make sure you put the token in quotes.
The file must be valid JSON.
After saving, restart the gateway:
openclaw gateway restartCheck the logs to confirm the Discord channel started without errors:
openclaw logs --followStep 4: Add the Bot to Your Server
Before anyone can use your bot in a server, you need to invite it.
- Go back to your application in the Developer Portal
- Click OAuth2 in the left sidebar
- Under OAuth2 URL Generator, check the bot scope
- Under Bot Permissions, select at minimum:
- Send Messages
- Read Message History
- Use Slash Commands
- Copy the generated URL at the bottom
- Open that URL in your browser
- Select the server you want to add the bot to
- Click Authorize
The bot now appears in your server's member list.
Recommended permissions for full features
The minimum permissions above get you basic chat.
For the complete feature set, you'll want reactions, threads, and file sharing.
Add these permissions in the OAuth2 URL Generator:
- Send Messages (required for replies)
- Read Message History (required for context)
- Use Slash Commands (required for native commands)
- Add Reactions (for emoji reactions on messages)
- Create Public Threads (for thread-based conversations)
- Send Messages in Threads (for replying in threads)
- Manage Messages (for pin and delete actions)
- Attach Files (for sending images and documents)
- Embed Links (for rich link previews)
Moderation permissions (Kick Members, Ban Members, Moderate Members) are separate.
Only add them if you want your agent to moderate your server.
OpenClaw disables moderation actions by default.
You would need to explicitly enable them in your config file.
Step 5: Pair Your Discord Account
OpenClaw uses pairing to control who can talk to your bot.
This stops random users from consuming your AI credits if they find your bot.
- Open Discord
- Find your bot in the member list or search for it
- Send it a DM. "hello" works.
The bot replies with a pairing code:
Your pairing code is: ABC123 Approve this code to continue.
Now approve it.
Tell your agent through an existing channel:
"Approve Discord pairing code ABC123"
Or use the CLI directly:
openclaw pairing approve discord ABC123Once approved, the bot responds to your DMs.
For more on keeping your agent secure, see 7 Proven OpenClaw Security Fixes That Save Your Agent.
Step 6: Send Your First Message
With pairing approved, send a message to your bot:
"What can you help me with?"
Your agent responds through Discord.
That's the setup done. The first thing I did after connecting was ask it to summarize a long GitHub issue thread someone pasted in my server. It pulled the context, gave me the three key decisions, and I replied in under a minute. That is when it clicked. This is not a chatbot in a sidebar. It is a team member in the channel.
Troubleshooting
Bot Does Not Respond at All
- Check if the gateway is running:
openclaw gateway status - Check logs for errors:
openclaw logs --follow - Verify the token is correct in config or environment
Message Content Intent Not Enabled
Go back to Step 2.
Enable the Message Content Intent toggle in the Developer Portal.
This is the most common Discord setup issue.
Bot Responds in DMs but Not in Server
Guild messages are mention-gated by default.
You need to @mention the bot or reply to one of its messages.
If you set up an allowlist, make sure your guild ID is in channels.discord.guilds per the Discord config reference.
Slash Commands Not Appearing
Slash commands register on gateway startup.
Restart the gateway: openclaw gateway restart
It can take up to an hour for Discord to propagate slash commands globally.
401 Unauthorized in Logs
Token is wrong.
Go to the Developer Portal, reset the token, and update your config.
For more solutions, check the OpenClaw troubleshooting docs.
Optional: Server Configuration
If you plan to use the bot in Discord servers, you can fine-tune access control.
Guild allowlists
By default, when a channels.discord block exists in config, the guild policy is allowlist.
You need to explicitly list which servers the bot responds in.
Here's the config format:
{
"channels": {
"discord": {
"groupPolicy": "allowlist",
"guilds": {
"YOUR_GUILD_ID": {
"requireMention": true
}
}
}
}
}Find your guild ID by enabling Developer Mode in Discord settings.
Then right-click your server name and select "Copy Server ID".
Channel-specific access
Restrict the bot to specific channels within a server:
{
"channels": {
"discord": {
"guilds": {
"YOUR_GUILD_ID": {
"channels": {
"general": { "allow": true },
"help": { "allow": true, "requireMention": true }
}
}
}
}
}
}Channels not listed are denied.
Disable mention requirement
By default, your bot only responds in server channels when someone @mentions it or replies to one of its messages. This is the default mention-gating behavior. Good default for busy servers where you do not want the bot reacting to every conversation.
If you want the bot to respond to every message in a channel without needing an @mention, set requireMention to false:
{
"channels": {
"discord": {
"guilds": {
"YOUR_GUILD_ID": {
"requireMention": false
}
}
}
}
}Be careful with this in active servers.
Your agent will process and respond to every message.
That costs tokens and can be noisy.
This works best in small private servers or dedicated bot channels.
FAQ
Q: Can I use the same bot in multiple Discord servers?
Yes.
Add each guild ID to the guilds object in your config.
Each server gets its own isolated session, so conversations stay separate.
Q: Do I need a public IP or domain?
No.
OpenClaw connects outbound to Discord over a socket.
No ports to expose, no webhooks to configure. The Discord channel connects outbound over a WebSocket.
Q: How do I add more users?
Each new user goes through pairing.
They DM the bot, get a code, you approve it.
Or add their Discord user ID to channels.discord.allowFrom in config.
Q: What are slash commands and how do they work?
OpenClaw registers native Discord slash commands automatically when the gateway starts.
Users type / in any channel where the bot is present to see available commands. Each slash command runs in its own isolated session, separate from regular chat.
If commands look stale or outdated, restart the gateway to re-register them with Discord.
Q: Can I use Discord and Telegram at the same time?
Yes.
OpenClaw runs multiple channels simultaneously.
Configure both, and the gateway routes messages to the right channel automatically.
See OpenClaw Telegram Setup in 5 Minutes for the Telegram side.
Sources
- OpenClaw Discord Documentation - Official setup and configuration reference
- Discord Developer Portal - Application and bot management
- Discord API Documentation - Complete API reference
- OpenClaw Configuration Reference - Full config options
Conclusion
Six steps and your AI agent lives in Discord.
- Created an application in the Developer Portal
- Enabled the message content intent
- Connected the bot token to OpenClaw
- Added the bot to your server
- Approved the pairing code
- Sent your first message
I started with DMs and expanded to server channels within a day. The slash commands, thread support, and interactive buttons make Discord the channel I use most now. It went from "another integration" to the place where my agent does real work.
Next step: lock down your setup with 7 Proven OpenClaw Security Fixes.
Or set up Telegram as a second channel for mobile access when you are away from the desktop.
Changelog
- 2026-02-16: Initial publication
- 2026-02-25: Added changelog, structural improvements
- 2026-03-22: Added resource link to OpenClaw Starter Kit
Fixes when it breaks. Workflows when it doesn't.
OpenClaw guides, configs, and troubleshooting notes. Every two weeks.



