An OpenClaw plugin that adds OpenChat as a channel. Users interact with the AI agent by sending a /prompt command to a bot in OpenChat.
- OpenClaw gateway running and accessible from the internet (OpenChat needs to reach your
/bot_definitionand/execute_commandendpoints) opensslon your PATH (for key generation)- Node 22+
openclaw plugins install @open-ic/openchat_openclawnpx --package @open-ic/openchat_openclaw generate-keyThis generates a secp256k1 private key, writes it to ~/.openclaw/openchat-bot.pem (mode 600), and prints the corresponding Internet Computer principal. Save the principal — you'll need it when registering the bot on OpenChat.
The plugin requires two env vars that must be set before starting the gateway. Add them to ~/.openclaw/.env (or export them in your shell):
# OpenChat's ES256 public key — used to verify JWTs on incoming bot commands.
# Obtain from: https://oc.app/api
OC_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
# User index canister ID — provided by OpenChat for your deployment.
OC_USER_INDEX_CANISTER="<canister-id>"| Variable | Required | Default | Description |
|---|---|---|---|
OC_PUBLIC_KEY |
Yes | — | OpenChat's ES256 public key for JWT verification |
OC_USER_INDEX_CANISTER |
Yes | — | OpenChat user index canister ID |
OC_PRIVATE_KEY |
See below | — | Bot private key PEM (alternative to config) |
OC_IC_HOST |
No | https://icp-api.io |
Internet Computer host (override for local replicas) |
OC_STORAGE_INDEX_CANISTER |
No | nbpzs-kqaaa-aaaar-qaaua-cai |
Storage index canister ID |
The bot private key (from step 1) can be supplied in three ways, in priority order:
Option A — Key file (recommended):
The generate-key script writes the PEM to ~/.openclaw/openchat-bot.pem and prints the exact command to run:
openclaw config set channels.openchat.privateKeyFile ~/.openclaw/openchat-bot.pemOption B — Env var:
# In ~/.openclaw/.env or your shell:
OC_PRIVATE_KEY="-----BEGIN EC PRIVATE KEY-----\n...\n-----END EC PRIVATE KEY-----"Option C — Inline config (not recommended for production):
openclaw config set channels.openchat.privateKey "-----BEGIN EC PRIVATE KEY-----\n..."openclaw gateway runOnce the gateway is running and reachable from the browser, go to oc.app, run the /register_bot command from any chat. To register the bot you can give it the name and avatar of your choice and you will also need the following two details.
- Gateway endpoint origin:
https://<your-gateway-host>:<gateway-port> - Principal: the value printed in step 1
OpenChat will call GET /bot_definition to verify your endpoint is reachable before completing registration, and POST /execute_command each time a user sends /prompt.
Search for the bot you registered as if searching for a user. Install the bot as a direct chat (which involves accepting the required permissions). Start talking to the bot! Congratulations, you are now talking to OpenClaw directly from OpenChat.
At the moment this plugin uses a /prompt command and can only interact with OpenChat using the command's jwt. This means that we can only current do request -> response interactions and not autonomous interactions e.g. Heartbeat. I will be giving some thought to how that autonomous interaction scenario can be best supported.