#Inbound routing by Discord bot token to different OpenClaw agents

10 messages Β· Page 1 of 1 (latest)

astral harness
#

I am trying to configure OpenClaw with multiple Discord bots, and I want each bot to route inbound messages to a different agent and workspace.
My setup is roughly:
one OpenClaw instance
multiple Discord bot tokens configured
multiple agents configured, for example:
main
coder
researcher

I already configured explicit workspaces per agent, for example:

  • main β†’ /Users/openclaw/.openclaw/workspace
  • coder β†’ /Users/openclaw/.openclaw/workspace/coder
  • researcher β†’ /Users/openclaw/.openclaw/workspace/researcher

That part works.

The missing piece is inbound routing. What I want is effectively:

  • Discord bot nodo β†’ agent coder
  • Discord bot yunnie β†’ agent main

But right now, inbound Discord messages for the nodo bot are still landing in sessions like:

  • agent:main:discord:channel:...

So even though coder has its own workspace, the bot is still entering through main.

I inspected the local config/runtime and I can see support for multiple Discord bot entries, but I cannot find a documented way to bind each bot to a specific inbound agent.
So my questions are:

  1. Does OpenClaw currently support inbound routing from Discord bot/token -> agent in a single instance?
  2. If yes, what is the exact config shape?
  3. If not, what is the recommended architecture?
    • one instance per bot
    • route by channel
    • or some other supported pattern

I am specifically asking about inbound routing for multiple Discord bots, not outbound reply routing.

If there is an example config for this, that would be perfect.

eternal meadowBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

little yewBOT
scarlet flumeBOT
#

I’m checking the docs and source so I don’t make up config keys.

#

Yes, this is supported in a single OpenClaw instance.

The key bit is: inbound bot -> agent routing is done with top-level bindings[], using the Discord accountId, not with a per-bot agent field under channels.discord.accounts.

1. Does this work?

Yes. Current docs/source support:

  • multiple Discord bot accounts under channels.discord.accounts
  • multiple agents under agents.list
  • inbound routing by bindings[].match.channel + accountId

2. Exact config shape

{
  agents: {
#
    list: [
      { id: "main", workspace: "/Users/openclaw/.openclaw/workspace" },
      { id: "coder", workspace: "/Users/openclaw/.openclaw/workspace/coder" },
      { id: "researcher", workspace: "/Users/openclaw/.openclaw/workspace/researcher" },
    ],
  },

  bindings: [
    { agentId: "coder", match: { channel: "discord", accountId: "nodo" } },
    { agentId: "main", match: { channel: "discord", accountId: "yunnie" } },
  ],

  channels: {
    discord: {
      defaultAccount: "yunnie", // recommended in multi-account setups
#
      accounts: {
        nodo: {
          token: "DISCORD_TOKEN_FOR_NODO",
        },
        yunnie: {
          token: "DISCORD_TOKEN_FOR_YUNNIE",
        },
      },
    },
  },
}

CLI equivalent:

#
openclaw agents bind --agent coder --bind discord:nodo
openclaw agents bind --agent main --bind discord:yunnie

Then verify with:

openclaw agents list --bindings

3. Recommended architecture

For your use case, the recommended setup is:

one instance + multiple Discord bot accounts + account-scoped bindings

You only need one instance per bot if you want full process-level isolation, not just separate workspaces/agent state.

#

Why yours is still landing in agent:main:...

Usually it means one of these:

  • there is no matching bindings[] entry
  • the binding omitted accountId, which only matches the default account
  • the accountId in bindings does not exactly match the key under channels.discord.accounts
  • you are on an older version, so check:
openclaw --version

Also worth noting: there is no documented/supported config like:

channels.discord.accounts.nodo.agent = "coder"