feat(dingtalk): add proactive message API to send_message tool#12077
Open
shuans wants to merge 1 commit into
Open
feat(dingtalk): add proactive message API to send_message tool#12077shuans wants to merge 1 commit into
shuans wants to merge 1 commit into
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.
Collaborator
Open
5 tasks
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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