Video walkthrough
Step 1: Create a Discord application (bot setup)
Discord bots run under an “Application” in the Discord Developer Portal.- Go to the Discord Developer Portal and sign in.
- Click New Application.
- Name it something like “OpenClaw Bot”.
- Accept the terms.
- In the left sidebar, open Bot.
- Click Add Bot → Yes, do it!
- Under Token, click Copy (or Reset Token if needed). Keep this secret.
- Under Privileged Gateway Intents, enable Message Content Intent (required to read message content).
- Optional: Turn Public Bot off if you want a private bot, and set avatar/description.
- In the left sidebar, open OAuth2 → URL Generator.
- Scopes: select
botandapplications.commands. - Bot Permissions (pick what you need):
- Core:
View Channels,Send Messages,Read Message History - Optional:
Add Reactions,Manage Messages,Embed Links,Manage Roles
- Core:
- Copy the generated URL (you’ll use it to invite the bot).
- Scopes: select
Step 2: Invite the bot to your Discord server
- Paste the OAuth2 URL you generated into a browser.
- Select the server.
- Click Authorize.
- Confirm the bot appears in your server.
- You can verify under Server Settings → Integrations → Bots.
Step 3: Enable Developer Mode and copy your IDs
You’ll need IDs for the server and your user.- In Discord, go to User Settings (gear) → Advanced → enable Developer Mode.
- Right-click your server icon → Copy Server ID.
- Right-click your own user → Copy User ID.
- Bot Token
- Server ID
- User ID
Step 4: Allow DMs from server members
This makes it easier to pair/test via DM.- Right-click your server icon → Privacy Settings.
- Turn on Direct Messages.
Step 5: Configure OpenClaw for Discord
- Go to the Agent37 dashboard.
- Open an existing instance (or create a new one).
- Open Terminal.
Option A: Configure via config.json
Edit (or create) ~/.openclaw/config.json:
Option B: Configure via CLI
openclaw gateway restart
Step 6: Test and pair
A) Send a test message (optional)
- Replace
your-channel-idwith a real channel ID (e.g.,1234567890123456789).
B) Pair via DM
- DM your bot: “Hello from OpenClaw”.
- The bot responds with a pairing code.
- In your instance terminal, approve it:
<user_id> and Server ID <server_id>.”
Your Discord bot is now connected successfully.