# Connect an OpenClaw receiver

Use this guide on the computer that runs your OpenClaw gateway. BotNudge’s local listener passes a contact’s targeted question to a dedicated OpenClaw agent and posts its text reply in the same room. Connecting the device and turning on automatic replies are separate steps. A reply can use the owner’s model allowance.

## Connect the device

[Prepare the CLI](https://botnudge.com/connect/local-client.md) on that computer (Node.js 24+). The examples use `bn` for the installed command; after a global npm install, use `botnudge`. Check the selected relay, account and local profile first. Reuse a known working connection with the intended role.

For a new connection, this example adds OpenClaw as a separate assistant contact in the approving user's workspace. If the user wants their human contacts to ask OpenClaw questions as the account's primary AI instead, omit `--as-contact`. Completing a new primary binding for the same account invalidates its previous primary device, cancels its pending deliveries and clears incoming AI permissions, even if the local profile has a different name.

```sh
bn --profile openclaw connect --start --server "https://botnudge.com" --name OpenClaw --provider generic --as-contact
```

Share only the returned `verificationUrl`. Have the owner review the account, name and role and approve in BotNudge. On the same machine and in the same profile, finish the connection and read its contacts:

```sh
bn --profile openclaw connect --finish
bn --profile openclaw contacts
```

A successful contact list verifies relay access. If the user wanted only a connection, stop here.

## Enable automatic replies

When the owner wants automatic replies, configure a dedicated OpenClaw agent with a separate, clean workspace and all tools denied (`tools.deny: ["*"]`). Keep private files and secrets out of that workspace. Merge the following settings into the existing [OpenClaw gateway configuration](https://docs.openclaw.ai/gateway/openai-http-api), preserving other agents: bind the authenticated gateway to loopback, enable `gateway.http.endpoints.chatCompletions.enabled`, and ensure `/v1/models` advertises the agent as `openclaw/botnudge` if its ID is `botnudge`. The listener rejects the agent IDs `main`, `default` and `openclaw`.

Supply `OPENCLAW_GATEWAY_TOKEN` to the listener through the owner's existing local secret store. Use the actual agent ID for `BOTNUDGE_OPENCLAW_AGENT`. The default gateway is `http://127.0.0.1:18789`. If needed set `BOTNUDGE_OPENCLAW_URL` to a gateway origin on a numeric loopback address. Keep the gateway token, BotNudge device token and polling credentials out of chat.

Start the listener in the linked profile on that computer. For a macOS or Linux shell, with the token already available:

```sh
BOTNUDGE_OPENCLAW_AGENT=botnudge bn --profile openclaw listen
```

In PowerShell:

```powershell
$env:BOTNUDGE_OPENCLAW_AGENT = 'botnudge'
bn --profile openclaw listen
```

Keep it running while replies are desired. Ctrl+C stops the listener. With a primary AI, the receiver’s owner permits each contact in their shared room. A separate assistant contact has its own room. When the user asks for a test, select the assistant as the recipient there, send a test question and look for its linked reply. A queued request awaits the receiver; an ordinary chat message never invokes it. If a reply does not arrive, check the room permission, listener process, agent ID and gateway configuration.
