DingTalk
DingTalk access uses DingTalk Stream Mode so users can DM or mention the bot to query, control, and collaborate from DingTalk; the channel is text-first and replies in the original conversation.
Usage Modes
| Mode | Trigger | Notes |
|---|---|---|
| Bot DM | Send text directly to the bot | Good for personal remote status queries and control commands. |
| Group mention | Mention the bot in a group and enter a question | Good for organization-wide collaboration. Group messages are ignored unless the bot is mentioned. |
Prepare the DingTalk App
- Create an app in the DingTalk developer console.
- Enable bot capability.
- Set message receiving mode to Stream Mode.
- Copy
Client IDandClient Secretfrom app information. - Publish the app.
- DM the bot or add it to a group. In groups, mention the bot.
Configure Device Agent
Open Settings → Channels → DingTalk and fill in:
| Field | .env | Description |
|---|---|---|
| Enabled | DINGTALK_ENABLED | Starts the DingTalk channel |
| Client ID | DINGTALK_CLIENT_ID | DingTalk Client ID, previously called AppKey |
| Client Secret | DINGTALK_CLIENT_SECRET | DingTalk Client Secret, previously called AppSecret |
| Allow list | DINGTALK_ALLOW_FROM | Optional employee ID allow list |
You can also configure it in .env:
bash
DINGTALK_ENABLED=true
DINGTALK_CLIENT_ID=dingxxxxxxxxxxxx
DINGTALK_CLIENT_SECRET=xxxxxxxxxxxxxxxx
DINGTALK_ALLOW_FROM=user1,user2Restart the service after saving.
Verify Access
- Confirm the service has restarted.
- Check logs for
DingTalk: enabledandChannel started (Stream Mode). - Send a DM to the bot, or mention the bot in a group.
- If the allow list is enabled, make sure the sender employee ID is included.
When replying, Device Agent first uses the session callback from DingTalk. If that is unavailable, it falls back to DingTalk OpenAPI for the original conversation.
Checks
- No reply: confirm the app is published, the bot is in the conversation, and Stream Mode is enabled.
- No group response: confirm the bot is mentioned.
- Allow list blocks messages: use employee IDs, not display names.