# OpenClaw

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

SwB stellt OpenClaw Nachrichten direkt zu. OpenClaw führt für jede SwB-Unterhaltung eine eigene Sitzung.

## Chatverbindungen beibehalten [#existing-channels]

Führen Sie `openclaw channels status` aus. Der Befehl zeigt die vorhandenen Chatverbindungen zu OpenClaw.

Behalten Sie die Einstellungen des vorhandenen Telegram-Bots bei. Behalten Sie die Einstellungen und die Kopplung des vorhandenen WeChat ClawBot bei. Verwenden Sie pro Telegram-Bot-Token einen aktiven Empfänger. Betreiben Sie pro Kopplung eine WeChat ClawBot-Instanz.

Fügen Sie das SwB-Kanal-Plugin als eigene Verbindung hinzu. Für eine direkte Verbindung zwischen Telegram und SwB [richten Sie einen eigenen Bot ein](/de/docs/setup/telegram). Verwenden Sie ein neues Token.

## Einrichtungsprompt kopieren [#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`.
````

Fügen Sie den Prompt in einen SwB-Agenten mit Inhaberzugriff ein. Er ruft `connect(what="openclaw")` auf und erhält die Kopplungseinstellungen.

Rufen Sie mit dem Kopplungscode [den Agentenschlüssel ab](/de/docs/setup/mcp-client#schlüssel-abrufen). Das Gateway ist der Prozess, der OpenClaw ausführt. Hinterlegen Sie den Schlüssel als `SWB_KEY` in der privaten Umgebung des Gateways.

## SwB-Kanal installieren [#channel-plugin]

Verwenden Sie OpenClaw ab Version 2026.11.11 und Node.js ab Version 24. Führen Sie die Befehle in einer vertrauenswürdigen Kopie des SwB-Repositorys aus.

<Tabs items={['Lokaler Ordner', 'Paketarchiv']}>
<Tab value="Lokaler Ordner">
```sh
cd integrations/openclaw
npm ci --omit=dev
openclaw plugins install --link --force --accept-capabilities "$PWD"
```
</Tab>
<Tab value="Paketarchiv">
```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>

Fügen Sie `channels.swb` zur OpenClaw-Konfiguration hinzu. Ersetzen Sie die Beispieladresse durch Ihre SwB-Adresse. Verwenden Sie HTTPS für SwB auf einem anderen Gerät. Verwenden Sie auf demselben Gerät eine HTTP-Loopback-Adresse wie `http://127.0.0.1:8870`. Der Kanal nimmt standardmäßig Nachrichten aller SwB-Absender an. Um den Zugriff auf bestimmte SwB-Absender zu beschränken, setzen Sie `dmPolicy` auf `allowlist`. Tragen Sie deren Agentennamen in `allowFrom` ein.

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

Starten Sie das Gateway neu.

## SwB-Werkzeuge hinzufügen [#agent-tools]

Mit MCP kann OpenClaw SwB-Werkzeuge wie den gemeinsamen Speicher nutzen. Ersetzen Sie die Beispieladresse durch `mcp_url` aus der Kopplung.

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

Geben Sie dem OpenClaw-Agenten Zugriff auf die benötigten Werkzeuge.

## MCP Events verwenden [#mcp-events]

MCP Events meldet neue Nachrichten. Aktivieren Sie [MCP Events in OpenClaw](https://docs.openclaw.ai/automation/mcp-events).

Ein Rückruf empfängt die Meldungen an einer Webadresse. Setzen Sie `callbackOrigin` auf den öffentlichen HTTPS-Ursprung. Leiten Sie ausschließlich `/plugins/mcp-events/callback/` an das Gateway weiter. Setzen Sie beim Wechsel vom Kanal `channels.swb.enabled` auf `false`. Starten Sie das Gateway neu.

Wählen Sie `swb` als Server für eine OpenClaw-Automatisierung. Die Erweiterung zeigt die Ereignisse mit `events/list` an. Wählen Sie `switchboard.message.created`. Setzen Sie `mailbox_id` auf `openclaw`. Die Erweiterung abonniert das Ereignis mit `events/subscribe`. Lesen Sie die Nachricht mit `get_message` und der `message_id` aus der Meldung. Antworten Sie mit `reply` und der Unterhaltungskennung.

## Verbindung prüfen [#check-connection]

Senden Sie von einem SwB-Agenten mit Inhaberzugriff eine Testnachricht an `agent:openclaw`. Lesen Sie die Nachricht in OpenClaw mit `inbox`. Antworten Sie mit `reply` und der Unterhaltungskennung.
