DingTalk Integration
Table of contents
DingTalk integration with webhook or API mode.
Features
- Two Modes: Webhook (simple, one-way) or API (bidirectional)
- Message Queue: Sequential message processing
- Long Message Support: Auto-chunking for messages > 20,000 characters
Modes
Webhook Mode (Simple, One-Way)
Simplest setup, but only supports sending messages to DingTalk.
API Mode (Advanced, Bidirectional)
Full bidirectional communication, requires enterprise app registration.
Setup Guide
Webhook Mode
- Create a custom robot in DingTalk group
- Copy the webhook URL
- Configure:
require('chat').setup({
integrations = {
dingtalk = {
webhook = 'https://oapi.dingtalk.com/robot/send?access_token=XXX',
},
},
})
Webhook mode is the simplest setup but only supports one-way communication.
API Mode
- Create an enterprise internal app
- Get AppKey and AppSecret
- Configure:
require('chat').setup({
integrations = {
dingtalk = {
app_key = 'YOUR_APP_KEY',
app_secret = 'YOUR_APP_SECRET',
conversation_id = 'YOUR_CONVERSATION_ID',
user_id = 'YOUR_USER_ID',
},
},
})
API mode requires enterprise app registration and approval.
Commands
| Command | Description |
|---|---|
:Chat bridge dingtalk |
Bind current session to DingTalk |
Technical Details
- API: DingTalk Open Platform API
- Authentication: Access Token (auto-refresh)
- Message Limit: 20,000 characters
- State Persistence:
stdpath('data')/chat-dingtalk-state.json
Troubleshooting
Webhook Not Working
Symptom: Webhook messages not being sent.
Solution:
- Verify webhook URL is correct
- Check if the webhook is enabled
- Test the webhook with a manual request
API Authentication Errors
Symptom: Cannot authenticate with DingTalk API.
Solution:
- Verify app_key and app_secret are correct
- Check if the app is approved
- Verify access token is being refreshed
Next Steps
- Discord Integration - Setup Discord bot
- Telegram Integration - Setup Telegram bot
- IM Integration Overview - All IM integrations