dingtalk-message

dingtalk-message

Send DingTalk messages. Use this skill when the user mentions terms such as "dingtalk message", "send message", "send notification", "group notification", "group message", "Webhook", "robot message", "send robot message", "work notification", "direct message", "group chat message", "recall message", "message read status", "send Markdown", "send card message", "ActionCard", "@someone", "@employee", "at someone", "remind someone", "dingtalk message", "send message", "robot message", or "work notification". Supports custom group Webhook bots (Text/Markdown/ActionCard/Link/FeedCard + signature verification + @someone), enterprise internal app bot direct and group messages, message recall, read status queries, work notifications, and all other message operations.

98stars
8forks
Updated 6/26/2026
SKILL.md
read-only
name
dingtalk-message
description

Send DingTalk messages. Use this skill when the user mentions terms such as "dingtalk message", "send message", "send notification", "group notification", "group message", "Webhook", "robot message", "send robot message", "work notification", "direct message", "group chat message", "recall message", "message read status", "send Markdown", "send card message", "ActionCard", "@someone", "@employee", "at someone", "remind someone", "dingtalk message", "send message", "robot message", or "work notification". Supports custom group Webhook bots (Text/Markdown/ActionCard/Link/FeedCard + signature verification + @someone), enterprise internal app bot direct and group messages, message recall, read status queries, work notifications, and all other message operations.

DingTalk Message Skill

Handles all operations related to sending DingTalk messages. This document serves as a policy guide; for complete API request formats, scenario routing, message type reference, user identifiers, error codes, and more, see references/api.md.

dt_helper.sh is located in the same directory as this SKILL.md at scripts/dt_helper.sh.

Four Message Channels

Channel Use Case Token Features
Webhook Bot Send notifications to a specific group Not required Simplest; credentials embedded in URL
Enterprise Internal App Bot Direct messages / Group chat --token (New API) Supports message recall and read status check
Work Notification App push to "Work Notification" --old-token (Legacy API) Can push to all members/departments
sessionWebhook Reply directly within callbacks Not required Callback payload includes a temporary URL

Workflow (Before Every Execution)

  1. Identify Channel → Determine the channel according to "Scenario Routing" in api.md.
  2. Validate Configuration → Read required keys for the channel via bash scripts/dt_helper.sh --get KEY.
  3. Collect Missing Configs → Ask the user for missing items in one prompt and save them via bash scripts/dt_helper.sh --set KEY=VALUE.
  4. Obtain Token → Use --token for App Bots; use --old-token for Work Notifications; Webhook/sessionWebhook do not require tokens.
  5. Execute API → Write multi-line logic into /tmp/<task>.sh and run it; heredoc is prohibited.

Required Configuration per Channel

Channel Required Config Source
Webhook DINGTALK_WEBHOOK_URL (Signature verification requires DINGTALK_WEBHOOK_SECRET) Group Settings → Group Assistant → Add Custom Bot
Bot Message DINGTALK_APP_KEY + DINGTALK_APP_SECRET Open Platform → App Management → Credentials
Work Notification DINGTALK_APP_KEY + DINGTALK_APP_SECRET + DINGTALK_AGENT_ID agentId is under App Management → Basic Info
  • robotCode = appKey (Identical; no extra configuration required)
  • Plaintext credentials must never be printed in full; mask all but the first 4 characters with **** during confirmation.
  • If message content is missing: Ask the user what to send first; do not invent content.

User Identifiers

Message APIs only accept userId (staffId); unionId is not accepted. See grep -A 20 "^## 身份标识" references/api.md.

  • unionId → userId conversion: bash scripts/dt_helper.sh --to-userid <unionId>
  • Group message method selection: Before sending group messages, ask the user whether to use Webhook or Enterprise Bot. See grep -A 20 "^### 群消息发送方式选择" references/api.md.

Script Templates

#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
TOKEN=$(bash "$HELPER" --token)
USER_ID=$(bash "$HELPER" --get DINGTALK_MY_USER_ID | cut -d= -f2)

# Example: Bot direct message
RESP=$(curl -s -w '\nHTTP_STATUS:%{http_code}' -X POST "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend" \
  -H "x-acs-dingtalk-access-token: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"robotCode":"'$(bash "$HELPER" --get DINGTALK_APP_KEY | cut -d= -f2)'","userIds":["'$USER_ID'"],"msgKey":"sampleText","msgParam":"{\"content\":\"Test Message\"}"}')
echo "$RESP"
#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
OLD_TOKEN=$(bash "$HELPER" --old-token)
AGENT_ID=$(bash "$HELPER" --get DINGTALK_AGENT_ID | cut -d= -f2)
USER_ID=$(bash "$HELPER" --get DINGTALK_MY_USER_ID | cut -d= -f2)

# Example: Work notification
RESP=$(curl -s -w '\nHTTP_STATUS:%{http_code}' -X POST "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=$OLD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"'$AGENT_ID'","userid_list":"'$USER_ID'","msg":{"msgtype":"text","text":{"content":"Test Work Notification"}}}')
echo "$RESP"

In case of token errors: run bash "$HELPER" --token --nocache or bash "$HELPER" --old-token --nocache

references/api.md Reference Index

grep -A 196 "^## 一、群自定义 Webhook 机器人" references/api.md
grep -A 192 "^## 二、企业内部应用机器人" references/api.md
grep -A 145 "^## 三、工作通知" references/api.md
grep -A 60  "^## 四、sessionWebhook" references/api.md
grep -A 30  "^## 场景路由" references/api.md
grep -A 20  "^### 群消息发送方式选择" references/api.md
grep -A 25  "^## 身份标识" references/api.md
grep -A 30  "^## 消息类型速查" references/api.md
grep -A 33  "^## 错误码" references/api.md
grep -A 12  "^## 所需应用权限" references/api.md