Skip to content

DingTalk Channel ​

xopc connects to DingTalk using the DingTalk Stream WebSocket protocol and Open Platform v1.0 / OAPI endpoints. It supports QR onboarding, multi-account bots, rich media inbound/outbound, optional AI Card streaming, ambient group Realtime events, and native Agent Tools.

Setup ​

Use Set up by QR in the xopc Console, or configure clientId and clientSecret manually in ~/.xopc/xopc.json (or DINGTALK_CLIENT_ID / DINGTALK_CLIENT_SECRET):

json
{
  "channels": {
    "dingtalk": {
      "enabled": true,
      "clientId": "<APP_KEY>",
      "clientSecret": "<APP_SECRET>",
      "dmPolicy": "pairing",
      "groupPolicy": "allowlist",
      "groupAllowFrom": ["<STAFF_USER_ID>"],
      "streaming": {
        "enabled": true,
        "cardTemplateId": "<OPTIONAL_AI_CARD_TEMPLATE_ID>",
        "contentKey": "content",
        "throttleMs": 700
      }
    }
  }
}

Capabilities ​

  • Rich Inbound: Parses text, richText (text + inline images), picture, file, audio (voice recognition transcript + audio download), and video messages, downloading files via /v1.0/robot/messageFiles/download.
  • Outbound & AI Card Streaming: Formatted Markdown chunks (sampleMarkdown), image/file uploads (sampleImageMsg / sampleFile), interactive ActionCards, message recall, and incremental AI Card streaming (/v1.0/card/instances/createAndDeliver + PUT /v1.0/card/streaming) when cardTemplateId is configured.
  • Realtime Events & Policies: Emits dingtalk.event to Gateway Realtime, supports per-group groups.<conversationId> rules (requireMention, users, ambient, systemPrompt), multi-account accounts.<id>, and hot-reload.

Agent Tools ​

Registered automatically (gated by channels.dingtalk.actions.*):

  • dingtalk_send_message (Markdown, ActionCard, or media)
  • dingtalk_recall_message
  • dingtalk_read_observed_messages
  • dingtalk_download_file
  • dingtalk_get_user
  • dingtalk_list_departments

Released under the MIT License.