This is a basic, locally developed OpenClaw plugin for Enterprise WeChat (WeCom). It supports concurrent integration with multiple WeCom applications, including both Intelligent Robot and Self-Built Apps. It handles core message parsing, basic AI integration, and appropriate responses (streaming JSON or passive XML).
CorpID from inbound messages for Self-Built Apps, for secure communication.To install this plugin locally:
Copy the plugin directory to your OpenClaw extensions folder:
cp -r /mnt/codeserver/project/WeComCompanyPlugin ~/.openclaw/extensions/
Enable the plugin and configure applications in openclaw.json:
Add or modify the channels.wecom section in your OpenClaw configuration file (~/.openclaw/openclaw.json). You will define an array of applications, where each object configures a distinct WeCom integration.
{
"plugins": {
"entries": {
"WeComCompanyPlugin": { // This key MUST match your plugin folder name
"enabled": true
}
// ... other plugins if any
}
},
"channels": {
"wecom": {
"enabled": true,
"applications": [
{
"id": "my_ai_bot", // Unique ID for your AI Bot application
"enabled": true,
"token": "YOUR_AI_BOT_TOKEN",
"encodingAesKey": "YOUR_AI_BOT_ENCODING_AES_KEY",
"isSelfBuiltApp": false, // Set to false for AI Bot
"webhookPath": "/webhooks/wecom/ai_bot" // Unique URL path for this bot
},
{
"id": "my_self_built_app", // Unique ID for your Self-Built App application
"enabled": true,
"token": "YOUR_SELF_BUILT_TOKEN",
"encodingAesKey": "YOUR_SELF_BUILT_ENCODING_AES_KEY",
"isSelfBuiltApp": true, // Set to true for Self-Built App
"webhookPath": "/webhooks/wecom/self_built" // Unique URL path for this app
}
]
}
}
}
Replace placeholder values with your actual WeCom application details. Ensure webhookPath is unique for each application. If webhookPath is omitted, it defaults to /webhooks/wecom/<application_id>.
Restart OpenClaw for the changes to take effect.
openclaw gateway restart
Under channels.wecom.applications (an array of objects):
| Option | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | A unique identifier for this WeCom application within your OpenClaw configuration. |
enabled |
boolean | No | Set to true to enable this specific WeCom application. Default: true. |
token |
string | Yes | The WeCom bot Token obtained from the application's admin console. |
encodingAesKey |
string | Yes | The WeCom message encryption key (43 characters) from the application's admin console. |
isSelfBuiltApp |
boolean | No | Crucial: Set to true if this application is a Self-Built App (uses XML, passive replies). Set to false for an Intelligent Bot (uses JSON, streaming replies). Default: false. |
webhookPath |
string | No | The unique URL path where this application's messages will be received by OpenClaw. If not specified, it defaults to /webhooks/wecom/<application_id>. |
Follow these steps in the Enterprise WeChat Admin Console for each application you configure:
webhookPath configured for this AI Bot in openclaw.json (e.g., https://your-domain.com/webhooks/wecom/ai_bot). Ensure this URL is publicly accessible.token specified for this AI Bot in openclaw.json.encodingAesKey specified for this AI Bot in openclaw.json.webhookPath configured for this Self-Built App in openclaw.json (e.g., https://your-domain.com/webhooks/wecom/self_built). Ensure this URL is publicly accessible.token specified for this Self-Built App in openclaw.json.encodingAesKey specified for this Self-Built App in openclaw.json.Important: For Self-Built Apps, ensure isSelfBuiltApp is set to true in your openclaw.json configuration for that specific application.
A: The plugin dynamically identifies the target application based on the incoming webhook URL. For each request, it:
token, encodingAesKey, and optionally corpId associated with the identified application.CorpID from the decrypted inbound message and uses it for constructing secure passive replies.A: The plugin automatically handles images generated by OpenClaw (such as browser screenshots):
~/.openclaw/media/) are automatically encoded to base64 and sent via WeCom's msg_item API. Images appear when the AI completes its response.WeComCompanyPlugin/ ├── index.js # Plugin entry point (main plugin logic and HTTP handler, multi-app routing) ├── wecom-message-processor.js # Core logic for message processing and dispatching ├── webhook.js # WeCom HTTP communication handler, message/event parser (JSON/XML), and reply builder ├── crypto.js # WeCom encryption algorithms (message + media) ├── logger.js # Logging module ├── stream-manager.js # Streaming response manager (for AI Bot mode) ├── utils.js # Utility functions (TTL cache, deduplication) ├── package.json # npm package config └── openclaw.plugin.json # OpenClaw plugin manifest