hermes-dingtalk-media
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "hermes-dingtalk-media" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b53fc2fa1a27ff30f7e80b37a1ec7af8c71197175bc441d3218e4f88124f8726. Verify the upstream source and version against https://skillhub.cn/skills/user_9ab57f1a/hermes-dingtalk-media before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
For development of Hermes Agent DingTalk media push: covers sending images or files via DingTalk bots, fixing media attachment handling, debugging bot configuration and robotCode issues, handling streaming-mode callbacks and media_id upload flows, distinguishing group vs. single-chat bot endpoints, and validating native DingTalk image/file attachments.
Introduction source: third_party · user_9ab57f1a · 1.0.2 Reference
SkillPi interpretation
- Tasks
- Use when working on Hermes Agent DingTalk media delivery: sending images or files from DingTalk bots, fixing MEDIA attachment handling, debugging dingtalk-bot profiles, robotCode issues, Stream Mode callbacks, upload media_id flow, group versus one-to-one robot endpoints, and validating native DingTalk photo/file attachments.
- Testing
- Not tested
Browse files
Frontmatter
name: "hermes-dingtalk-media"
description: "Use when working on Hermes Agent DingTalk media delivery: sending images or files from DingTalk bots, fixing MEDIA attachment handling, debugging dingtalk-bot profiles, robotCode issues, Stream Mode callbacks, upload media_id flow, group versus one-to-one robot endpoints, and validating native DingTalk photo/file attachments."Hermes DingTalk Media
Use this skill when a Hermes DingTalk bot needs to send or receive native media attachments, especially when MEDIA:/absolute/path responses do not arrive as independent DingTalk images/files.
Bundled Files
This Hermes skill includes a non-Hermes-native helper script:
scripts/fix_dingtalk_media_support.py: validates that the Hermes source tree contains the DingTalk media implementation, checks required Python modules, runs syntax checks, and can restart a Hermes profile gateway.scripts/send_dingtalk_file.py: sends a local image/file through DingTalk robot media APIs using credentials from a Hermes profile, without modifying Hermes core.
The helpers do not contain credentials. Run the validation helper from any location by passing the Hermes source repository root:
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO"
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO" --restart-profile <profile>
If HERMES_REPO points to the Hermes source tree, the --repo-root argument can be omitted.
To validate native DingTalk file delivery without changing Hermes source, send a local file from a configured Hermes profile:
python /path/to/hermes-dingtalk-media/scripts/send_dingtalk_file.py --profile <profile> --target-name "<group-name>" /tmp/example.txt
For one-to-one robot sends, pass a DingTalk staff/user id:
python /path/to/hermes-dingtalk-media/scripts/send_dingtalk_file.py --profile <profile> --user-id "<staff-id>" /tmp/example.txt
Core Flow
-
Confirm the bot receives callbacks.
- Look for
DingTalk callback receivedandinbound message: platform=dingtalk. - If no callback appears, fix Stream Mode/connectivity first.
- Look for
-
Confirm Hermes parsed the media tag.
- The assistant response should contain
MEDIA:/absolute/path/to/file. - Gateway logs should show
Sending DingTalk media via ... robot API.
- The assistant response should contain
-
Upload the local file to DingTalk.
- Endpoint:
POST https://oapi.dingtalk.com/media/upload - Params:
access_token,type=imagefor image extensions, otherwisetype=file. - Multipart field:
media. - Use returned
media_id/mediaId.
- Endpoint:
-
Send the uploaded
media_idwith the correct robot endpoint.- Group chat:
POST https://api.dingtalk.com/v1.0/robot/groupMessages/send - One-to-one bot chat:
POST https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend
- Group chat:
Important Routing Rules
- Do not use
privateChatMessages/sendfor Hermes bot one-to-one media replies. It can returnresource.not.foundeven when upload succeeded. - For one-to-one bot media, use
oToMessages/batchSendwithuserIds: [sender_staff_id]. - For group media, use
groupMessages/sendwithopenConversationId. - Prefer
message.robot_codefrom the incoming DingTalk callback over configured app/client id. Config fallback is acceptable only when there is no callback context. - Keep the incoming callback context by
chat_id; it providesconversation_type,robot_code, andsender_staff_id.
Payloads
Group media:
payload = {
"robotCode": robot_code,
"openConversationId": chat_id,
"msgKey": msg_key,
"msgParam": json.dumps(msg_param, ensure_ascii=False),
}
One-to-one media:
payload = {
"robotCode": robot_code,
"userIds": [sender_staff_id],
"msgKey": msg_key,
"msgParam": json.dumps(msg_param, ensure_ascii=False),
}
Known media templates to try:
image_candidates = [
("sampleImageMsg", {"photoURL": media_id}),
("sampleImageMsg", {"mediaId": media_id}),
("sampleImage", {"mediaId": media_id}),
]
file_candidates = [
("sampleFile", {"mediaId": media_id, "fileName": file_name}),
("sampleFileMsg", {"mediaId": media_id, "fileName": file_name}),
]
Hermes Implementation Checklist
In gateway/platforms/dingtalk.py:
- Implement
send_image_file,send_document, andsend_video. - Resolve inbound
downloadCodeto local cache files for images/audio/video/documents. - Use a cancellable Stream loop instead of
dingtalk_stream.DingTalkStreamClient.start()if shutdown or reconnect gets stuck; the SDK can swallow cancellation. - Call
self._stream_client.pre_start()before opening the Stream connection when replacing SDKstart(). - Log media routing without exposing secrets, for example:
Sending DingTalk media via oto robot API; robot_code_source=callback recipient_source=sender_staff_id.
In tools/send_message_tool.py:
- Support DingTalk
MEDIA:extraction. - For direct sends without callback context, one-to-one media requires an explicit DingTalk user id/staff id; otherwise default to group sends.
In agent/prompt_builder.py:
- Add a DingTalk platform hint that native media can be sent with
MEDIA:/absolute/path/to/file.
Validation
Run:
cd "$HERMES_REPO"
python -m py_compile gateway/platforms/dingtalk.py tools/send_message_tool.py agent/prompt_builder.py
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO"
git diff --check
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO" --restart-profile <profile>
Test image and file delivery separately:
result = await adapter._send_robot_media(
chat_id=chat_id,
file_path="/tmp/example.png",
media_kind="image",
)
result = await adapter._send_robot_media(
chat_id=chat_id,
file_path="/tmp/example.txt",
media_kind="file",
file_name="example.txt",
)
Expected success shape:
{"success": True, "error": None, "message_id": "..."}
Failure Signals
resource.not.foundaftermedia/upload: upload worked, but the send endpoint orrobotCode/recipient is wrong.robot 不存在: usually wrongrobotCode; use callbackmessage.robot_code.private HTTP 400 ... resource.not.foundin one-to-one chat: switch fromprivateChatMessages/sendtooToMessages/batchSend.- No
DingTalk callback received: Stream callback delivery is not reaching Hermes; check bot/app, Stream Mode, competing gateway processes, and profile credentials.
Current listing version
1.0.2
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 Hermes Agent 钉钉机器人媒体传输的具体痛点提供解决方案
- 涵盖 MEDIA 附件处理、robotCode 问题、Stream Mode 回调、media_id 上传流程等关键环节
- 提供详细的实现流程、Payload 示例和故障排查指南
Highlights
- 触发词覆盖全面,包括发送图片/文件、MEDIA 附件处理、robotCode 问题、Stream Mode 回调等
- 边界清晰,能有效引导用户在相关开发调试场景下触发
Areas to improve
-
文档长度 Reported severity: Minor
文档内容较丰富,总行数约 600 行,可能影响阅读体验
Recommendation: 建议适当拆分章节或增加目录导航以提升可读性
Highlights
- 结构清晰,包含 Bundled Files、Core Flow、Routing Rules、Payloads、Checklist 等完整章节
- 提供了端到端的示例和具体命令,frontmatter 完整
Highlights
- 提供了两个辅助脚本用于验证和发送,脚本来源明确,参数说明清晰
- 覆盖了主要异常场景并提供了解决方案,不可逆操作有明确参数控制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 15, 17, 50, 165
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- api.dingtalk.com
- oapi.dingtalk.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.