Conversation
send_message now supports sending to arbitrary DingTalk groups/users without requiring a webhook_url configuration. Uses the enterprise robot proactive message API (v1.0) when DINGTALK_CLIENT_ID and DINGTALK_CLIENT_SECRET are available. Three-tier routing priority: 1. Proactive API — calls /v1.0/robot/groupMessages/send (groups) or /v1.0/robot/oToMessages/batchSend (users) with access_token. chat_id is respected. Requires "robot proactive message" permission. 2. Session webhook — looks up cached session webhook from recent inbound message (bot must have been @mentioned within ~5 minutes). 3. Static webhook — falls back to DINGTALK_WEBHOOK_URL (default group only; chat_id ignored). Also adds module-level shared session webhook cache (get_dingtalk_session_webhook) so the send_message tool can access session webhooks cached by the gateway adapter. Changes: - gateway/platforms/dingtalk.py: Add shared cache + getter/storer functions; make adapter use shared cache; simplify _on_message store logic. - tools/send_message_tool.py: Rewrite _send_dingtalk() with proactive API support, session webhook lookup, and improved error messages. User-facing: - hermes send_message dingtalk:cidXXXX "msg" # sends to specific group - hermes send_message dingtalk:user123 "msg" # sends to specific user - Requires DINGTALK_CLIENT_ID/SECRET (and optional DINGTALK_ROBOT_CODE). - webhook_url optional now; default-group-only fallback still supported.
|
Hi guys, I built a CLI tool that sends messages directly to DingTalk (individual or group), with a plugin system so more platforms can be added later. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the proactive DingTalk delivery work. The capability is still needed: current main returns No valid session_webhook when live sends lack an inbound webhook (plugins/platforms/dingtalk/adapter.py:847-856) and its standalone sender only uses a static webhook (plugins/platforms/dingtalk/adapter.py:1527-1562).
Problems
- The PR targets the retired inline adapter path. Commit
560010547moved DingTalk toplugins/platforms/dingtalk/adapter.py;send_messagenow dispatches through the platform registry (tools/send_message_tool.py:1072). The implementation needs a plugin-layer port. - In the PR, token acquisition accepts
DINGTALK_CLIENT_ID(tools/send_message_tool.py:1466), butrobot_codedoes not fall back to that value (tools/send_message_tool.py:1503-1507). Environment-only users therefore skip proactive delivery unless they set another variable. Current adapter convention defaults robot code to the resolved client ID (plugins/platforms/dingtalk/adapter.py:211). - The PR changes only implementation files and adds no coverage for the new routing paths.
Suggested changes
- Implement the path in the bundled DingTalk plugin's
standalone_sender_fn, preserve registry dispatch, and add mocked group, OTO, session-webhook, static-webhook, and environment-only credential tests.
Automated hermes-sweeper review.
| try: | ||
| robot_code = ( | ||
| extra.get("robot_code") | ||
| or extra.get("client_id") |
There was a problem hiding this comment.
client_id above can come from DINGTALK_CLIENT_ID, but this fallback only considers extra["client_id"]. That makes the advertised environment-only setup skip the proactive call unless DINGTALK_ROBOT_CODE is also set. Reuse the resolved client_id here; current main's adapter defaults robot code to its resolved client ID.
| # Tier 2: Session webhook cache (gateway inbound cache) | ||
| if chat_id: | ||
| try: | ||
| from gateway.platforms.dingtalk import get_dingtalk_session_webhook |
There was a problem hiding this comment.
Current main moved DingTalk into plugins/platforms/dingtalk/adapter.py and routes send_message through its registered standalone sender. Port this lookup/delivery path to the bundled plugin rather than importing the removed gateway.platforms.dingtalk module.
SummaryFourteen PRs address or reference the DingTalk cluster: proactive delivery, outbound and inbound media, quoted replies, card throttling, session reliability, and deployment configuration. The diffs range from broad stacked or umbrella implementations (#12769, #14333–#14336, #33899) to focused slices (#12077, #17365, #17367–#17371, #40929), but the active adapter and standalone sender now live under the DingTalk plugin contract, so the reusable changes require targeted plugin-layer ports. Related pull requests
Duplicates#14333 and #40929 are the same reliability bundle, with #14333 closed as superseded by #40929; #14334/#17368 cover quoted replies, #14335/#17369 cover inbound media, #14336/#17370/#17371 cover proactive and outbound-media delivery, and #17365 extracts #14333’s throttle. #12769 is the umbrella containing most of those slices, while closed #33899 is a duplicate of #14336 and #12077 overlaps the proactive-delivery portion. Suggested consolidationAuthor action: rebase onto main, or split out the part that can merge—use #12769 as the umbrella, but separate current-plugin PRs for proactive live plus standalone delivery (#12077/#14336/#17370), quoted replies (#14334/#17368), bounded inbound media (#14335/#17369), and complete card throttling (#17365/#40929), while removing the core routing and guard-script changes. This preserves the explicit keep_open and maintainer-bot salvage verdicts and does not cross #12769’s CHANGES_REQUESTED review; keep closed #14333 and #33899 closed, and close the remaining duplicate branches only after their identified plugin-layer slices and tests have been consolidated. Cross-PR triage: Reviewed 14 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 418 kB of PR diffs, 31 kB of issue/PR text, 33 kB of discussion (42 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
send_message now supports sending to arbitrary DingTalk groups/users without requiring a webhook_url configuration. Uses the enterprise robot proactive message API (v1.0) when DINGTALK_CLIENT_ID and DINGTALK_CLIENT_SECRET are available.
Three-tier routing priority:
Also adds module-level shared session webhook cache (get_dingtalk_session_webhook) so the send_message tool can access session webhooks cached by the gateway adapter.
Changes:
User-facing:
What does this PR do?
Related Issue
Fixes #
Type of Change
Changes Made
How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs