@ferby/moltbot-plugin-dingtalk-wecom
v0.1.3
Published
Moltbot plugin for DingTalk (Stream Mode) and WeCom (Webhook)
Maintainers
Readme
Clawdbot DingTalk & WeCom Plugin
This plugin adds support for DingTalk (钉钉) and WeCom (企业微信) channels to Clawdbot.
Features
- DingTalk: Uses Stream Mode (WebSocket). No public IP or webhook configuration required inside DingTalk.
- WeCom: Uses Webhook Mode. Requires a publicly accessible URL (or reverse proxy) to receive messages.
Installation
- Clone the repository.
- Install dependencies:
npm installNote: If you encounter permission errors, try running
sudo chown -R $(whoami) ~/.npmor usesudo(not recommended).
Configuration
This plugin is configured via your Clawdbot configuration file (e.g., clawdbot.config.yaml).
1. DingTalk (Stream Mode)
Prerequisites:
- Go to DingTalk Open Platform.
- Create an Internal Enterprise Robot (应用开发 -> 企业内部开发 -> 机器人).
- In the app settings, go to Rights Management (权限管理) or Development Configuration (开发配置).
- Find Stream Mode (Stream 模式) and enable it.
- Ensure the "Bot Message Callback" topic is subscribed.
- Publish the application.
- Copy AppKey and AppSecret.
Config:
channels:
dingtalk:
enabled: true
appKey: "YOUR_DINGTALK_APP_KEY"
appSecret: "YOUR_DINGTALK_APP_SECRET"
# Policies (Optional)
# dmPolicy: "open" # "open", "pairing", or "allowlist"
# groupPolicy: "open"2. WeCom (Webhook)
Prerequisites:
- Go to WeCom Admin Console.
- Create a Self-built Application (应用管理 -> 自建).
- Copy AgentId and Secret.
- Copy CorpId (My Enterprise -> Enterprise Info).
- In the app settings, go to Receive API (接收消息).
- URL:
http://YOUR_SERVER_IP:3001/wecom/webhook - Token: Generate a random string.
- EncodingAESKey: Generate a random key.
- URL:
- Important: Click "Save" in WeCom after starting Clawdbot. WeCom validates the URL immediately.
Config:
channels:
wecom:
enabled: true
corpId: "YOUR_CORP_ID"
agentId: "YOUR_AGENT_ID"
secret: "YOUR_WECOM_SECRET"
token: "YOUR_WECOM_TOKEN"
encodingAESKey: "YOUR_WECOM_AES_KEY"
# Optional
# webhookPath: "/wecom/webhook" # DefaultRunning
- Start Clawdbot as usual.
- DingTalk: You should see a log message
dingtalk: stream client connected. - WeCom: Ensure port 3001 is open and accessible from the internet. When you click "Save" in WeCom admin, it will hit this port.
Usage
- DingTalk: Send a message to the robot in a DM or mention it in a group.
- WeCom: Send a message to the application in WeCom.
Troubleshooting
- DingTalk Disconnects: Check if AppKey/Secret are correct and if the app is published.
- WeCom Url Validation Failed:
- Ensure Clawdbot is running and port 3001 is reachable.
- Ensure
tokenandencodingAESKeyin config match WeCom exactly. - Check logs for signature verification errors.
