This page shows you how to connect OpenClaw to Discord and validate your first working loop.
Discord is the recommended first channel for most new OpenClaw users because:
- bot setup is well-documented
- testing is easy (just send a message in a channel)
- visibility is good (you can see everything happening)
- it works for both personal and team workflows
Make sure you have finished:
Do not connect Discord until your Gateway is running and your basic setup passes the health check.
- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section in the left sidebar
- Click "Add Bot" or "Reset Token" to get a bot token
- Copy the token — you will need it for OpenClaw config
Important: keep the bot token secret. Do not share it or commit it to a repository.
In the Developer Portal, go to "OAuth2" → "URL Generator":
- Under Scopes, select
bot
- Under Bot Permissions, select at minimum:
- Read Messages/View Channels
- Send Messages
- Read Message History
- Copy the generated URL and open it in your browser
- Select the server you want to add the bot to
- Authorize the bot
The bot should now appear in your Discord server's member list (it will show as offline until Gateway connects).
You need the IDs for the channel where the bot will operate:
- In Discord, go to Settings → Advanced → enable "Developer Mode"
- Right-click on the target channel → "Copy Channel ID"
- Right-click on the server name → "Copy Server ID"
You will add these to your OpenClaw config.
Add the Discord channel configuration to your OpenClaw workspace config:
{
"channels": {
"discord": {
"enabled": true,
"token": "your-bot-token-here",
"guildId": "your-server-id",
"channelId": "your-channel-id"
}
}
}
Replace the placeholder values with your actual bot token, server ID, and channel ID.
After saving the config:
- Restart Gateway (
openclaw gateway restart or through the app)
- Check that the bot shows as "Online" in your Discord server
- Send a test message in the configured channel
- Wait for the assistant to reply
If the bot does not come online:
- verify the token is correct
- check that Gateway is running
- look at Gateway logs for connection errors
If the bot comes online but does not reply:
- confirm the channel ID matches the channel you are messaging in
- check that the bot has permission to read and send messages in that channel
- verify your model provider API key is valid
Send a simple message like "hello" or "what can you do?" and confirm:
- the assistant received the message
- the assistant generated a reply
- the reply appeared in the Discord channel
If this works, your Discord setup is complete.
Now that your first channel loop is validated, move to:
- OpenClaw Heartbeat Guide — add a recurring health check
- OpenClaw for Discord Support Workflows — build a real support workflow
- OpenClaw Use Cases — explore more workflow patterns
- Gateway is not running, or the token is wrong
- Check
openclaw gateway status and verify the token in config
- Channel ID mismatch (bot is listening in a different channel)
- Bot lacks permission to read/send messages in the target channel
- Model provider API key is invalid or has no credits
- The configured
channelId does not match where you are sending messages
- Update the config and restart Gateway
- Discord has rate limits on bot messages
- If you see delays, check if the model provider is responding slowly or if Discord is throttling the bot