使用官方腾讯插件,将企业微信(WeCom)配置为 OpenClaw 的聊天渠道,采用 WebSocket 长轮询。用于用户想要连接 WeCom 机器人的场景。
Connect OpenClaw to WeCom (企业微信) via the official Tencent WebSocket plugin.
📖 Full WeCom AI Bot docs: https://open.work.weixin.qq.com/help?doc_id=21657
bash
openclaw plugins install @wecom/wecom-openclaw-plugin
Wait for installation to complete. A security warning about "Environment variable access combined with network send" is expected — the plugin needs the bot secret to establish WebSocket connections.
Edit ~/.openclaw/openclaw.json. Add wecom under channels:
json
{
"channels": {
"wecom": {
"enabled": true,
"botId": "<YOUR_BOT_ID>",
"secret": "<YOUR_BOT_SECRET>",
"dmPolicy": "open",
"allowFrom": ["*"],
"groupPolicy": "open"
}
}
}
Also ensure the plugin is allowed and enabled under plugins:
json
{
"plugins": {
"allow": ["wecom-openclaw-plugin"],
"entries": {
"wecom-openclaw-plugin": {
"enabled": true
}
}
}
}
The WeCom channel uses the global default model ( agents.defaults.model.primary). Confirm it points to a provider with sufficient credits:
bash
openclaw models status
If the default model's provider has no balance, update the primary:
json
{
"agents": {
"defaults": {
"model": {
"primary": "<provider>/<model>"
}
}
}
}
bash
openclaw gateway restart
If the restart exits with code 1 or produces no output (common on Windows), verify health manually:
powershell
# PowerShell
Invoke-WebRequest -Uri http://localhost:<port>/health -UseBasicParsing | Select-Object -ExpandProperty Content
# Expected: {"ok":true,"status":"live"}
Send a message to the bot in WeCom. It should reply within a few seconds.
SymptomCauseFixbilling error — API key has run out of creditsDefault model provider has no balanceChange agents.defaults.model.primary to a funded provider, restart gatewaydoctor warning: allowFrom``dmPolicy: "open" requires allowFrom: ["*"]Add "allowFrom": ["*"] to wecom configBot connects but no replyGateway cached old configFull stop + start: openclaw gateway stop, wait 5s, openclaw gateway startWindows CLI outputs nothingPowerShell encoding issueUse --plain flag or check health via HTTP directly
SettingValuesDefaultNotesdmPolicy``pairing / open / allowlist / disabled``openControls who can DM the botallowFromArray of user IDs or ["*"]``[]Required when dmPolicy is open``groupPolicy``open / allowlist / disabled``openControls group chat accessgroupAllowFromArray of group IDs[]Used with groupPolicy: "allowlist"``sendThinkingMessage``true / false``trueShow "thinking…" placeholder while processing
json
{
"channels": {
"wecom": {
"dmPolicy": "allowlist",
"allowFrom": ["user_id_1", "user_id_2"]
}
}
}
json
{
"channels": {
"wecom": {
"groupPolicy": "allowlist",
"groupAllowFrom": ["group_id_1"]
}
}
}