MCPcopy Create free account
hub / github.com/WecomTeam/wecom-openclaw-plugin

github.com/WecomTeam/wecom-openclaw-plugin @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
448 symbols 1,084 edges 69 files 169 documented · 38% 2 cross-repo links updated 11d ago★ 463125 open issues

Browse by type

Functions 367 Types & classes 81
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

English | 中文版

💡 快速上手指引 & 交流群

📖 点击查看完整接入指引文档 — 包含配置步骤、产品介绍、常见问题解答等。

💬 扫码加入企业微信交流群:

扫码入群交流

特别说明

*2026.3.22 版本 OpenClaw 兼容说明*

如果你的 OpenClaw 是 2026.3.22 及以上的版本,请升级插件到 2026.3.24 及以上版本。

如果你的 OpenClaw 是 2026.3.22 以下的版本,请保持插件版本在 2026.3.20 版本。

你可以使用以下命令快速安装: npx -y @wecom/wecom-openclaw-cli install --force

🤖 WeCom OpenClaw Plugin

WeCom channel and business capability plugin for OpenClaw — by the Tencent WeCom team.

A channel and business capability plugin powered by WeCom. Supports Bot mode (WebSocket long-polling or HTTP webhook with JSON callbacks), Agent mode (HTTP webhook with XML encrypted callbacks), direct messages, group chats, streaming replies, proactive messaging, and built-in wecom-cli business operations.


📖 WeCom AI Bot Official Documentation

✨ Features

  • 🔗 Dual-mode: Bot (WebSocket / Webhook) and Agent (HTTP webhook) can run independently or together
  • 💬 Supports both direct messages (DM) and group chat
  • 📤 Proactive messaging to specific users, groups, departments, or tags
  • 🖼️ Receives and processes image, voice, video, file, and mixed (图文混排) messages with automatic downloading
  • 🗣️ Voice-to-text: automatically extracts transcribed text from voice messages
  • 💬 Quote message support: processes quoted text, image, voice, and file messages
  • ⏳ Streaming replies with "thinking" placeholder messages (Bot mode)
  • 🔐 Agent mode: AES-256-CBC encrypted XML callbacks with SHA1 signature verification
  • 📝 Markdown formatting support for replies
  • 🃏 Template card messages (text_notice, news_notice, button_interaction, vote_interaction, multiple_interaction) with event callback handling
  • 🔒 Built-in access control: DM Policy (pairing / open / allowlist / disabled) and Group Policy (open / allowlist / disabled)
  • 🔑 Command authorization: per-account command permission control with access group support
  • 👥 Multi-account support: run multiple WeCom accounts with independent bot/agent configs
  • 🧰 Built-in business Skills powered by the plugin-provided wecom-cli tool
  • 🔀 Dynamic Agent routing: auto-create isolated agents per user/group
  • 📁 Local file sending with configurable media path allowlist (mediaLocalRoots)
  • 📊 Smart media size limits with auto-downgrade (image 10MB → file, video 10MB → file, voice 2MB/AMR-only → file, max 20MB)
  • 🔄 Bot-first, Agent-fallback outbound delivery: auto fallback to Agent HTTP API when Bot WS is unavailable
  • ⚡ Auto heartbeat keep-alive and reconnection (up to 10 reconnect attempts, 5 auth failure retries)
  • 🛡️ Anti-kick protection: suppresses auto-restart on server-side disconnection to prevent mutual kicking loops
  • 🧙 Interactive CLI setup wizard

Enterprise Business Capabilities

The plugin includes the wecom-cli tool and corresponding Skills, covering the following WeCom business domains:

Domain Capabilities
💬 Messaging Proactively send messages to direct or group chats that recently interacted with the bot; supports Markdown, image, file, voice, and video messages
📧 Email Send, reply to, and forward email; search messages and retrieve full email details
📄 Documents Create, import, read, append to, and overwrite online documents
🗂️ Document Management Search across multiple document types; rename online documents, spreadsheets, smart sheets, and smart documents; manage members, permissions, and join rules
📊 Spreadsheets Create online spreadsheets, import CSV/Excel files, read and update content, append rows, and manage sheets
🧮 Smart Sheets Create smart sheets; manage sheets, fields, records, views, charts, and row/column styles
📰 Smart Documents Create smart documents, retrieve and edit page content, and access embedded data table information
✅ Todo Create, read, update, and delete todo items; assign participants and mark items as complete
📅 Calendar Create, read, update, and delete events; manage participants, query attendee availability, and search or reserve meeting rooms
🎥 Meetings Schedule, cancel, and update meetings; manage attendees, query meeting lists and details, and retrieve minutes and transcripts
💾 WeDrive Search files, retrieve file metadata, and upload or download files
👤 Contacts Search members by name, pinyin, or alias and retrieve member details for meetings, calendar events, and other multi-user workflows

🚀 Getting Started

Requirements

  • OpenClaw >= 2026.3.28

Quick Install

Use the CLI tool to automatically install the plugin and complete bot configuration in one step:

# Automatically install the channel plugin and quickly complete configuration; also works for updates
npx -y @wecom/wecom-openclaw-cli install

More Options

# If installation fails, try force install
npx -y @wecom/wecom-openclaw-cli install --force

# Use --help to learn more about the tool
npx -y @wecom/wecom-openclaw-cli --help

Manual Install

openclaw plugins install @wecom/wecom-openclaw-plugin

Configuration

Option 1: Interactive Setup

openclaw channels add

Follow the prompts to enter your WeCom bot's Bot ID and Secret.

Option 2: CLI Quick Setup

openclaw config set channels.wecom.botId <YOUR_BOT_ID>
openclaw config set channels.wecom.secret <YOUR_BOT_SECRET>
openclaw config set channels.wecom.enabled true
openclaw gateway restart

Enable Business Tools

The enterprise business capabilities above are exposed through the plugin-provided wecom-cli tool. Unless tools.profile is set to full, allow the plugin and restart the Gateway:

openclaw config set tools.alsoAllow '["wecom-openclaw-plugin"]'
openclaw gateway restart

Allowing the plugin ID enables all tools currently or subsequently registered by this plugin. If tools.alsoAllow already contains other entries, merge wecom-openclaw-plugin into the existing array instead of replacing it.

Mode Overview

The plugin supports two connection modes that can be used independently or together:

Mode Connection Message Format Use Case
Bot (智能体) WebSocket (default) or HTTP webhook JSON Quick setup, streaming replies
Agent (自建应用) HTTP webhook callbacks XML Enterprise apps, API-driven messaging

Note: Bot mode supports two connection methods via connectionMode: - websocket (default) — WebSocket long-polling, requires botId + secret - webhook — HTTP callback, requires token + encodingAESKey

Bot Mode Configuration

Core Settings

Config Path Description Options Default
channels.wecom.enabled Enable the channel true / false false
channels.wecom.connectionMode Bot connection mode websocket / webhook websocket
channels.wecom.name Account display name 企业微信

WebSocket Mode (default)

Config Path Description Options Default
channels.wecom.botId WeCom bot ID
channels.wecom.secret WeCom bot secret
channels.wecom.websocketUrl WebSocket endpoint wss://openws.work.weixin.qq.com
channels.wecom.sendThinkingMessage Send "thinking" placeholder true / false true

Webhook Mode (connectionMode: "webhook")

Config Path Description Options Default
channels.wecom.token Webhook verification token
channels.wecom.encodingAESKey AES encryption key (43 chars Base64)
channels.wecom.receiveId Receiver ID (for decryption verification)
channels.wecom.welcomeText Welcome message on enter_chat event
channels.wecom.streamPlaceholderContent Stream placeholder content

Access Control

Config Path Description Options Default
channels.wecom.dmPolicy DM access policy pairing / open / allowlist / disabled open
channels.wecom.allowFrom DM allowlist (user IDs) []
channels.wecom.groupPolicy Group chat access policy open / allowlist / disabled open
channels.wecom.groupAllowFrom Group allowlist (group IDs) []
channels.wecom.groups Per-group config (e.g. sender allowlist) {}

Media Settings

Config Path Description Default
channels.wecom.mediaLocalRoots Extra local paths allowed for media sending (supports ~) []
channels.wecom.media.maxBytes Max media file size in bytes 20971520 (20MB)
channels.wecom.media.tempDir Temp directory for media processing
channels.wecom.media.retentionHours Media file retention hours
channels.wecom.media.cleanupOnStart Clean temp media on startup

Media Size Limits & Auto-Downgrade:

Media Type Max Size Downgrade Behavior
Image 10 MB Exceeds → sent as file
Video 10 MB Exceeds → sent as file
Voice 2 MB (AMR only) Non-AMR format or exceeds → sent as file
File 20 MB Exceeds → rejected (cannot send)

Network Settings

Config Path Description Default
channels.wecom.network.timeoutMs HTTP request timeout (ms)
channels.wecom.network.retries Number of retries
channels.wecom.network.retryDelayMs Delay between retries (ms)
channels.wecom.network.egressProxyUrl Egress proxy URL for trusted IP scenarios

Egress Proxy Priority: channels.wecom.network.egressProxyUrl > OPENCLAW_WECOM_EGRESS_PROXY_URL > WECOM_EGRESS_PROXY_URL > HTTPS_PROXY > ALL_PROXY > HTTP_PROXY

Agent Mode Configuration

Agent mode uses HTTP webhook callbacks with XML encrypted messages. You need to configure the callback URL in the WeCom admin console under "API Receive" settings.

Prerequisites

  1. Create a self-built app in WeCom Admin Console
  2. Note down the CorpID, CorpSecret (from app settings), and AgentId
  3. In the app settings, go to "API Receive" (API接收):
  4. Note down the Token and EncodingAESKey (auto-generated or custom)
  5. Do NOT click save yet — WeCom will verify the callback URL immediately when you save

Setup Steps

Important: You must configure the Gateway before saving the callback URL in WeCom admin console. WeCom sends a verification request (GET with echostr) immediately when you save, and the Gateway needs the token and encodingAESKey to decrypt and respond correctly.

Step 1: Configure Gateway

openclaw config set channels.wecom.agent.corpId <YOUR_CORP_ID>
openclaw config set channels.wecom.agent.corpSecret <YOUR_CORP_SECRET>
openclaw config set channels.wecom.agent.agentId <YOUR_AGENT_ID>
openclaw config set channels.wecom.agent.token <YOUR_CALLBACK_TOKEN>
openclaw config set channels.wecom.agent.encodingAESKey <YOUR_ENCODING_AES_KEY>
openclaw config set channels.wecom.enabled true
openclaw gateway restart

Step 2: Save callback URL in WeCom admin console

Go back to the "API Receive" settings and enter the callback URL: - URL: https://<your-gateway-host>/plugins/wecom/agent/<accountId> (e.g. /plugins/wecom/agent/default); single-account mode can also use /plugins/wecom/agent

Now click save — the verification should pass.

JSON Configuration

{
  "channels": {
    "wecom": {
      "enabled": true,
      "agent": {
        "corpId": "ww1234567890abcdef",
        "corpSecret": "your-corp-secret",
        "agentId": 1000002,
        "token": "your-callback-token",
        "encodingAESKey": "your-encoding-aes-key-43-chars"
      }
    }
  }
}

Agent Config Reference

Config Path Description Required
channels.wecom.agent.corpId Enterprise Corp ID Yes
channels.wecom.agent.corpSecret App secret Yes
channels.wecom.agent.agentId App agent ID No (needed for proactive messaging)
channels.wecom.agent.token Callback verification token Yes
channels.wecom.agent.encodingAESKey Callback encryption key (43 chars) Yes
channels.wecom.agent.welcomeText Welcome message No
channels.wecom.agent.dmPolicy DM access policy (overrides top-level) No
channels.wecom.agent.allowFrom DM allowlist (overrides top-level) No

Webhook Paths

Agent Mode:

Path Description
/plugins/wecom/agent/<accountId> 推荐路径(例如 /plugins/wecom/agent/default
/plugins/wecom/agent/default 多账号模式下自动路由到默认账号(即使默认账号 ID 不是 default
/plugins/wecom/agent 兼容路径(单账号 / 多账号签名匹配)
/wecom/agent Legacy 兼容路径

Bot Webhook Mode (connectionMode: "webhook"):

Path Description
/plugins/wecom/bot Recommended path (single account)
/plugins/wecom/bot/<accountId> Multi-account path
/wecom/bot Legacy compatible path
/wecom Legacy compatible path

Outbound Delivery (Bot WS → Agent HTTP Fallback)

The plugin uses a Bot-first, Agent-fallback strategy for outbound message delivery:

  1. Bot WebSocket available → send via WS (supports markdown, streaming)
  2. Bot WS unavailable → automatically fallback to Agent HTTP API (cgi-bin/message/send)

This means: - Agent-only accounts (no Bot configured) can still send proactive messages, cron deliveries, and broadcasts - Target formats like party:1, tag:Ops, user:zhangsan are fully supported in both paths - Media fallback: when Bot WS is unava

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 330
Interface 63
Method 37
Class 16
Enum 2

Languages

TypeScript100%

Modules by API surface

src/webhook/helpers.ts32 symbols
src/webhook/state.ts29 symbols
src/state-manager.ts26 symbols
src/mcp/transport.ts26 symbols
src/openclaw-compat.ts20 symbols
src/reqid-store.ts18 symbols
src/monitor.ts17 symbols
src/webhook/handler.ts14 symbols
src/template-card-parser.ts12 symbols
src/template-card-manager.ts12 symbols
src/media-uploader.ts12 symbols
src/agent/handler.ts12 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add wecom-openclaw-plugin \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page