Prerequisites
- A running OpenClaw gateway (see VPS Deploy Recipe)
- A public URL for your gateway (via Cloudflare Tunnel or Reverse Proxy)
- Administrator access to a WeCom Enterprise workspace
Concept: Agent Mode vs. Bot Mode
In WeCom, you can integrate an AI in two ways:
- Internal App (Agent Mode): The AI lives as a standalone app in the WeCom workspace. Users click the app to chat with it. Good for general company assistants.
- Group Bot (Bot Mode): You add the AI to specific group chats via a Webhook URL. It only reads messages where it is @mentioned. Good for DevOps or specific project groups.
This guide focuses on the Internal App (Agent Mode), which is the most robust integration.
Step 1 — Create an Internal App
- Log into the WeCom Admin Console.
- Go to App Management (应用管理) -> Create App (创建应用).
- Upload an icon, give it a name, and select the users who are allowed to see it.
- Once created, note down your AgentId and Secret.
- Go to My Enterprise (我的企业) at the bottom of the sidebar to find your CorpId (企业ID).
Step 2 — Configure OpenClaw Secrets
Add the WeCom credentials to your secrets.env file.
WECOM_CORP_ID=ww_your_corp_id
WECOM_AGENT_ID=1000002
WECOM_CORP_SECRET=your_app_secret
WECOM_TOKEN=your_token_from_step_3
WECOM_ENCODING_AES_KEY=your_aes_key_from_step_3
Restart the gateway: systemctl --user restart openclaw-gateway.
Step 3 — Configure the API Webhook
- In your WeCom App settings page, look for Receive API (接收消息) and click Set via API (设置API接收).
- For the URL, enter your OpenClaw public address: e.g.,
https://your-public-url.com/webhook/wecom. - Click Randomly Generate for both the Token and the EncodingAESKey.
- Copy these two values and put them into your
secrets.env(as shown in Step 2). - Restart your OpenClaw gateway again so it picks up the new Token and AES Key.
- Go back to the WeCom console and click Save (保存). WeCom will send a test handshake to OpenClaw. If the tokens match, it will save successfully.
⚠️ Known Issue: Plugin API Breaking Change
If your OpenClaw gateway crashes on startup with the error TypeError: api.registerHttpHandler is not a function when loading the
WeCom plugin, it means you are hitting a breaking change introduced in OpenClaw v2026.3.2.
The Fix: OpenClaw removed the direct HTTP handler exposure from the plugin API. You need to manually patch the plugin code.
# Go to your global npm installation directory for openclaw
# Find the WeCom index.ts or compiled js file where registerHttpHandler is called
# Example using sed to remove the offending line:
sed -i 's/api.registerHttpHandler(handleWecomWebhookRequest);//g' path/to/openclaw/plugins/wecom/dist/index.js
# Restart the gateway
systemctl --user restart openclaw-gateway
After this fix, message routing handles the webhook internally.
Step 4 — Test the Integration
- Open your WeCom client (desktop or mobile).
- Find the app in your workspace.
- Send it a message. Check the gateway logs with
journalctl --user -u openclaw -f.
Related
- Connect to Feishu (Lark) — integrate with ByteDance's platform
- Plugin API Changes Playbook — surviving breaking updates