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), andvideomessages, 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) whencardTemplateIdis configured. - Realtime Events & Policies: Emits
dingtalk.eventto Gateway Realtime, supports per-groupgroups.<conversationId>rules (requireMention,users,ambient,systemPrompt), multi-accountaccounts.<id>, and hot-reload.
Agent Tools
Registered automatically (gated by channels.dingtalk.actions.*):
dingtalk_send_message(Markdown, ActionCard, or media)dingtalk_recall_messagedingtalk_read_observed_messagesdingtalk_download_filedingtalk_get_userdingtalk_list_departments