Discord Integration with OpenClaw
Add OpenClaw AI to your Discord server. Use slash commands to run tasks, check status, and deliver automated AI reports directly in your channels.
Quick Start in 3 Steps
Step 1 — Create a Discord bot app at discord.com/developers and copy the bot token.
Step 2 — Configure OpenClaw:
openclaw config set discord.bot_token "YOUR_BOT_TOKEN"
openclaw config set discord.allowed_roles "admin,ai-users"Step 3 — Start and test:
openclaw start --discord
# Then in Discord: /run Summarize this week's commitsPrerequisites
- OpenClaw v1.0.0 or later installed (Installation Guide)
- A Discord account with server management permissions
- Access to Discord Developer Portal
- Your Discord server with at least one channel to assign to the bot
Step 1: Create a Discord Application
- Go to discord.com/developers/applications
- Click New Application and give it a name
- Navigate to Bot → click Add Bot
- Copy the Bot Token (keep this secret!)
- Under Privileged Gateway Intents, enable Message Content Intent
Never commit your Discord bot token to version control. Store it using DISCORD_BOT_TOKEN environment variable or the OpenClaw config.
Step 2: Invite Bot to Your Server
Generate an invite URL in the OAuth2 → URL Generator tab:
- Scopes:
bot,applications.commands - Permissions:
Send Messages,Read Message History,Use Slash Commands
Open the generated URL and add the bot to your server.
Step 3: Install the Discord Pack
openclaw install discordStep 4: Configure
openclaw config set discord.bot_token "YOUR_BOT_TOKEN"
openclaw config set discord.allowed_roles "admin,ai-users"
openclaw config set discord.command_prefix "/"# config.yaml
integrations:
discord:
bot_token: "${DISCORD_BOT_TOKEN}"
guild_id: "YOUR_SERVER_ID" # optional: restrict to one server
allowed_roles:
- admin
- ai-users
command_channel: "ai-commands" # only respond in this channelSlash Commands
| Command | Description |
|---|---|
/run <task> | Execute an AI task |
/status | Show current job and agent status |
/stop | Stop the running task |
/provider <name> | Switch AI provider (openai/claude/ollama) |
/help | Show available commands |
Step 5: Start
openclaw start --discordType /run Summarize today's AI news in your Discord server to test.
Channel Permissions
To restrict bot activity to specific channels:
- Set
command_channelto the channel name in config - Use Discord's channel permission overrides to deny the bot access to other channels
- Use
allowed_rolesto limit who can invoke commands
Automated Channel Reports
Schedule OpenClaw to post periodic AI-generated reports to a specific Discord channel:
# config.yaml
integrations:
discord:
bot_token: "${DISCORD_BOT_TOKEN}"
guild_id: "YOUR_SERVER_ID"
allowed_roles:
- admin
- ai-users
scheduled_reports:
- cron: "0 9 * * 1" # Every Monday at 9 AM
channel: "weekly-digest"
task: "Generate a weekly AI technology summary"
- cron: "0 18 * * *" # Daily at 6 PM
channel: "dev-updates"
task: "Summarize today's GitHub commits and open issues"Common Use Cases for Teams
- #ai-commands channel — dedicated channel for team members to run AI tasks
- Code review bot — paste code in a thread, ask
/run Review this Python snippet - Daily standup summary — schedule a morning digest post in
#general - CI/CD notifications — send deployment results from GitHub Actions to Discord via OpenClaw
- Research assistant — team members share articles with
/run Summarize this: [URL]
Role-Based Access Control
Restrict which Discord roles can use specific bot commands:
integrations:
discord:
permissions:
admin:
commands: [run, stop, config, status]
ai-users:
commands: [run, status, help]
viewer:
commands: [status, help]ai-users role in Discord and assign it only to trusted team members to prevent unauthorized AI usage.Security Best Practices
- Store the bot token in an environment variable:
DISCORD_BOT_TOKEN - Restrict the bot to specific channels using
command_channelconfig - Enable Message Content Intent only — do not enable unnecessary privileged intents
- Regularly audit which server members have the
ai-usersrole - Use
guild_idto restrict the bot to a single server (no public bot)
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Bot is offline in Discord | OpenClaw isn't running | Run openclaw start --discord |
| Slash commands not showing | Missing applications.commands scope | Re-invite bot with correct OAuth2 scopes |
| "Missing Access" error | Bot missing channel permissions | In Discord, assign bot role with "Send Messages" and "Use Slash Commands" in the target channel |
| Bot ignores commands | User role not in allowed_roles | Add the role to discord.allowed_roles in config |
| Token Invalid error | Token was reset or revoked | Regenerate token in Developer Portal → Bot |
Try It Yourself
Once your bot is running and invited to your server, test these slash commands in your designated AI channel.
Example 1: Ask the bot to summarise a block of text
# In Discord, type:
/openclaw run Summarise this in 3 bullets: [paste article text here]
# Bot replies in the same channel within seconds:
# 🤖 OpenClaw:
# • New OpenAI model supports 1M token context
# • Price cut of 50% on GPT-4o-mini announced
# • API rate limits doubled for paid tier usersExample 2: Daily digest posted to a channel
# Run on your server via cron, posts to #dev-reports channel
0 9 * * 1-5 openclaw run "Create a developer morning digest: new GitHub issues overnight, recent PRs, and deploy status" \
--path ~/projects/ \
| openclaw discord send --channel dev-reportsExample 3: Code review bot for a team channel
# In Discord #code-review channel:
/openclaw run Review this Python function for bugs, and suggest a more Pythonic rewrite:
def get_items(list):
result = []
for i in range(len(list)):
result.append(list[i])
return result
# Bot replies with analysis and improved version:
# Bug: overwrites built-in 'list'
# Pythonic version: def get_items(items: list) -> list: return list(items)#ai-bot channel and set command_channel: "ai-bot" in your config. This keeps AI task output separate from general chat and makes it easy to audit what the bot has run.
What's Next
- Telegram Bot Integration — control OpenClaw from Telegram for personal use
- Other Tool Integrations — connect OpenClaw to Slack, Notion, GitHub, and more
- Task Scheduling — set up automated channel reports on a cron schedule
- Autonomous Workflows — chain Discord commands into multi-step AI workflows