OpenClaw can respond to messages in your Discord server, DMs, and threads. Getting the openclaw discord connection working requires a Discord bot application, a bot token, and the right config entries. This article walks through every step of the openclaw discord integration from creating the application to confirming the bot is live and responding.
TL;DR
- Step 1: Create a Discord application and bot at discord.com/developers/applications.
- Step 2: Enable Message Content Intent and copy the bot token.
- Step 3: Add the bot to your server with the correct permissions.
- Step 4: Add the token to openclaw.json under channels.discord.
- Step 5: Restart the gateway and test.
Throughout this article you will see indented blocks like the ones below. Each one is a command you can paste directly into your OpenClaw chat. Your agent will run it and report back. You do not need to open a terminal or edit any files manually.
Before you start
You need a Discord account with permission to add bots to the server you want to use for the openclaw discord bot setup. If you are the server owner, you already have this. If you are not the owner, you need the Manage Server permission or a role that includes it.
You also need access to your OpenClaw config file, either directly or through your agent. If you can send commands to your agent, you have what you need , the agent can read and write its own config for you.
Read my openclaw.json and tell me: is a Discord channel already configured? If so, show me the current channels.discord section (redact the token). If not, confirm Discord is not yet set up.
If Discord is already partially configured from a previous attempt to connect OpenClaw to Discord, skip to the section that covers what is missing. If it is not configured at all, start from the top.
Step 1: Create the Discord application
Go to discord.com/developers/applications (the Discord Developer Portal) and log in with your Discord account. Click New Application in the top-right corner. Give it any name , this is the application name, not the bot username. The name can be anything; most people use the same name they plan to use for the bot.
Click Create. You will land on the application’s General Information page. The application ID shown here is not what you need yet , that comes later.
One application, one bot
Each Discord application has exactly one bot user associated with it. If you want OpenClaw to appear as a different bot in a different server, you need a separate application for it. You cannot share one bot token across multiple OpenClaw instances on different machines , doing so causes the two instances to compete for incoming messages and both will behave unpredictably.
Step 2: Create the bot and copy the token
In the left sidebar, click Bot. Click Add Bot, then confirm. The bot user is now created.
On the Bot page, scroll down to Privileged Gateway Intents. Enable Message Content Intent. Without this, your bot can see that messages exist but cannot read what they say. OpenClaw needs to read message content to function. Save the changes.
Message Content Intent is required
If you skip this step, your agent will receive events for every message but the content field will be empty. The bot will appear online and receive events but produce no responses. This is one of the most common reasons a newly set-up Discord bot appears to do nothing.
Scroll back up to the Token section. Click Reset Token (or Copy if this is a fresh bot). Confirm the reset if prompted. Copy the token immediately , Discord will only show it once. Store it somewhere safe before proceeding.
Treat the token like a password
Anyone with the bot token can control the bot entirely. Do not paste it into a chat message, a GitHub repository, or any file that is not the openclaw.json config. If you accidentally expose the openclaw discord bot token, reset it immediately on the Discord developer portal , this invalidates the old token instantly.
Step 3: Add the bot to your server
In the left sidebar, click OAuth2, then URL Generator. This generates the invite URL for adding your openclaw Discord bot to a server. Under Scopes, check bot. Under Bot Permissions, check the permissions your bot needs:
- Read Messages / View Channels , required to see channels and messages
- Send Messages , required to respond
- Read Message History , required for context on replies
- Add Reactions , used for acknowledgment reactions (optional but recommended)
- Embed Links , used for formatted responses (optional)
Copy the Generated URL at the bottom of the page. Open it in a browser, select your server from the dropdown, and click Authorize. The bot will appear in your server’s member list, shown as offline until OpenClaw connects for the first time after config.
Administrator permission is not recommended
Granting the bot Administrator permission makes openclaw discord bot setup marginally easier but gives the bot account full control over your server, which is a significant risk for any connected service including OpenClaw. Use the minimum permissions the bot actually needs. If the bot token is ever compromised, an attacker with Administrator access can read all channels, delete messages, create invite links, and modify roles.
Step 4: Add the token to OpenClaw config
Now that the bot exists and is in your server, tell OpenClaw to use it. The token goes in the config under channels.discord. This is the step where the openclaw discord bot token you copied earlier gets wired into the system.
Update my openclaw.json to add Discord channel config. Set channels.discord.enabled to true. Set channels.discord.token to [paste your token here]. Set channels.discord.dmPolicy to “allowlist”. Set channels.discord.allowFrom to an array containing my Discord user ID. Do not apply the config yet , show me the full channels.discord section you would write.
When the agent shows you the config block, verify:
- The token is correct (matches what you copied from the developer portal)
dmPolicyis set ,"allowlist"means only users inallowFromcan DM the bot, which prevents strangers from controlling your agentallowFromcontains your Discord user ID (not your username , the numeric ID)
To find your Discord user ID: in Discord settings, go to Advanced and enable Developer Mode. Then right-click your username anywhere and select Copy User ID.
Apply the Discord channel config to openclaw.json. Once applied, confirm the config was saved correctly by reading back channels.discord (redact the token) and restarting the gateway.
Step 5: Restart the gateway and test
After the config is saved, the gateway needs to restart to load the Discord channel plugin and connect to Discord’s gateway. This is the final step of the openclaw connect Discord process. If you applied the config through your agent, the restart may have already happened. Verify by checking the bot’s status in your Discord server , it should now show as online.
Check the current gateway status. Is the Discord channel plugin loaded and connected? Is the bot showing as online? If the gateway has not restarted since the config change, restart it now.
Once the bot is online, send it a direct message from Discord: type something simple like “hello” or “ping”. The bot should respond within a few seconds.
Test the Discord connection by sending a test message through the Discord channel. Confirm the channel is receiving and processing messages correctly.
If the bot does not respond, work through the troubleshooting section below before making any config changes.
Configuring server channel access
By default, groupPolicy controls how the bot responds in server channels (not DMs). The two most common settings are "allowlist" and "off".
- “off” , the bot does not respond in server channels at all. DMs only. This is the safest default for a personal agent.
- “allowlist” , the bot responds in server channels only when messages come from users listed in
allowFrom.
Update channels.discord.groupPolicy to “allowlist”. This means the bot will respond to server messages only from users in allowFrom. Confirm the updated config before applying.
If you want the bot to respond to everyone in the server (for a shared assistant setup), set groupPolicy to "all". Be aware this means any server member can interact with your agent. If your agent has access to sensitive tools or files, restrict access before enabling this.
Exec approvals on Discord
OpenClaw can be configured to require your approval before running shell commands when the request comes through Discord. This is controlled by channels.discord.execApprovals.
Show me the current channels.discord.execApprovals config. Is exec approval required for Discord? Who is listed as an approver?
When exec approvals are enabled, the agent will send you an approval prompt in Discord before running any shell command. You reply with the approval code to allow it or deny it. This is the recommended setting , it gives you a real-time checkpoint on anything that touches the server, without requiring you to be at a terminal.
Enable exec approvals for Discord. Set channels.discord.execApprovals.enabled to true and set channels.discord.execApprovals.approvers to an array containing my Discord user ID. Show me the config before applying.
Troubleshooting: bot is online but not responding
The most common cause: the user sending the message is not in allowFrom. Check your user ID against the config.
Read channels.discord.allowFrom from my openclaw.json. Does it contain my Discord user ID [your-id]? If not, add it and restart the gateway.
Second most common cause: Message Content Intent is not enabled. The bot receives events but the content is empty, so the agent sees an empty message and does nothing. Go back to the developer portal, navigate to Bot, and verify Message Content Intent is toggled on. Changes on the portal take effect immediately , no gateway restart needed.
Third cause: the bot is in the server but not in the specific channel. Discord bots must have view and send permissions for each channel they operate in. Check the channel permissions and ensure the bot role has Read Messages and Send Messages enabled for that channel.
Check the gateway logs for Discord channel errors. Are there any authentication failures, intent errors, or “missing access” errors? Show me the last 20 lines of relevant Discord plugin log output.
Troubleshooting: bot shows as offline
If the bot appears offline in your server, the gateway has not successfully connected to Discord. Possible causes:
- Token is wrong: A typo in the token or a trailing space. Reset the token on the developer portal and copy it fresh.
- Gateway has not restarted: Config changes require a gateway restart. If you added the token but the bot is still offline, restart the gateway.
- channels.discord.enabled is false: Check the config , the entire channel block may be present but disabled.
- Discord API outage: Check discordstatus.com to rule out a platform-side issue.
Read my openclaw.json. Is channels.discord.enabled set to true? Is there a token present? Restart the gateway and tell me whether the Discord plugin loads successfully on startup.
Using the bot in multiple servers
A single bot token works across multiple servers, which is one of the conveniences of the openclaw discord integration. If you have added the openclaw discord bot to more than one server, it will be present in all of them simultaneously and active in each. The allowFrom list controls which users can interact with it regardless of which server they are in.
If you want to restrict the bot to specific servers rather than all servers it has been added to, you can use allowedGuilds in the Discord channel config. Only messages from the listed guild (server) IDs will be processed.
What is the guild ID of my Discord server? I want to restrict my OpenClaw bot to respond only in that specific server. Show me the config change needed to add allowedGuilds restriction, but do not apply it yet.
To find a server’s guild ID: right-click the server name in Discord with Developer Mode enabled and select Copy Server ID.
How the Discord connection works
When OpenClaw connects to Discord using the openclaw discord bot setup process, it opens a persistent WebSocket connection to Discord’s gateway API. This is the same mechanism Discord uses for all bots and applications. The connection stays open as long as the OpenClaw gateway process is running. Messages sent to your bot in DMs or in server channels flow through this WebSocket connection to the OpenClaw channel plugin, which routes them to the agent for processing.
This means the connection depends entirely on the OpenClaw process staying running. If the gateway restarts or the server reboots, the bot will briefly go offline, reconnect, and come back. Messages sent during the gap are not queued by Discord for later delivery to the bot , they are lost. For most personal agent setups with the openclaw discord integration, this is perfectly acceptable. For setups where messages must not be missed, configure the OpenClaw gateway as a systemd service so it restarts automatically after any interruption.
Is the OpenClaw gateway running as a systemd service? Run: systemctl is-active openclaw and report back. If it is not active or the command returns an error, show me what process is running the gateway instead.
Discord permissions: what each one actually does
Discord’s permission system applies at two levels: the role level (permissions granted to the bot role when you authorize it) and the channel level (permissions for that role in specific channels). A bot can have Send Messages permission at the role level but still be blocked from specific channels if the channel has an override that denies it.
For OpenClaw to function in a server channel, the bot needs all of the following at both levels:
- View Channel (Read Messages): Without this, the bot cannot see the channel exists. It will not receive events for messages in that channel at all.
- Read Message History: Without this, the bot cannot fetch previous messages for context. Replies and thread context will not work correctly.
- Send Messages: Without this, the bot can receive messages but cannot respond. The attempt to send a response produces a “Missing Permissions” error in the logs.
- Add Reactions: Used for acknowledgment reactions. If the bot cannot add reactions, the acknowledgment step is skipped silently.
Check whether my OpenClaw bot has the correct permissions in [channel-name]. Specifically: can it view the channel, read message history, send messages, and add reactions? Report any missing permissions and what effect they have.
If the bot has the correct role-level permissions but is still blocked in a specific channel, the channel has an explicit permission override. In the Discord server settings, go to the channel, edit its permissions, find the bot’s role, and verify none of the required permissions are set to the red X (denied) state.
Response streaming and message length
By default, OpenClaw sends Discord responses as complete messages rather than streaming them in chunks as they are generated. This means you will see nothing for a few seconds, then the full response arrives at once. For short responses this is fine. For long responses, it can look like the bot is unresponsive.
The streaming setting for Discord is controlled by channels.discord.streaming. The options are "off" (send complete messages), "partial" (send a placeholder and edit it as the response comes in), and "full" (stream tokens as they arrive, where supported).
What is the current channels.discord.streaming setting? If it is set to “off”, update it to “partial” so that I can see a placeholder while longer responses are generating. Show me the updated config before applying it.
Discord has a 2,000 character message length limit that applies to all bots including OpenClaw. When an OpenClaw response exceeds this limit, the channel plugin automatically splits it into multiple messages. If you are seeing responses split mid-sentence, this is why. It is normal behavior, not a bug.
Threads and reply handling
OpenClaw can operate in Discord threads as well as regular channels as part of the full openclaw discord bot setup. When a thread is created, the bot can read and respond in the thread as long as it has View Channel and Send Messages permissions for the parent channel. Thread access is inherited from the parent channel’s permissions.
Can my OpenClaw bot respond in threads in [channel-name]? Is there any additional permission configuration needed for thread access, or does it inherit from the parent channel?
Reply threading behavior in OpenClaw is controlled by whether the agent quotes the original message. When you send a message and the agent replies, the reply is associated with your message in Discord’s UI. This is the default behavior and generally produces cleaner conversation flow in active channels.
Security considerations for the Discord integration
Connecting OpenClaw to Discord adds a messaging surface that accepts commands and can trigger tool calls. How you configure access to this surface determines the security posture of the entire openclaw discord integration. The security posture of your Discord integration determines who can do what to your agent from Discord.
The minimum recommended settings for a personal agent:
dmPolicy: "allowlist"with only your user ID inallowFromgroupPolicy: "allowlist"or"off"execApprovals.enabled: truewith your user ID as the only approver
Audit my Discord channel security config. Check: dmPolicy, groupPolicy, allowFrom, execApprovals settings. Are any of these set to values that would allow untrusted users to send commands to my agent? Report any settings that do not match the minimum recommended config above.
If you ever need to temporarily disconnect the openclaw discord bot without removing it from your server, set channels.discord.enabled to false and restart the gateway. The bot will go offline but remain in the server. Re-enable and restart to bring it back.
Show me how to temporarily disable the Discord channel in OpenClaw without removing the bot from my server or losing any config settings. I want to be able to re-enable it quickly.
Verifying the complete setup
Once all the steps above are complete, run through this openclaw discord connect verification checklist to confirm everything is working correctly before relying on the integration for day-to-day use:
- Bot appears online in server member list
- DM from your account gets a response
- Message in a server channel gets a response (if groupPolicy allows it)
- Message from a different Discord account gets no response (allowFrom is working)
- Exec approval prompt appears in Discord when a command requires approval
- Gateway survives a restart and reconnects to Discord automatically
Run the full Discord integration verification checklist. Check: gateway status, Discord plugin loaded, bot online status, last message received from Discord, execApprovals config. Report pass or fail for each item.
If all items pass, the openclaw discord bot setup is fully operational and ready for daily use. If any item fails, the troubleshooting sections above cover the most likely causes for each failure mode.
Discord rate limits and what they mean for your bot
Discord enforces rate limits on bot API calls. The most relevant limits for an OpenClaw setup are the message send rate limit (5 messages per 5 seconds per channel by default) and the global rate limit (50 requests per second across all Discord API calls). For a personal agent responding to one user, these limits are essentially impossible to hit under normal usage.
The scenario where openclaw discord rate limits appear is rapid automated messaging, like a cron job that sends a report to multiple Discord channels in quick succession. If you have multiple cron jobs all set to deliver to Discord at the same time, they may hit the per-channel rate limit briefly. The OpenClaw Discord plugin handles rate limit responses automatically by waiting and retrying, so messages are not lost, just slightly delayed.
Do any of my cron jobs deliver to Discord? If multiple jobs are scheduled at the same time and all deliver to the same Discord channel, could they hit Discord’s message rate limit? Show me any cron jobs that deliver to Discord and their scheduled times.
If you have multiple cron jobs delivering to the same Discord channel at the same interval, stagger their schedule times by at least 30 seconds. This is not a hard requirement, but it prevents any brief queuing of messages that can make responses look inconsistent.
Rotating your bot token safely
If your bot token is ever exposed (committed to git, shared in a message, visible in a screenshot), reset it immediately. Token rotation on Discord is instant: the old token stops working the moment you reset, and the new token is valid immediately. For an openclaw discord bot token, rotating takes less than two minutes end to end.
The process: go to discord.com/developers/applications, select your application, go to the Bot section, click Reset Token, confirm, copy the new token. Then update openclaw.json with the new token and restart the gateway.
I need to rotate my Discord bot token. I have already reset it on the Discord developer portal and have the new token ready. Update channels.discord.token in openclaw.json with the new token value [paste new token], then restart the gateway. Confirm the bot comes back online after the restart.
After rotating, verify the old token is actually invalid. If someone was using it to control your bot, their access ends the moment you reset. Check your server’s audit log (Server Settings, Audit Log) for any unexpected actions, role changes, or channel modifications during the period the openclaw discord bot token may have been exposed.
Check git history after any accidental exposure
If the token was committed to a git repository, removing it from the current version is not enough. The token will still be visible in the commit history. Reset the token on Discord immediately, then use git filter-branch or the BFG Repo Cleaner to purge the token from history if the repository is public.
Common setups and when to use each
Three setups cover the majority of personal and small-team OpenClaw deployments on Discord:
Setup A: personal assistant, DMs only
Best for: one operator who wants to control their agent from anywhere without giving anyone else access.
dmPolicy: "allowlist"with your user IDgroupPolicy: "off"execApprovals.enabled: true
The bot ignores all server channel messages and only responds to DMs from your account. No one else in the server can interact with it.
Setup B: personal assistant, DMs plus one private channel
Best for: operators who want to use a specific server channel as a command terminal while keeping the bot locked to one user.
dmPolicy: "allowlist"with your user IDgroupPolicy: "allowlist"with your user IDexecApprovals.enabled: true
Add the bot to a private channel that only you can see. The bot responds in that channel and in DMs. Server members who cannot see the channel do not know the bot is there.
Setup C: shared assistant for a small team
Best for: small teams where all members should be able to query the agent but only an administrator should be able to run exec commands.
dmPolicy: "allowlist"with all team member IDsgroupPolicy: "allowlist"with all team member IDsexecApprovals.enabled: truewith only the admin’s ID as approver
All listed team members can query the agent. Exec commands require the admin to approve, regardless of who issued the command.
Which of these three Discord setups matches what I want? Based on my current config, which setup am I closest to, and what changes would bring me to my target setup?
Keeping the connection stable long-term
A Discord bot connection is reliable as long as the underlying process stays stable, and for the openclaw discord bot setup this means keeping the gateway healthy. For day-to-day use, the main risk is the OpenClaw gateway process stopping unexpectedly, either from a server restart, an out-of-memory kill, or a crash. If this happens, the bot goes offline until the process restarts.
Three practices that keep the openclaw discord connection stable over weeks and months:
- Run as a systemd service with restart on failure. If the gateway crashes, systemd brings it back automatically. The bot goes offline for 10 to 30 seconds and then reconnects. Without this, a crash means the bot stays offline until you notice and restart manually.
- Monitor the bot status in your weekly health check. Add a check to your regular cron health report: is the Discord plugin currently connected? A brief disconnect is normal; the openclaw discord bot being offline for hours without you knowing is a reliability problem worth catching early.
- Keep the server’s memory usage below 80%. OOM (out-of-memory) kills are a common cause of unexpected process termination on VPS instances running OpenClaw. If the server is memory-constrained and running multiple Ollama models, the gateway process may be killed to free memory. Check memory usage after any unexplained disconnect.
Check whether the OpenClaw gateway is configured to restart automatically if it crashes. Is it running as a systemd service with Restart=on-failure? If not, show me what I need to add to the service file to enable automatic restart.
Discord also enforces periodic reconnections on long-lived bot connections, usually every few hours. This is handled transparently by the Discord plugin, the bot reconnects without losing any queued messages. You may see the bot briefly appear offline in your server member list during these reconnections. This is normal and requires no action.
Frequently asked questions
Can I use the same bot token for multiple OpenClaw instances?
No. Each active connection to Discord using the same token causes the previous connection to be dropped. If you run two OpenClaw instances with the same token, they will fight over the connection and both will be unreliable. Create a separate application and bot token for each OpenClaw instance.
Does the bot need to be in a server to receive DMs?
Yes. Discord requires a bot to share at least one server with a user before that user can DM the bot. If you remove the bot from all shared servers, DMs will stop working. Keep the bot in at least one server that you are also a member of.
What is the difference between dmPolicy and groupPolicy?
dmPolicy controls who can send the bot direct messages. groupPolicy controls who the bot responds to in server channels. They are independent settings. A common setup: dmPolicy “allowlist” (only you can DM the bot) and groupPolicy “off” (the bot does not respond in server channels at all).
My bot is responding to itself and looping. How do I stop it?
OpenClaw ignores messages from its own bot user by default. If looping is happening, it is usually because a second bot in the same channel is replying to OpenClaw’s messages and OpenClaw is replying back. The fix is to ensure the second bot’s messages are not being processed by OpenClaw. Check allowFrom , if it is set to “all”, narrow it to specific user IDs only.
How do I change the bot’s username or avatar?
Username and avatar are set on the Discord developer portal under the Bot section, not in OpenClaw config. Changes on the portal take effect immediately across all servers. OpenClaw has its own identity config (name, emoji, avatar) for internal display purposes, but those do not affect how the bot appears in Discord.
The bot stopped responding after working fine for a few days. What happened?
The most likely causes are: the bot token was reset (either by you or by Discord if it was exposed), Discord changed the bot’s intents or permissions, or the gateway process stopped running. Check the gateway status first, then verify the token is still valid on the developer portal.
Can I have the bot respond only when mentioned, not to every message?
Yes. Set channels.discord.requireMention to true in the config. The bot will only process messages that explicitly mention it. This is useful in active servers where the bot should only respond when called, not to every conversation.
