openclaw-plugin-wecom is an Enterprise WeChat (WeCom) integration plugin developed for the OpenClaw framework. It enables seamless AI capabilities in Enterprise WeChat with advanced features.
- Streaming Output: Built on WeCom's latest AI bot streaming mechanism for smooth typewriter-style responses.
- Dynamic Agent Management: Automatically creates isolated agents per direct message user or group chat, with independent workspaces and conversation contexts.
- Deep Group Chat Integration: Supports group message parsing with @mention triggering.
- Rich Message Types: Handles text, image, voice, mixed (text+image), file, location, and link messages.
- Inbound Image Decryption: Automatically decrypts WeCom-encrypted images using AES-256-CBC for AI vision processing.
- Outbound Image Support: Automatic base64 encoding and sending of local images (screenshots, generated images) via
msg_itemAPI. - Message Debounce: Rapid consecutive messages from the same user are merged into a single AI request.
- Admin Users: Configurable admin list that bypasses command allowlist and dynamic agent routing.
- Command Allowlist: Built-in commands (e.g.,
/new,/status) with configurable allowlist to restrict sensitive operations. - Security & Authentication: Full support for WeCom message encryption/decryption, URL verification, and sender validation.
- High-Performance Async Processing: Asynchronous message architecture ensures responsive gateway even during long AI inference.
- OpenClaw installed (version 2026.1.30+)
- Enterprise WeChat admin access to create intelligent robot applications
- Server address accessible from Enterprise WeChat (HTTP/HTTPS)
openclaw plugins install @sunnoy/wecomThis command will automatically:
- Download the plugin from npm
- Install to
~/.openclaw/extensions/ - Update your OpenClaw configuration
- Register the plugin
Add to your OpenClaw configuration file (~/.openclaw/openclaw.json):
{
"plugins": {
"entries": {
"wecom": {
"enabled": true
}
}
},
"channels": {
"wecom": {
"enabled": true,
"token": "Your Token",
"encodingAesKey": "Your EncodingAESKey",
"adminUsers": ["admin-userid"],
"commands": {
"enabled": true,
"allowlist": ["/new", "/status", "/help", "/compact"]
}
}
}
}| Option | Type | Required | Description |
|---|---|---|---|
plugins.entries.wecom.enabled |
boolean | Yes | Enable the plugin |
channels.wecom.token |
string | Yes | WeCom bot Token |
channels.wecom.encodingAesKey |
string | Yes | WeCom message encryption key (43 chars) |
channels.wecom.adminUsers |
array | No | Admin user IDs (bypass command allowlist and dynamic routing) |
channels.wecom.commands.allowlist |
array | No | Command allowlist |
- Log in to Enterprise WeChat Admin Console
- Navigate to "Application Management" > "Applications" > "Create Application" > Select "Intelligent Robot"
- Configure "Receive Messages":
- URL:
https://your-domain.com/webhooks/wecom - Token: Match
channels.wecom.token - EncodingAESKey: Match
channels.wecom.encodingAesKey
- URL:
- Save and enable message receiving
| Type | Direction | Description |
|---|---|---|
| Text | Inbound/Outbound | Plain text messages |
| Image | Inbound/Outbound | Encrypted images (inbound are auto-decrypted); outbound via msg_item base64 |
| Voice | Inbound | Auto-transcribed by WeCom, processed as text (DM only) |
| Mixed | Inbound | Text + image combination messages |
| File | Inbound | File attachments (downloaded and passed to AI for analysis) |
| Location | Inbound | Location shares (converted to text description) |
| Link | Inbound | Shared links (title, description, URL extracted as text) |
Admin users bypass the command allowlist and skip dynamic agent routing (routed to the main agent directly).
{
"channels": {
"wecom": {
"adminUsers": ["user1", "user2"]
}
}
}Admin user IDs are case-insensitive and matched against the WeCom userid field.
The plugin implements per-user/per-group agent isolation:
- When a WeCom message arrives, the plugin generates a deterministic
agentId:- Direct Messages:
wecom-dm-<userId> - Group Chats:
wecom-group-<chatId>
- Direct Messages:
- OpenClaw automatically creates/reuses the corresponding agent workspace
- Each user/group has independent conversation history and context
- Admin users skip dynamic routing and use the main agent directly
Configure under channels.wecom:
{
"channels": {
"wecom": {
"dynamicAgents": {
"enabled": true
},
"dm": {
"createAgentOnFirstMessage": true
},
"groupChat": {
"enabled": true,
"requireMention": true
}
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
dynamicAgents.enabled |
boolean | true |
Enable dynamic agents |
dm.createAgentOnFirstMessage |
boolean | true |
Use dynamic agents for DMs |
groupChat.enabled |
boolean | true |
Enable group chat processing |
groupChat.requireMention |
boolean | true |
Require @mention in groups |
To route all messages to the default agent:
{
"channels": {
"wecom": {
"dynamicAgents": { "enabled": false }
}
}
}Prevent regular users from executing sensitive Gateway management commands through WeCom messages.
{
"channels": {
"wecom": {
"commands": {
"enabled": true,
"allowlist": ["/new", "/status", "/help", "/compact"]
}
}
}
}| Command | Description | Safety Level |
|---|---|---|
/new |
Reset conversation, start new session | User-level |
/compact |
Compress current session context | User-level |
/help |
Show help information | User-level |
/status |
Show Agent status | User-level |
Security Note: Do not add
/gateway,/plugins, or other management commands to the allowlist to prevent regular users from gaining Gateway instance admin privileges. Admin users configured inadminUsersbypass this restriction.
When a user sends multiple messages in rapid succession (within 2 seconds), the plugin automatically merges them into a single AI request. This prevents multiple concurrent LLM calls for the same user and provides a more coherent response.
- The first message's stream receives the AI response
- Subsequent merged messages show a notice that they have been combined
- Commands (messages starting with
/) bypass debounce and are processed immediately
A: WeCom encrypts images sent by users with AES-256-CBC. The plugin automatically:
- Downloads the encrypted image from WeCom's URL
- Decrypts it using the configured
encodingAesKey - Saves it locally and passes it to the AI for vision analysis
Mixed messages (text + images) are fully supported — text and images are extracted and sent together.
A: The plugin automatically handles images generated by OpenClaw (such as browser screenshots):
- Local images (from
~/.openclaw/media/) are automatically encoded to base64 and sent via WeCom'smsg_itemAPI - Image constraints: Max 2MB per image, supports JPG and PNG formats, up to 10 images per message
- No configuration needed: Works out of the box with tools like browser screenshot
- Images appear when the AI completes its response (streaming doesn't support incremental image sending)
If an image fails to process (size limit, invalid format), the text response will still be delivered and an error will be logged.
A: Yes! Voice messages in direct chats are automatically transcribed by WeCom and processed as text. No additional configuration needed.
A: Yes. Files sent by users are downloaded and passed to the AI as attachments. The AI can analyze file contents (e.g., reading a PDF or parsing a code file). MIME types are auto-detected from the file extension.
A: WeCom bot does not need OpenClaw's Gateway Auth Token.
-
Gateway Auth Token (
gateway.auth.token) is used for:- WebUI access authentication
- WebSocket connection authentication
- CLI remote connection authentication
-
WeCom Webhook (
/webhooks/wecom) authentication:- Uses WeCom's own signature verification (Token + EncodingAESKey)
- Does not require Gateway Auth Token
- OpenClaw plugin system automatically handles webhook routing
Deployment suggestions:
- If using a reverse proxy (e.g., Nginx), configure authentication exemption for
/webhooks/wecompath - Or expose the webhook endpoint on a separate port without Gateway Auth
A: Common causes and solutions:
-
Check configuration key name: Ensure correct key name
encodingAesKey(case-sensitive){ "channels": { "wecom": { "encodingAesKey": "..." } } } -
Check key length: EncodingAESKey must be exactly 43 characters
# Check length echo -n "your-key" | wc -c
-
Check for extra spaces/newlines: Ensure no leading/trailing whitespace in the key string
openclaw-plugin-wecom/
├── index.js # Plugin entry point
├── webhook.js # WeCom HTTP communication handler
├── dynamic-agent.js # Dynamic agent routing logic
├── stream-manager.js # Streaming response manager
├── image-processor.js # Image encoding/validation for msg_item
├── crypto.js # WeCom encryption algorithms (message + media)
├── logger.js # Logging module
├── utils.js # Utility functions (TTL cache, deduplication)
├── package.json # npm package config
└── openclaw.plugin.json # OpenClaw plugin manifest
We welcome contributions! Please submit Issues or Pull Requests for bugs or feature suggestions.
See CONTRIBUTING.md for details.
This project is licensed under the ISC License.