Prerequisites
- OpenClaw gateway running and accessible (see Deploy on VPS)
- A DingTalk developer account at open.dingtalk.com
- Admin access to your DingTalk organization
Step 1 — Install the DingTalk Plugin
OpenClaw uses the openclaw-china plugin for DingTalk, WeCom, and Feishu integrations.
npm install -g openclaw-plugin-dingtalk
# Verify plugin is registered
openclaw plugins listStep 2 — Create a DingTalk App
- Go to DingTalk Open Platform → Create Application
- Select Robot type
- Set the Message Receive Mode to Stream Mode (preferred over webhook — no public URL needed)
- Under Permissions, enable:
qyapi_chat_manage,qyapi_robot_sendmsg - Copy your App Key and App Secret
Step 3 — Configure OpenClaw
Add DingTalk credentials to your secrets file and channel config:
DINGTALK_APP_KEY=your-app-key-here
DINGTALK_APP_SECRET=your-app-secret-here
# For webhook mode only:
# DINGTALK_WEBHOOK_TOKEN=your-webhook-token{
"channels": {
"dingtalk": {
"enabled": true,
"mode": "stream",
"app_key": "${DINGTALK_APP_KEY}",
"app_secret": "${DINGTALK_APP_SECRET}",
"respond_to_mentions": true,
"respond_to_private": true,
"default_agent": "main"
}
}
}Step 4 — Stream Mode vs Webhook Mode
Stream Mode (recommended): OpenClaw maintains a persistent connection to DingTalk servers — no public URL or webhook registration needed. Works behind NAT and firewalls.
Webhook Mode: DingTalk POSTs to your public URL. Requires a publicly accessible endpoint and signature verification.
# DingTalk signs requests with HMAC-SHA256
# OpenClaw verifies automatically when DINGTALK_WEBHOOK_TOKEN is set
# Register your webhook URL in DingTalk console:
# https://your-domain.com/webhooks/dingtalkStep 5 — Group Chat @Mention Routing
By default, your bot only responds when @mentioned in group chats. You can configure keyword-based routing:
{
"channels": {
"dingtalk": {
"group_routing": {
"mention_only": true,
"keyword_routes": {
"report": "reporting-agent",
"translate": "translation-agent"
},
"default_agent": "main"
}
}
}
}Common Errors
| Error | Cause | Fix |
|---|---|---|
401 InvalidAppKey | Wrong App Key | Check DingTalk console → App credentials |
Stream connect timeout | Firewall blocking outbound | Allow outbound to api.dingtalk.com:443 |
| Bot not responding in group | Missing @mention or permissions | Enable qyapi_chat_manage permission |
What's Next?
- Connect to Feishu — similar flow, different SDK
- Connect to WeCom — WeChat Work integration
- Browse Templates — DingTalk bot SOUL.md examples