NEW 📢 Limited launch offer: up to 70% off your first month on every game!See plans

How to connect OpenClaw to Discord

OpenClawUpdated Nov 6, 20267 min read

Short answer. In the Discord Developer Portal, create an application, open Bot, press Reset Token to get the token and turn on Message Content Intent. Invite the bot to a server you are in, turn on Developer Mode in Discord and copy your own user ID. Then give OpenClaw the token and allow only your user ID. On PlayNHost that is two fields on the Agent page and a restart; the panel installs OpenClaw's Discord connector for you.

Checked on 6 November 2026, accurate for OpenClaw 2026.11.1.

This guide follows OpenClaw's Discord setup documentation and the PlayNHost panel as it works today.

Step 1: create the Discord application and bot

  1. Open the Discord Developer Portal, press New Application and give it a name.
  2. Open Bot in the sidebar and set the bot's Username to your agent's name.
  3. Still on Bot, under Privileged Gateway Intents, turn on:
    • Message Content Intent: required here. OpenClaw asks Discord for it, and Discord refuses the connection ("disallowed intents") when it is off.
    • Server Members Intent: recommended by OpenClaw, needed for role allowlists and matching names to IDs.
    • Presence Intent: optional, only for presence updates.
  4. Press Reset Token and copy the token. Despite the name, the first press creates your first token. Keep it private.

Step 2: invite the bot and allow DMs

  1. Open OAuth2, then the OAuth2 URL Generator. Tick the scopes bot and applications.commands.
  2. Under Bot Permissions, tick at least View Channels, Send Messages, Read Message History, Embed Links and Attach Files (Add Reactions is optional).
  3. Open the generated URL, pick your server and press Continue. A private server with just you and the bot is the simplest.
  4. Let the bot message you: right-click the server icon, open Privacy Settings and turn on Direct Messages.

Step 3: copy your Discord user ID

In Discord, open User Settings, then Developer, and turn on Developer Mode (on mobile: App Settings, Advanced). Then right-click your own avatar or name and choose Copy User ID. It is a long number (PlayNHost accepts 17 to 20 digits).

OpenClaw's Discord docs use Developer Mode for this, and so does the panel: unlike the Telegram setup, the console does not ask you to read your ID from a bot reply.

Step 4 on PlayNHost: paste the token and your ID

  1. Open your server at panel.playnhost.com, then the Agent tab. Set an AI provider key under AI provider if you have not yet (see which AI provider key to use).
  2. Under Chat apps, press Set on Discord bot token, paste the token and press Save. The panel checks its shape; a wrong paste gets "That is not a valid discord bot token."
  3. Under Who can message it, enter your ID in Discord user IDs and press Save. Several IDs go on one line, separated by commas.
  4. Press Start, or Restart now if the agent is already running. Discord is a separate OpenClaw plugin, so the first start with a Discord token installs it once. Among the other lines, the console shows:
    [PlayNHost] Installing the Discord connector 2026.11.1
    [PlayNHost] Starting OpenClaw 2026.11.1
    [PlayNHost] Your agent is running
    [PlayNHost] Discord: only user 123456789012345678 can message your agent.
    In our test the connector install took about 30 seconds. Later starts reuse it, and update it when OpenClaw itself is updated.
  5. Send your bot a direct message in Discord. Your agent answers. Other Discord accounts are ignored.

If you leave Discord user IDs empty, the console says "Discord: nobody can message your agent yet" and explains how to copy your ID. Until you add it, anyone who DMs the bot is ignored; OpenClaw answers a first message with a pairing code: ignore it, nothing needs approving, and put your user ID on the Agent page instead.

What PlayNHost sets for you

  • Discord DMs use dmPolicy: "allowlist" with the IDs from the Agent page (or pairing while the list is empty), and those IDs become OpenClaw's command owners.
  • Server channels stay closed: OpenClaw's default groupPolicy is allowlist, and no server is on that list until one is added to OpenClaw's settings. Use direct messages.
  • The token reaches OpenClaw as DISCORD_BOT_TOKEN in its environment. A token written in OpenClaw's settings file would win over it, so the start removes that one.
  • The same server can talk on Telegram too: set both tokens and both ID lists. See connect OpenClaw to Telegram.

Step 4 on your own machine

  1. Check that the Discord plugin is there with openclaw plugins list. On our test install of the npm package 2026.11.1 it was not bundled; this added it:
    openclaw plugins install npm:@openclaw/discord
  2. Put the token in the Gateway's environment (never in a chat) and point the config at it, allowing only yourself:
    export DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"
    cat > discord.patch.json5 <<'JSON5'
    {
      channels: {
        discord: {
          enabled: true,
          token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },
          dmPolicy: "allowlist",
          allowFrom: ["123456789012345678"],
        },
      },
      commands: {
        ownerAllowFrom: ["discord:123456789012345678"],
      },
    }
    JSON5
    openclaw config patch --file ./discord.patch.json5 --dry-run
    openclaw config patch --file ./discord.patch.json5
    openclaw gateway
    The commands part makes you the owner for owner-only commands, which a hand-written allowlist does not do. For a service install, put DISCORD_BOT_TOKEN in ~/.openclaw/.env so the service has it, and restart the service instead of running openclaw gateway.
  3. Or keep the default pairing mode: DM the bot, then approve the code within an hour:
    openclaw pairing list discord
    openclaw pairing approve discord <CODE>

When it does not answer

What you seeCause and fix
"Used disallowed intents" in OpenClaw's logMessage Content Intent is off. Turn it on in the Developer Portal, Bot, then restart.
401: Unauthorized from /gateway/botThe token was reset or mistyped. Press Reset Token again, then Replace on the Agent page and restart. On PlayNHost, OpenClaw's log is logs/openclaw.log in Files.
The bot does not answer in a DMYou and the bot should share a server. OpenClaw's Discord guide also asks you to turn on Direct Messages in that server's Privacy Settings so the bot can message you.
The bot replied with a pairing codeDiscord user IDs is empty, so the agent is in pairing mode. Copy your user ID (Developer Mode, Copy User ID), put it on the Agent page and restart.
The bot does not answer and sends no codeThe ID on the list is not your user ID (for example a server or channel ID). Copy User ID from your own name, replace it and restart.
Console: "The Discord connector could not be installed; your agent starts without Discord."The plugin download failed. Press Restart to try again.
No answer in a server channelServer channels are closed by default. Use a direct message.

Not set up yet? Create an OpenClaw server.

PlayNHost is not affiliated with the OpenClaw Foundation. OpenClaw is open-source software under the MIT licence.

Already hosting it somewhere else? Move your server to us

OUR LATEST BLOGS