OpenClaw Codex

Recipe

Connect OpenClaw to DingTalk

Integrate your OpenClaw gateway with DingTalk (钉钉) using the openclaw-china plugin ecosystem. Covers both Stream Mode (recommended) and Webhook mode, plus group chat @mention routing.

Prerequisites

  • OpenClaw gateway running and accessible (see Deploy on VPS)
  • A DingTalk developer account at open.dingtalk.com
  • Admin access to your DingTalk organization

Step 1 — Install the DingTalk Plugin

OpenClaw uses the openclaw-china plugin for DingTalk, WeCom, and Feishu integrations.

bash
npm install -g openclaw-plugin-dingtalk
# Verify plugin is registered
openclaw plugins list

Step 2 — Create a DingTalk App

  1. Go to DingTalk Open Platform → Create Application
  2. Select Robot type
  3. Set the Message Receive Mode to Stream Mode (preferred over webhook — no public URL needed)
  4. Under Permissions, enable: qyapi_chat_manage, qyapi_robot_sendmsg
  5. Copy your App Key and App Secret

Step 3 — Configure OpenClaw

Add DingTalk credentials to your secrets file and channel config:

bash~/.config/openclaw/secrets.env
DINGTALK_APP_KEY=your-app-key-here
DINGTALK_APP_SECRET=your-app-secret-here
# For webhook mode only:
# DINGTALK_WEBHOOK_TOKEN=your-webhook-token
jsonchannel config
{
  "channels": {
    "dingtalk": {
      "enabled": true,
      "mode": "stream",
      "app_key": "${DINGTALK_APP_KEY}",
      "app_secret": "${DINGTALK_APP_SECRET}",
      "respond_to_mentions": true,
      "respond_to_private": true,
      "default_agent": "main"
    }
  }
}

Step 4 — Stream Mode vs Webhook Mode

Stream Mode (recommended): OpenClaw maintains a persistent connection to DingTalk servers — no public URL or webhook registration needed. Works behind NAT and firewalls.

Webhook Mode: DingTalk POSTs to your public URL. Requires a publicly accessible endpoint and signature verification.

bashWebhook mode only — signature verification
# DingTalk signs requests with HMAC-SHA256
# OpenClaw verifies automatically when DINGTALK_WEBHOOK_TOKEN is set
# Register your webhook URL in DingTalk console:
# https://your-domain.com/webhooks/dingtalk

Step 5 — Group Chat @Mention Routing

By default, your bot only responds when @mentioned in group chats. You can configure keyword-based routing:

json
{
  "channels": {
    "dingtalk": {
      "group_routing": {
        "mention_only": true,
        "keyword_routes": {
          "report": "reporting-agent",
          "translate": "translation-agent"
        },
        "default_agent": "main"
      }
    }
  }
}

Common Errors

ErrorCauseFix
401 InvalidAppKeyWrong App KeyCheck DingTalk console → App credentials
Stream connect timeoutFirewall blocking outboundAllow outbound to api.dingtalk.com:443
Bot not responding in groupMissing @mention or permissionsEnable qyapi_chat_manage permission

What's Next?