Sanitized for public release: - Removed all API keys, tokens, and secrets - Removed personal Discord IDs from hermes-openclaw.json - Updated git URLs to be generic placeholders - All sensitive data uses environment variable interpolation
4.7 KiB
4.7 KiB
Discord Setup
OpenBoatmobile can configure Discord integration during deployment.
Why Discord Integration?
| Channel | Pros | Cons |
|---|---|---|
| Discord | Real-time, familiar interface, mobile push | Requires bot setup |
| Control UI | Full featured, direct | No push notifications |
| CLI | Scriptable | No mobile access |
Recommended: Discord for mobile notifications and quick interactions.
Prerequisites
- A Discord account
- A Discord server where you can add bots
- Permission to create bots in that server
Step 1: Create Discord Application
- Go to Discord Developer Portal
- Click New Application
- Name it (e.g., "OpenClaw Agent")
- Click Create
Step 2: Create Bot User
- In your application, go to Bot in the left sidebar
- Click Add Bot
- Confirm the popup
- Copy the token immediately (click "Reset Token" if needed)
- Save this token — you'll need it for
.env
Bot Permissions
Under Privileged Gateway Intents, enable:
- Message Content Intent (required to read messages)
- Server Members Intent (optional, for user info)
Step 3: Invite Bot to Server
- Go to OAuth2 → URL Generator in the left sidebar
- Under Scopes, check:
botapplications.commands
- Under Bot Permissions, check:
Send MessagesRead Messages/View ChannelsRead Message HistoryMention Everyone(optional)Use Slash Commands
- Copy the generated URL at the bottom
- Open the URL in your browser
- Select your server and authorize
Step 4: Get Server and User IDs
Server ID
- In Discord, go to User Settings (gear icon)
- Go to Advanced → Enable Developer Mode
- Right-click your server name
- Click Copy Server ID
User ID
- Right-click your username in Discord
- Click Copy User ID
Step 5: Configure OpenBoatmobile
In .env:
TF_VAR_discord_bot_token=your-bot-token-here
TF_VAR_discord_server_id=123456789012345678
TF_VAR_discord_user_id='["123456789012345678", "another-user-id"]'
Step 6: Deploy (or Update)
# Initial deployment
terraform apply
# If already deployed, update:
terraform apply -var="discord_bot_token=..." -var="discord_server_id=..." -var="discord_user_id=[\"user1\", \"user2\"]"
Step 7: Pair the Gateway
After deployment, the gateway needs to be paired with Discord:
If Tailscale is Enabled
- Visit
https://<hostname>.<tailnet>.ts.net/ - If device pairing is required:
- You'll see a pairing code
- On the server:
openclaw pairing approve device <CODE>
If Using SSH Tunnel
# Create tunnel
ssh -L 18789:localhost:18789 openclaw@<server-ip>
# Open browser
# http://localhost:18789
Channel Configuration
By default, the bot is configured for:
- All channels in the server (using wildcard
*) - No mention required (bot responds to all messages)
- Only your user ID in allowlist
To customize, edit openclaw.json after deployment:
{
"channels": {
"discord": {
"enabled": true,
"token": "${DISCORD_BOT_TOKEN}",
"groupPolicy": "allowlist",
"guilds": {
"SERVER_ID": {
"requireMention": false,
"users": ["YOUR_USER_ID"],
"channels": {
"*": { "allow": true }
}
}
}
}
}
}
Testing
Test Bot is Working
- In Discord, go to any channel in your server
- Type a message
- The bot should respond (if
requireMentionis false) - Or: Mention the bot with
@OpenClaw Agent hello
Check Gateway Logs
On the server:
# Check gateway is running
systemctl status openclaw-gateway
# View logs
journalctl -u openclaw-gateway -f
Troubleshooting
Bot doesn't respond
- Check bot token is correct
- Verify bot has Message Content Intent enabled
- Check server ID and user IDs are correct
- Verify bot is in your server
"Unauthorized" in gateway logs
- Verify
discord_user_idlist contains your actual Discord IDs - Check each user ID is in the server's member list
Gateway shows pairing code
If you see a pairing code:
- SSH into the server
- Run:
openclaw pairing approve device <CODE> - Refresh the browser
Bot joins but doesn't respond
- Check
requireMentionsetting - Verify your user ID is in the allowlist
- Check gateway logs for errors
Security Notes
- The bot token provides full access to the bot — keep it secret
- Regenerate the token if compromised: Discord Dev Portal → Bot → Reset Token
- The user ID allowlist ensures only you can interact with the agent
- For team access, add multiple user IDs to the
usersarray