Skip to content

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

ModeTriggerNotes
Bot DMSend text directly to the botGood for personal remote status queries and control commands.
Group mentionMention the bot in a group and enter a questionGood for organization-wide collaboration. Group messages are ignored unless the bot is mentioned.

Prepare the DingTalk App

  1. Create an app in the DingTalk developer console.
  2. Enable bot capability.
  3. Set message receiving mode to Stream Mode.
  4. Copy Client ID and Client Secret from app information.
  5. Publish the app.
  6. 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.envDescription
EnabledDINGTALK_ENABLEDStarts the DingTalk channel
Client IDDINGTALK_CLIENT_IDDingTalk Client ID, previously called AppKey
Client SecretDINGTALK_CLIENT_SECRETDingTalk Client Secret, previously called AppSecret
Allow listDINGTALK_ALLOW_FROMOptional 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,user2

Restart the service after saving.

Verify Access

  1. Confirm the service has restarted.
  2. Check logs for DingTalk: enabled and Channel started (Stream Mode).
  3. Send a DM to the bot, or mention the bot in a group.
  4. 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.