WeCom (Enterprise WeChat) Integration
Table of contents
WeCom integration with webhook or API mode.
Features
- Two Modes: Webhook (simple, one-way) or API (bidirectional)
- Corporate Integration: Full enterprise WeChat support
- Message Queue: Sequential processing
Modes
Webhook Mode (Simple, One-Way)
Simplest setup, but only supports sending messages to WeCom.
API Mode (Advanced, Bidirectional)
Full bidirectional communication, requires corporate approval.
Setup Guide
Webhook Mode
- Add a webhook robot in WeCom group
- Copy the webhook key
- Configure:
require('chat').setup({
integrations = {
wecom = {
webhook_key = 'YOUR_WEBHOOK_KEY',
},
},
})
Webhook mode is the simplest setup but only supports one-way communication.
API Mode
- Create an enterprise application
- Get CorpID, CorpSecret, and AgentID
- Configure:
require('chat').setup({
integrations = {
wecom = {
corp_id = 'YOUR_CORP_ID',
corp_secret = 'YOUR_CORP_SECRET',
agent_id = 'YOUR_AGENT_ID',
user_id = 'YOUR_USER_ID',
},
},
})
API mode requires corporate approval and proper application setup.
Commands
| Command | Description |
|---|---|
:Chat bridge wecom |
Bind current session to WeCom |
Technical Details
- API: WeCom API
- Authentication: Access Token (auto-refresh)
- Message Limit: 2,048 characters
- State Persistence:
stdpath('data')/chat-wecom-state.json
Troubleshooting
Webhook Not Working
Symptom: Webhook messages not being sent.
Solution:
- Verify webhook key is correct
- Check if the webhook robot is enabled
- Test with a manual webhook request
API Authentication Errors
Symptom: Cannot authenticate with WeCom API.
Solution:
- Verify corp_id and corp_secret are correct
- Check if the application is approved
- Verify agent_id is correct
Next Steps
- Discord Integration - Setup Discord bot
- Telegram Integration - Setup Telegram bot
- IM Integration Overview - All IM integrations