Most OpenClaw tutorials show you the happy path. This one covers the real setup: deploying from a clean VPS, configuring the backend files, binding separate agents to separate Discord channels, and hardening the access controls before you go live.
What you're building
flowchart TD VPS[VPS] --> OC[OpenClaw] OC --> AG[Alex\nmain agent] OC --> PL[Paul\nsecond agent] AG -->|allowlist| CHA[Discord\nChannel A] PL -->|binding route| CHB[Discord\nChannel B] OC --> UI[Control UI\nvia SSH tunnel]
Two Discord channels. Two agents. Channel A goes to Alex. Channel B goes to Paul. Neither responds to channels it wasn't assigned to, and both reject unauthorized users. That's the end state.
Requirements
- A VPS (Contabo, DigitalOcean, Linode — any provider works)
- An OpenAI API key
- A Discord account with developer mode enabled
Step 1: SSH into the VPS and install OpenClaw
Connect via SSH. Most VPS providers give you a root user by default. On a clean machine, openclaw won't be found. Go to the OpenClaw website, scroll to Quick Starts, copy the one-liner for your OS (Ubuntu in this case), and paste it in the terminal.
The installer handles all missing dependencies automatically. It takes a few minutes on a fresh machine.
After the install, the onboarding wizard starts automatically. If it doesn't, run openclaw onboard.
Step 2: Onboarding
Walk through the onboarding:
- Security warning: yes
- Model: OpenAI (pick whatever you have access to; model quality doesn't matter for this tutorial)
- API key: paste your OpenAI key
- Channel type: Discord
At the Discord token prompt, stop. You don't have the bot token yet.
Step 3: Create the Discord bot
- Go to discord.com/developers/applications
- New Application. Name it Jarvis or whatever you want.
- Go to Bot in the left sidebar. Click "Reset Token" (it creates one on first use).
- Copy the token. Go back to the onboarding terminal and paste it.
For the channel configuration, choose allowlist. You'll enter channel IDs — get them by right-clicking a channel in Discord. If you don't see "Copy Channel ID," go to User Settings > Advanced and enable Developer Mode.
If the channels fail to resolve, it's because the bot isn't in the server yet. Continue onboarding, then fix it in the config afterward (see Step 5).
Step 4: Invite the bot and set permissions
Back in the Discord developer portal:
- Bot tab: enable Presence Intent, Server Members Intent, Message Content Intent. Save.
- OAuth2 > URL Generator: select
botandapplications.commandsscopes. - Bot permissions: Read Messages, Send Messages, Read Message History, Add Reactions, Embed Links, Attach Files, Use Slash Commands.
- Copy the generated URL, open it, and invite the bot to your server.
Verify by going to your Discord server. The bot should appear in the member list.
Step 5: Access the control UI via SSH tunnel
The control UI runs on the VPS, not the internet. To access it locally, create an SSH tunnel:
ssh -L 3000:localhost:3000 root@YOUR_VPS_IP
Then run openclaw dashboard on the VPS. It prints a localhost URL with a token. Open that URL in your browser.
Step 6: Wake the main agent
In the control UI, open the main agent chat and tell it who it is:
Hi, you are Alex. And I am Renato.
The agent writes an identity file and a user file. You can verify this in the agent files panel on the left.
Step 7: Test and fix the config
Go to Discord and mention the bot. It replies. Test a channel that's not on the allowlist — it should stay silent.
To let the bot reply without being mentioned, edit the config file on the VPS at openclaw.json. Find the Discord section and add:
"require_mention": false
If your channel IDs show as asterisks, it's the unresolved-channel bug from Step 3. Right-click your Discord server to copy the server ID, then update the guilds section in openclaw.json with the correct ID.
Step 8: Enable slash commands
Slash commands like /new won't work until you authorize your user. Right-click your Discord username, copy your user ID, and add it to openclaw.json under users:
"users": ["YOUR_DISCORD_USER_ID"]
Step 9: Create a second agent
In the terminal on the VPS:
openclaw agents create paul
Walk through the mini-onboarding. Leave most settings as defaults. Use the same model.
Step 10: Bind channel B to Paul
Open openclaw.json. Add a bindings section:
"bindings": [
{
"type": "route",
"to": "paul",
"when": {
"channel": "discord",
"peer": "YOUR_CHANNEL_B_ID"
}
}
]
Get the agent ID from the control UI under Agents. Get the channel ID from Discord (right-click > Copy Channel ID). Save the file.
Test it: go to Channel B, ask "what's your name?" — Paul answers. Go to Channel A — Alex answers. Done.
Security checklist before going live
- SSH hardening: disable password login, use key-based auth only
- Close all firewall ports except 22 and whatever you actually need
- Run OpenClaw under a non-root user in production (the tutorial used root for speed; don't do that live)
- Give each agent only the tool permissions it needs. No blanket access.
If you want a production-ready OpenClaw setup for your team, get in touch. We handle the full deployment — see our AI consulting service for scope.