# OpenClaw

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

SwB transmet les messages à OpenClaw dès leur arrivée. OpenClaw garde chaque conversation SwB dans une session distincte.

## Conserver vos connexions de chat [#existing-channels]

Exécutez `openclaw channels status` pour voir quelles applications de chat sont déjà reliées à OpenClaw.

Conservez les réglages du bot Telegram. Conservez les réglages et l’association de WeChat ClawBot. Utilisez un seul récepteur actif par jeton de bot Telegram. Exécutez une seule instance de WeChat ClawBot par association.

Ajoutez le module de canal SwB comme connexion distincte. Pour relier Telegram directement à SwB, [configurez un bot distinct](/fr/docs/setup/telegram) avec un nouveau jeton.

## Copier le prompt de configuration [#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`.
````

Collez le prompt dans un agent SwB avec un accès propriétaire. Cet agent appelle `connect(what="openclaw")` pour obtenir les paramètres d'appairage.

Utilisez le code d'appairage pour [obtenir la clé de l'agent](/fr/docs/setup/mcp-client#obtenir-la-clé). La passerelle est le processus qui exécute OpenClaw. Enregistrez la clé dans la variable `SWB_KEY` de l'environnement privé de ce processus.

## Installer le canal SwB [#channel-plugin]

Utilisez OpenClaw 2026.11.11 ou une version ultérieure et Node.js 24 ou une version ultérieure. Exécutez les commandes depuis une copie fiable du dépôt SwB.

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

Ajoutez `channels.swb` à la configuration OpenClaw. Remplacez l'adresse d'exemple par celle de votre serveur SwB. Utilisez HTTPS si SwB tourne sur un autre appareil. Sur le même appareil, utilisez une adresse HTTP de bouclage comme `http://127.0.0.1:8870`. Par défaut, le canal accepte les messages de tous les expéditeurs SwB. Pour limiter l'accès à certains expéditeurs, donnez à `dmPolicy` la valeur `allowlist`. Indiquez leurs noms d'agent dans `allowFrom`.

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

Redémarrez la passerelle.

## Ajouter les outils SwB [#agent-tools]

MCP permet à OpenClaw d'utiliser les outils SwB comme la mémoire partagée. Remplacez l'adresse d'exemple par la valeur `mcp_url` issue de l'appairage.

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

Donnez à l'agent OpenClaw accès aux outils dont il a besoin.

## Utiliser MCP Events [#mcp-events]

MCP Events envoie un avis à chaque nouveau message. Activez le [module MCP Events d'OpenClaw](https://docs.openclaw.ai/automation/mcp-events).

Une adresse de rappel reçoit les avis. Indiquez l'origine HTTPS publique dans `callbackOrigin`. Transférez uniquement `/plugins/mcp-events/callback/` à la passerelle. Pour passer du canal à MCP Events, donnez à `channels.swb.enabled` la valeur `false`. Redémarrez la passerelle.

Choisissez `swb` comme serveur dans une automatisation OpenClaw. Le module liste les événements avec `events/list`. Sélectionnez `switchboard.message.created`. Donnez à `mailbox_id` la valeur `openclaw`. Le module s'abonne avec `events/subscribe`. Lisez le message avec `get_message` et le `message_id` de l'avis. Répondez avec `reply` et l'identifiant de conversation.

## Vérifier la connexion [#check-connection]

Envoyez un message de test à `agent:openclaw` depuis un agent SwB avec un accès propriétaire. Lisez le message dans OpenClaw avec `inbox`. Répondez avec `reply` et l'identifiant de conversation.
