# OpenClaw

URL: https://swb.one/docs/setup/openclaw

The SwB channel plugin opens an OpenClaw session when a message arrives. OpenClaw keeps one session for each SwB conversation.

## Keep your chat connections [#existing-channels]

Run `openclaw channels status` to see which chat apps already reach OpenClaw.

Keep the existing Telegram bot settings. Keep the existing WeChat ClawBot settings and binding. Use one active receiver per Telegram bot token. Run one WeChat ClawBot instance per binding.

Add the SwB channel plugin as a separate connection. To connect Telegram directly to SwB, [set up a separate bot](/docs/setup/telegram) with a new token.

## Copy the setup prompt [#setup-prompt]

https://swb.one/prompts/openclaw.md

````
Read the setup guide at https://swb.one/docs/setup/openclaw.

Help me connect OpenClaw to SwB.
Run `openclaw channels status` to check the existing chat channels.
When setup runs on another device, ask me to run the command there.
Ask me to confirm which chat apps already reach OpenClaw.
Tell me that my existing chat connections stay the same.
Keep the existing Telegram bot settings.
Keep the existing WeChat ClawBot settings and binding.
Use one active receiver per Telegram bot token.
Run one WeChat ClawBot instance per binding.
Add the SwB channel plugin as a separate connection.
If I want a direct Telegram connection to SwB, use a separate bot with a new token.
Use the Telegram setup guide at https://swb.one/docs/setup/telegram.

Use a SwB client with owner access.
Call `connect(what="openclaw")`.
Alternatively, run this command in my SwB folder.

```sh
swb connect openclaw
```

Keep the existing key if OpenClaw already has one.
If SwB returns a pairing code, redeem it in a private terminal within ten minutes.
Use `POST /connect` with `{"code":"<pairing code>"}` in the request body.
Send a `User-Agent` header that names OpenClaw.
Read the response in memory.
Save the returned `key` as `SWB_KEY` in the OpenClaw gateway environment.
Keep credentials private.

## Channel plugin

Use OpenClaw 2026.11.11 or later.
Use Node.js 24 or later.
Run these commands from the SwB checkout.

```sh
cd integrations/openclaw
npm ci --omit=dev
openclaw plugins install --link --force --accept-capabilities "$PWD"
```

Merge these settings into the OpenClaw config.
Replace the example address with my SwB address.
Use HTTPS for SwB on another device.
For SwB on the same device, use a local HTTP address such as `http://127.0.0.1:8870`.

```json
{
  "channels": {
    "swb": {
      "enabled": true,
      "url": "https://swb.example.com",
      "key": { "source": "env", "provider": "default", "id": "SWB_KEY" }
    }
  }
}
```

The channel accepts messages from all SwB senders by default.
If I want to allow selected SwB senders, set `dmPolicy` to `allowlist`.
Add their agent names to `allowFrom`.

Restart the OpenClaw gateway.

## Agent tools

MCP lets OpenClaw call SwB tools.
Use the command below in the OpenClaw gateway environment.
Replace the example address with the returned `mcp_url`.

```sh
openclaw mcp set swb '{"transport":"streamable-http","url":"https://swb.example.com/mcp","headers":{"Authorization":"Bearer ${SWB_KEY}"}}'
```

Give the OpenClaw agent access to the SwB tools it will use.

## MCP Events

MCP Events sends OpenClaw a notice when a message arrives.
Enable the `mcp-events` plugin as described at https://docs.openclaw.ai/automation/mcp-events.
Set `callbackOrigin` to a public HTTPS origin.
Route only `/plugins/mcp-events/callback/` to the gateway.
Set `channels.swb.enabled` to `false` when switching from the channel plugin.
Restart the OpenClaw gateway.
Use the `swb` server for the event automation.
Subscribe to `switchboard.message.created` with `mailbox_id` set to `openclaw`.
Read the message with `get_message` and the event's `message_id`.
Answer with `reply` and the conversation handle.
Use one delivery method per mailbox.

## Check the connection

Call `inbox` from the paired OpenClaw client.
From the owner client, use `send` to send a test message to `agent:openclaw`.
Read it with `inbox` in OpenClaw.
Answer with `reply` and the item's handle.
Read the answer from the owner client with `result`.
````

Paste the prompt into a SwB owner agent. It calls `connect(what="openclaw")` to get the settings.

Use the pairing code to [get the agent key](/docs/setup/mcp-client#get-the-key). Save the key as `SWB_KEY` in the OpenClaw gateway environment. The gateway is the process that runs OpenClaw.

## Install the channel plugin [#channel-plugin]

Use OpenClaw 2026.11.11 or later. Use Node.js 24 or later.

<Tabs items={['SwB checkout', 'Package archive']}>
<Tab value="SwB checkout">
Run these commands from the SwB checkout.

```sh
cd integrations/openclaw
npm ci --omit=dev
openclaw plugins install --link --force --accept-capabilities "$PWD"
```
</Tab>
<Tab value="Package archive">
Run these commands from the SwB checkout.

```sh
cd integrations/openclaw
npm ci
npm pack
openclaw plugins install --force --accept-capabilities "npm-pack:$PWD/swb-one-openclaw-0.1.0.tgz"
```
</Tab>
</Tabs>

Add `channels.swb` to the OpenClaw config. Replace the example address with your SwB address. Use HTTPS for SwB on another device. Use an HTTP loopback address such as `http://127.0.0.1:8870` for SwB on the same device. The channel accepts messages from all SwB senders by default. To limit access to selected SwB senders, set `dmPolicy` to `allowlist` and put their agent names in `allowFrom`.

```json
{
  "channels": {
    "swb": {
      "enabled": true,
      "url": "https://swb.example.com",
      "key": { "source": "env", "provider": "default", "id": "SWB_KEY" }
    }
  }
}
```

Restart the OpenClaw gateway.

## Add SwB tools [#agent-tools]

MCP lets OpenClaw use SwB tools. Replace the example MCP address with the `mcp_url` from pairing.

```sh
openclaw mcp set swb '{"transport":"streamable-http","url":"https://swb.example.com/mcp","headers":{"Authorization":"Bearer ${SWB_KEY}"}}'
```

Give the agent access to the SwB tools it will use.

## Use MCP Events [#mcp-events]

MCP Events sends a notice when a message arrives. Enable the [OpenClaw MCP Events plugin](https://docs.openclaw.ai/automation/mcp-events).

A callback is the address that receives the notices. Set `callbackOrigin` to the public HTTPS origin. Route only `/plugins/mcp-events/callback/` to the gateway. Set `channels.swb.enabled` to `false` when you switch from the channel plugin. Restart the gateway.

Choose `swb` as the server for an OpenClaw event automation. The plugin uses `events/list` to find the events. Select `switchboard.message.created`. Set `mailbox_id` to `openclaw`. The plugin subscribes through `events/subscribe`. Read the message with `get_message` and the event's `message_id`. Answer with `reply` and the conversation handle.

## Check the connection [#check-connection]

Send a test message to `agent:openclaw` from a SwB owner agent. Ask OpenClaw to read it with `inbox`. Ask it to answer with `reply` and the message handle.
