feat(gateway/dingtalk): rich media (image, voice, video, file) support In&Outbound#9451
feat(gateway/dingtalk): rich media (image, voice, video, file) support In&Outbound#9451dingtalkwukong wants to merge 4 commits into
Conversation
…, video, file) support Sync DingTalk gateway platform and tests from dingtalk-hermes-connector main branch. This update replaces gateway/platforms/dingtalk.py and tests/gateway/test_dingtalk.py with upstream implementations. Highlights include expanded inbound parsing and outbound sending paths for rich media message types, plus comprehensive test coverage updates for media workflows and platform behaviors.
… handler Add _IncomingHandler.raw_process compatibility path expected by DingTalk callback flows and tests. Normalize callback payload fields into ChatbotMessage-like attributes when SDK objects are unavailable, preserve _raw_data, and return a fallback ACK object with code/headers.
|
Your AI can now access all dingtalk api docs here: https://github.com/dingtalkwukong/dingtalk-openapi-docs-markdown |
|
You can paste this to your hermes agent: Replace ~/.hermes/hermes-agent/gateway/platforms/dingtalk.py with this file and restart hermes gateway to make DingTalk messaging work normally. DingTalk platform adapter for hermes Supports: Outbound rich media (image, voice, video, file) sent via DingTalk Robot OpenAPI. |
Note — PR Comments Suggest Replacing Local Files from External RepositoryThe PR code itself adds DingTalk rich media support and appears clean — all URLs point to official DingTalk APIs ( However, the PR comments suggest a workaround that bypasses the normal review process: 1. Comment posted shortly after PR creation:
This is likely the author trying to help users who need the feature before the PR is merged — a common pattern in open-source. However, it would be better practice to suggest checking out the PR branch directly rather than raw-file replacement, since:
@dingtalkwukong — consider updating your comment to suggest users check out your branch directly instead of raw file replacement. This way users get the exact code that's in the PR and can track updates. |
Motivation
Sync the DingTalk gateway implementation with the upstream connector to add robust rich media handling for inbound and outbound messages.
Provide native robot OpenAPI paths for sending images, voice, video and files and ensure inbound media is downloaded, cached and exposed to the agent.
Add comprehensive unit tests to cover media workflows, routing, and edge cases.
Description
Replaced gateway/platforms/dingtalk.py with an upstream implementation that adds inbound media download/caching (images, audio, video, files), outbound media upload and native robot media senders, session context capture, access token caching and OpenAPI interactions.
Introduced parsing and helper utilities (_rich_text_items, download_inbound*, _send_robot_media_message, _upload_media, context merging, robot identity resolution, logging/redaction helpers, etc.) to reliably handle multiple message shapes and rich-text items.
Replaced tests/gateway/test_dingtalk.py with the upstream test suite expanded to exercise the new media flows, session/context behaviors, token refresh and error cases.
Kept send/markdown reply behavior and added guard rails for webhook/session validation and local path validation for outbound media.
What does this PR do?
gateway/dingtalk feat:
Outbound rich media (image, voice, video, file) sent via DingTalk Robot OpenAPI.
Inbound media (image, audio, file) downloaded and cached for agent consumption.