Stack Junkie
Published on

Connect OpenClaw to Discord: 6 steps I wish I knew sooner

Authors
  • avatar
    Name
    Jerry Smith
    Twitter

How I connected OpenClaw to Discord (step by step)

TLDR

Note: I run OpenClaw on Discord for my team server, and this setup worked perfectly.

  • OpenClaw (previously known as Clawdbot and Moltbot) supports Discord as a messaging channel alongside Telegram, Slack, and Signal
  • You need to create a Discord bot in the Discord Developer Portal, copy the token, and add it to your OpenClaw config
  • The bot needs specific permissions: Send Messages, Read Message History, Embed Links, and Attach Files at minimum
  • Once configured, invite the bot to your server and your agent responds to messages just like it does in Telegram
  • Group setup lets you have separate channels for different topics, matching the session separation pattern
  • Total setup time: about 20 minutes if you follow every step (I skipped one and spent an extra hour debugging)

Table of contents

Why Discord

Before starting, ask your agent to check its current OpenClaw version to ensure compatibility. Discord integration is useful when your team or community already uses Discord. Making people switch to Telegram just for AI access adds friction nobody wants.

Discord's role-based permissions let you restrict agent access to specific users or channels. You can keep the bot in a locked-down corner of your server or give it free reign. Threads help keep long conversations organized without cluttering main channels.

If you are already running OpenClaw on Telegram, this is an "and" not an "or." Both channels can run at the same time with separate sessions. Our Telegram setup guide covers that side if you have not done it yet.

For security best practices when exposing your agent to multiple channels, check our OpenClaw security hardening guide.

Prerequisites

You need:

  • OpenClaw installed and running (see installation guide)
  • Command line access to your OpenClaw server
  • A text editor for configuration files

Step 1: Create a Discord bot

Go to the Discord Developer Portal and log in with your Discord account.

  1. Click "New Application" in the top right
  2. Give it a name. This is the application name, not the bot username. Something like "OpenClaw Agent" works.
  3. Click "Create"

You are now on the application's General Information page. You can set a description and icon here, but neither is required for functionality.

Next, go to the "Bot" tab in the left sidebar.

  1. Click "Reset Token" (or "Add Bot" if this is a brand new application)
  2. The bot is created. You will see a username field where you can change the bot's display name.

Under the Bot tab, scroll down to "Privileged Gateway Intents." Enable these three:

  • Presence Intent: Not required for basic use, but useful for status features
  • Server Members Intent: Not required for basic use
  • Message Content Intent: Required. Without this, your bot cannot read message content. It will receive message events but the content field will be empty. This is the checkbox I missed, and I spent an hour checking my config before finding it.

Click "Save Changes."

Step 2: Get your bot token

Still on the Bot tab, click "Reset Token" if you have not already. Discord shows each token once. You can reset it later, but that invalidates any running instances using the old token. Copy it immediately and store it somewhere safe.

Never commit it to git or share it publicly.

Step 3: Set bot permissions

Go to the "OAuth2" tab in the left sidebar, then click "URL Generator."

Under Scopes, check:

  • bot

Under Bot Permissions, check at minimum:

  • Send Messages
  • Read Message History
  • Embed Links
  • Attach Files
  • Add Reactions

If you want the bot to manage threads or create channels, add those permissions too. Start minimal and add permissions later as needed.

The page generates an invite URL at the bottom. Copy it for Step 5.

Step 4: Add the token to OpenClaw config

Open your OpenClaw configuration file. The location depends on your setup. Run openclaw config path to find it, but it is typically at ~/.openclaw/config.yaml.

Add the Discord channel configuration:

channels:
  discord:
    token: "YOUR_BOT_TOKEN_HERE"

If you are using environment variables (recommended for security, and covered in our security hardening guide):

export DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN_HERE"

Then reference it in your config:

channels:
  discord:
    token: "${DISCORD_BOT_TOKEN}"

Restart your OpenClaw instance for the changes to take effect:

openclaw gateway restart

Check the logs to confirm the Discord channel connected successfully. I recommend you see a message indicating the bot logged in.

Refer to the OpenClaw documentation for the most current config format, as this may change between versions.

Step 5: Invite the bot to your server

Use the OAuth2 URL you generated in Step 3. Paste it in your browser. Discord will ask you to select a server.

  1. Choose the server you want to add the bot to
  2. Review the permissions
  3. Click "Authorize"
  4. Complete the CAPTCHA

The bot should appear in your server's member list. It will show as offline until your OpenClaw instance connects (which should have happened after the restart in Step 4).

If the bot shows as online in the member list, the connection is working.

Step 6: Send your first message

Go to any text channel where the bot has access. How the bot responds depends on your OpenClaw configuration.

OpenClaw Discord bots typically respond when:

  • Mentioned directly (@YourBotName)
  • Sent a direct message

Some configurations also respond to all messages in specific channels. Check your OpenClaw config for the trigger settings.

Test the connection by mentioning the bot:

@YourBotName What time is it?

The bot should respond with the current time. That confirms the full pipeline works: Discord receives the message, sends it to OpenClaw, OpenClaw processes it, and sends the response back through Discord.

If nothing happens, run through this checklist:

  • Is the bot online in the member list?
  • Does the bot have Send Messages permission in that channel?
  • Is Message Content Intent enabled in the Developer Portal?
  • What do your OpenClaw logs show? Run openclaw gateway logs to check.

Setting up channel groups

The real payoff comes from organizing your Discord server to match your workflow. This mirrors the session separation pattern. If you have used Telegram groups with OpenClaw, the concept is the same.

Example channel organization:

  • #agent-general for casual interactions
  • #agent-research for knowledge base queries
  • #agent-tasks for task management
  • #agent-reports for scheduled output (cron job results)
  • #agent-debug for testing and troubleshooting

You can configure OpenClaw to treat each channel as a separate session. Conversations in #agent-research do not pollute the context in #agent-tasks. Each channel maintains its own history.

Use Discord's role permissions to control who can interact with the bot. Create an "Agent Access" role and restrict bot channels to members with that role. This prevents random server members from burning your API tokens.

Troubleshooting

Issue: Command not found

Make sure OpenClaw is installed and in your PATH. Run openclaw --version to verify.

Issue: Permission denied

You may need to run commands with appropriate permissions. Check file ownership and permissions in your OpenClaw directory.

Issue: Changes not taking effect

Restart the OpenClaw gateway after making configuration changes: openclaw gateway restart

FAQ

Q: Can I use both Telegram and Discord at the same time?

Yes. OpenClaw supports multiple channels simultaneously. Your agent can be active on Telegram, Discord, and Slack all at once. Each channel maintains separate sessions.

Q: Does the Discord bot support slash commands?

OpenClaw's Discord integration primarily uses natural language messages rather than slash commands. You interact with it by mentioning the bot or sending messages in configured channels. Check the OpenClaw docs for the latest on slash command support.

Q: How much does running a Discord bot cost?

The Discord bot itself is free. Discord does not charge for bot accounts. Your costs come from the LLM tokens consumed when the agent processes messages. Same cost whether you use Discord, Telegram, or any other channel.

Q: Can the bot join voice channels?

OpenClaw's Discord integration focuses on text channels. Voice channel support depends on your specific setup and any additional skills you have installed.

Q: What if I have multiple Discord servers?

One bot token can be invited to multiple servers. Each server's channels will create separate sessions. Be mindful of token costs if many people are interacting with your agent across servers.

Sources

Conclusion

Discord setup is a sequence of copy-paste steps. Create the bot, copy the token, add it to config, invite it to your server. Four actions. The basic setup took me 15 minutes. I spent another hour debugging empty message content because I skipped enabling Message Content Intent in Step 1.

Now my agent lives in both Telegram and Discord. Telegram for personal workflow automation. Discord for the team server where everyone can ask it questions. Both channels run on the same OpenClaw instance with zero extra config beyond the token.

Enjoyed this post?

Get new articles delivered to your inbox. No spam, unsubscribe anytime.

Comments