OpenClaw

OpenClaw DingTalk Channel

Enterprise
Medium

Connect OpenClaw to DingTalk (钉钉) — China's leading enterprise messaging platform by Alibaba — using a community plugin. This integration uses DingTalk's Stream mode (WebSocket long connection), so no public IP or domain is required. It supports direct messages, group chats, text/image/audio/video/file messages, and AI Card streaming replies. Install the plugin, create a DingTalk internal app, enter your credentials, and you're live.

Quick Info
DifficultyMedium
CategoryEnterprise
Features Supported4 / 6

DingTalk Supported Features

Text Messages

Supported

Media & Files

Supported

Reactions

Not Supported

Threads

Not Supported

Voice Messages

Supported

Group Chat

Supported

DingTalk Prerequisites

  • Admin or developer access to a DingTalk organization
  • DingTalk plugin installed: openclaw plugins install @soimy/dingtalk
  • OpenClaw Gateway running and configured
  • Node.js 18+ installed on your server

DingTalk Quick Setup

1

Install the DingTalk plugin

Run 'openclaw plugins install @soimy/dingtalk' in your terminal to install the community DingTalk plugin. If you need AI Card streaming replies and multi-agent routing, you can use '@dingtalk-real-ai/dingtalk-connector' instead.

2

Create a DingTalk internal app

Log in to the DingTalk Open Platform (open-dev.dingtalk.com) and create an internal enterprise app. Go to the Credentials page to copy your ClientID (AppKey, format: dingXXX) and ClientSecret (AppSecret). Under App Capabilities, add the Bot capability and set the message receiving mode to Stream mode.

3

Configure permissions and publish

In Permission Management, grant the required permissions: Card.Instance.Write, Card.Streaming.Write, bot message sending, media file upload/download, etc. Once configured, publish the app and wait for admin approval.

4

Configure OpenClaw and test

Add the DingTalk channel configuration to ~/.openclaw/openclaw.json with your clientId and clientSecret. Run 'openclaw gateway restart' to restart the Gateway, then send a message to your bot in DingTalk to verify everything works.

DingTalk Configuration Example

config.json
{
  "channels": {
    "dingtalk": {
      "enabled": true,
      "clientId": "dingXXXXXX",
      "clientSecret": "your-app-secret",
      "robotCode": "dingXXXXXX",
      "corpId": "dingXXXXXX",
      "dmPolicy": "open",
      "groupPolicy": "open",
      "messageType": "markdown"
    }
  }
}

DingTalk Integration Guide

Architecture Overview

OpenClaw connects to DingTalk through the DingTalk Open Platform's Stream mode (WebSocket long connection). Unlike traditional webhook setups, Stream mode has the Gateway initiate an outbound WebSocket connection to DingTalk's servers, receiving event pushes in real time — no public IP or domain required. The message flow is: User sends a message in DingTalk → DingTalk Open Platform → Stream push to your Gateway → OpenClaw processes with AI → reply via DingTalk Bot API → message delivered in DingTalk. This architecture is ideal for self-hosted deployments behind NATs or corporate firewalls, since no inbound connections are needed. The Gateway automatically maintains the connection and handles reconnection with exponential backoff.
Stream mode requires no public IP, no SSL certificate, and works behind corporate firewalls and home networks.
The DingTalk plugin is community-maintained and installed separately from the core Gateway, keeping things lightweight.

Plugin Selection

There are two popular community plugins for DingTalk integration: • @soimy/dingtalk — The most widely used plugin with an active community. Supports both Markdown and AI Card reply formats, and covers the vast majority of use cases. • @dingtalk-real-ai/dingtalk-connector — An officially affiliated project from DingTalk, focused on AI Card streaming replies. Supports multi-agent routing and async mode, but requires OpenClaw v0.7.7+. Both plugins use DingTalk's Stream mode, so the core connection experience is the same. For most users, go with @soimy (more documentation and community support). Choose @dingtalk-real-ai if you need multi-agent routing or async processing.
terminal
# Install @soimy version (recommended)
openclaw plugins install @soimy/dingtalk

# Or install @dingtalk-real-ai version
openclaw plugins install @dingtalk-real-ai/dingtalk-connector

DingTalk App Creation & Credentials

Setting up DingTalk integration requires creating an app on the DingTalk Open Platform: 1. Log in to the DingTalk Open Platform at open-dev.dingtalk.com and open the Developer Console. 2. Click 'Create Application' and select 'Internal Enterprise Development' → 'Bot' type. 3. Fill in the app name and description. Once created, go to 'Credentials & Basic Info' and copy the ClientID (AppKey, format: dingXXX) and ClientSecret (AppSecret). 4. Under 'Bot Configuration', set the message receiving mode to **Stream mode** (not HTTP mode). 5. In Permission Management, add the required permissions. Key permissions include: - qyapi_robot_sendmsg (bot message sending) - Card.Instance.Write (card instance write) - Card.Streaming.Write (streaming card write) - mediaId.download and mediaId.upload (media file upload/download) 6. Publish the app and wait for your organization admin to approve it.
terminal
# Via environment variables
export DINGTALK_CLIENT_ID="dingXXXXXX"
export DINGTALK_CLIENT_SECRET="your_app_secret"

# Or via CLI
openclaw channels add
Keep your ClientSecret secure. Never commit it to version control. Use environment variables for production deployments. If it's compromised, reset it immediately in the DingTalk Open Platform console.

DM and Group Chat Policies

The DingTalk plugin supports flexible messaging policies: **DM Policy (dmPolicy):** • open — Anyone can DM the bot and get a response • disabled — Direct messages are turned off entirely **Group Policy (groupPolicy):** • open — Any group member can trigger the bot by @mentioning it • disabled — Group messages are completely ignored In group chats, the bot requires an @mention by default to avoid responding to every message in busy conversations.
openclaw.json
{
  "channels": {
    "dingtalk": {
      "dmPolicy": "open",
      "groupPolicy": "open"
    }
  }
}
In groups, just @mention the bot's name to trigger a response — no extra configuration needed.
Conversations are isolated by chat. Each DM and group chat has its own context, which resets automatically after 30 minutes of inactivity.

Reply Formats & AI Card Streaming

The DingTalk plugin supports multiple reply formats: • **Text** — Basic plain-text replies • **Markdown** — Formatted content with headings, lists, and links (recommended default) • **AI Card (streaming)** — A ChatGPT-like typewriter effect where the message updates progressively inside a card AI Card streaming provides the best user experience — the response updates in place without flooding the chat with multiple messages. It requires Card-related permissions to be granted in your DingTalk app.
openclaw.json
{
  "channels": {
    "dingtalk": {
      "messageType": "markdown",
      "streaming": true
    }
  }
}
AI Card streaming requires the Card.Instance.Write and Card.Streaming.Write permissions.
If you don't need the streaming effect, set messageType to markdown and disable streaming.

Message Types & Media Support

The OpenClaw DingTalk plugin handles various message types: **Inbound (receive):** Text, images, audio (with automatic speech recognition), video, and files **File parsing:** .docx, .pdf, .txt, .md, .json, .xlsx, .pptx, .zip and more — files are read and analyzed by the AI **Outbound (send):** Text, Markdown, AI Card, images, and files Audio messages are automatically transcribed to text before being passed to the AI, with no extra configuration needed.
Make sure your DingTalk app has media upload permissions before sending large files.
Voice messages are automatically transcribed, supporting both Chinese and English.

Multi-Agent Routing

Using the @dingtalk-real-ai plugin, you can configure multi-agent routing to have different AI agents handle different types of conversations. For example, route DMs to a general assistant while sending specific group chats to a specialized support agent. Through OpenClaw's bindings configuration, you can precisely control which agent handles each conversation.
openclaw.json
{
  "bindings": [
    { "agentId": "main", "match": { "channel": "dingtalk", "peer": { "kind": "direct" } } },
    { "agentId": "tech-support", "match": { "channel": "dingtalk", "peer": { "kind": "group" } } }
  ]
}
Multi-agent routing is only supported by the @dingtalk-real-ai plugin, not the @soimy version.

Useful Commands

OpenClaw provides several commands for managing your DingTalk bot: • openclaw gateway status — Check Gateway connection status • openclaw gateway restart — Restart the Gateway service • openclaw logs --follow — View real-time logs • openclaw channels add — Interactively add a new channel • openclaw plugins list — List installed plugins • openclaw plugins update @soimy/dingtalk — Update the DingTalk plugin • openclaw doctor — Run a comprehensive diagnostic check

DingTalk Configuration Reference

enabled
Type: booleanDefault: true

Enable or disable the DingTalk channel

clientId
Type: stringDefault: ""

DingTalk app ClientID (AppKey), format: dingXXX, from the DingTalk Open Platform

clientSecret
Type: stringDefault: ""

DingTalk app ClientSecret (AppSecret), from the DingTalk Open Platform

robotCode
Type: stringDefault: ""

Unique identifier for the bot, from the Bot Configuration page on the DingTalk Open Platform

corpId
Type: stringDefault: ""

Organization's CorpId, format: dingXXX, from the DingTalk admin console

agentId
Type: stringDefault: ""

Application AgentId, from the DingTalk Open Platform

dmPolicy
Type: stringDefault: "open"

Direct message policy. Options: open (anyone can DM), disabled (DMs turned off)

groupPolicy
Type: stringDefault: "open"

Group chat policy. Options: open (respond when @mentioned), disabled (ignore all group messages)

messageType
Type: stringDefault: "markdown"

Reply message format. Options: text (plain text), markdown, card (AI Card)

streaming
Type: booleanDefault: true

Enable AI Card streaming replies (typewriter effect)

debug
Type: booleanDefault: false

Enable debug mode for detailed connection and message logs

DingTalk Frequently Asked Questions

DingTalk Troubleshooting

Bot is completely unresponsive

The app may not be published, Stream mode may not be enabled, ClientID or ClientSecret may be incorrect, or the plugin may not be installed properly.

Work through these checks: 1) Confirm the app is published and approved; 2) Verify the message receiving mode is set to Stream mode; 3) Double-check ClientID and ClientSecret; 4) Run 'openclaw plugins list' to confirm the plugin is installed; 5) Run 'openclaw gateway status' to check the connection.
Messages are received but the AI doesn't reply

Compatibility issues after an OpenClaw version upgrade, or the AI model API key is not configured.

Verify your AI model's API key is correctly configured. Try updating the DingTalk plugin: openclaw plugins update @soimy/dingtalk. Check openclaw logs --follow for detailed error messages. See
Stream connection drops frequently

Network instability or known DingTalk Stream mode message loss issues.

The Gateway handles reconnection automatically with exponential backoff. If disconnections are frequent, check your server's network stability and make sure your firewall allows outbound WebSocket connections. Enable debug mode for detailed connection logs.
Cannot access group files or DingTalk Drive files

Group file and DingTalk Drive APIs may require enterprise verification. Unverified organizations may not have access to these features.

Check whether your organization has completed enterprise verification. Without verification, some advanced file APIs are unavailable. As a workaround, send files directly in chat rather than sharing from DingTalk Drive.
AI Card streaming output not working

Missing Card-related permissions, or messageType configuration is incorrect.

Confirm you've granted Card.Instance.Write and Card.Streaming.Write permissions in the DingTalk Open Platform. Check that 'streaming' is set to true in your config. After changing permissions, you must republish the app.