# How do you connect OpenClaw to Discord?

Create a bot in the Discord Developer Portal, turn on Message Content Intent, give OpenClaw the token, then pair by DM. Then see server channels, threads and fixes.

Tool: OpenClaw. By Michel Lieben. Updated 2026-12-05. Source: https://coldiq.com/university/openclaw/openclaw-discord

## In short

- OpenClaw talks on Discord through a bot that you create in the Discord Developer Portal.
- The bot needs the Message Content Intent (the right to read message text) for messages in a server.
- Your first DM returns a pairing code, valid for 1 hour, that you approve with openclaw pairing approve discord.
- Server access is a separate setting: list the server ID, and the user IDs that may use the bot.
- Each Discord channel has its own conversation, so one server can hold one channel per subject.

## Steps

1. Create an application and a bot at discord.com/developers, and copy the token.
2. Invite it to your own server with a small set of permissions.
3. Add the token to OpenClaw, send the bot a DM and approve the code.

## Why use Discord, and how can a small team organize it?

Discord gives each subject its own room. In OpenClaw, every channel of a server is a separate session (a conversation with its own memory of what was said). You can keep one for research, one for content and one for reports, and they do not mix.

It also offers threads, slash commands, buttons and voice channels. For a single person who wants the shortest setup, Telegram asks for less.

Keep the server private and the list of users short. Give each channel one job and write that job in the first message.

- #research: paste a company website, receive a short brief with links.
- #content: paste a draft, receive corrections as a list.
- #reports: the only place where scheduled results arrive.
- #sandbox: try new prompts, with nothing real in it.

Tip: A message from another member, or text in a page it reads, can try to give the assistant orders. Keep the tools of a shared channel small, and ask for approval before commands.


## How do you create the Discord bot?

Make a private server for yourself first, so nobody else is in the room while you test.

1. Open discord.com/developers, select New Application and give it a name.
2. Open Bot and set its username.
3. Under Privileged Gateway Intents, turn on Message Content Intent. Server Members Intent is recommended too.
4. Select Reset Token and copy the token. Keep it secret: it controls the bot.
5. Open OAuth2, then the URL Generator. Check bot and applications.commands.
6. Choose the permissions: View Channels, Send Messages, Read Message History, Embed Links and Attach Files. Add Send Messages in Threads if you use threads.
7. Open the link at the bottom and invite the bot to your server.

Tip: Do not give the bot the Administrator permission. The list above is enough to read, reply and send files.


## How do you give the token to OpenClaw?

Put the token in the environment variable DISCORD_BOT_TOKEN (a named value that programs can read), or in the file ~/.openclaw/.env. Then enable the channel in the settings and point it to that variable, so the token is not written in the settings file.

The docs use a small patch file for this. It holds one block: channels, discord, enabled set to true, and a token that refers to DISCORD_BOT_TOKEN. Test the file before you apply it.

1. Run openclaw config patch --file ./discord.patch.json5 --dry-run and read the result.
2. Run the same command without --dry-run.
3. Start the Gateway with openclaw gateway, or restart it if it runs already.

Tip: Never paste the token in a chat with the assistant, or in a Discord message. If it leaks, reset it in the portal and update the variable.


## How do you pair and send the first message?

Your server must allow direct messages from its members. Right-click the server icon, open Privacy Settings, and turn on Direct Messages.

Send the bot a DM. It answers with a code. Run openclaw pairing list discord, then openclaw pairing approve discord <CODE>. The code is valid for 1 hour. From then on, you can talk to it in that DM.


## How do you use it in server channels?

A server is called a guild in the settings. The safe setup is an allowlist: the bot works in the servers you list, for the people you list.

You need two IDs. Turn on Developer Mode in User Settings, then right-click your server and your name to copy them. In the settings, set groupPolicy to "allowlist", and add your server ID under guilds, with requireMention true and your user ID in users.

On a private server where you are alone, you can turn the mention rule off, so that it answers each message: openclaw config set 'channels.discord.guilds.YOUR_SERVER_ID.requireMention' false.

- If you add one channel entry under a server, that list becomes the only list of allowed channels.
- Long-term memory (MEMORY.md) loads automatically in DMs only. Put what every channel must know in AGENTS.md or USER.md.
- The last 20 messages of a channel are used as context by default.


## What can it do inside Discord?

Slash commands such as /status, /new and /model work natively. Their replies are visible to you only. A thread takes the settings of its parent channel and can keep its own session.

Messages are cut at 2,000 characters, which is Discord’s limit, and files can be up to 100 MB by default. Sensitive actions such as roles, moderation and presence are off until you enable them.

Voice is optional. Turn it on in the settings, give the bot Connect and Speak permissions, choose a realtime voice provider, then use /vc join.


## Why does the bot not answer?

Most problems come from three places: intents, the allowlist or the mention rule.

- “Disallowed intents” at startup: an intent is used but not turned on in the portal. Turn it on and restart the Gateway.
- It answers DMs but not the server: check groupPolicy, the server ID, your user ID and the mention rule.
- It ignores one channel: a channel list exists and this one is not in it.
- No pairing code: direct messages are closed for that server, or the code request is still pending.
- It answers other bots in a loop: set allowBots to false.
- You changed the token: policy changes apply at once, but a new token needs a restart.

Tip: Use IDs and not names. Matching by name is off by default, since a name can change.


## Command

```
openclaw pairing approve discord <CODE>
```

## What to say

> This channel is only for outbound research. Remember it. When I paste a company website here, reply with what they sell, who they sell to, one recent change with its link, and one question I could ask them. Never contact anyone.

## Sources

- [OpenClaw docs: Discord](https://docs.openclaw.ai/channels/discord)
- [OpenClaw docs: Discord setup](https://docs.openclaw.ai/channels/discord/setup)
- [OpenClaw docs: Discord access control](https://docs.openclaw.ai/channels/discord/access-control)
- [OpenClaw docs: threads and sessions](https://docs.openclaw.ai/channels/discord/threads-and-sessions)
- [OpenClaw docs: voice channels](https://docs.openclaw.ai/channels/discord/voice-channels)
- [OpenClaw docs: Discord troubleshooting](https://docs.openclaw.ai/channels/discord/troubleshooting)

## Questions

**Is the OpenClaw Discord bot free?** OpenClaw is free and creating a bot costs nothing in Discord. You pay for the AI model you connect, unless you use a local one.

**Does OpenClaw need Message Content Intent?** Yes, to read ordinary messages in a server. Without it, the docs describe a fallback where the bot must be mentioned.

**Can other people in my server use the bot?** Only those you list. Keep groupPolicy on allowlist and add user IDs one at a time.

**Do Discord channels share memory?** No. Each channel has its own session. Shared instructions belong in AGENTS.md or USER.md.

**Can OpenClaw join a voice channel?** Yes, once voice is enabled and a realtime provider is set. Use /vc join, /vc status and /vc leave.


## Related

- [Is OpenClaw safe? OpenClaw security explained](https://coldiq.com/university/openclaw/openclaw-security)

## Try ColdIQ free

ColdIQ gives new accounts up to 1,450 free credits as they get started, no credit card required.
One subscription covers 40+ B2B data providers for finding, enriching and verifying
contacts and companies, through the web app, the API or the MCP server for AI agents.

1. Create an account: https://coldiq.com/marketplace/sign-up?utm_source=ai-assistant&utm_medium=markdown&utm_content=university
2. Run a first search on your own market with the free credits.
3. Connect the MCP server to Claude, ChatGPT or Cursor: https://coldiq.com/mcp
