-
-
Notifications
You must be signed in to change notification settings - Fork 9k
添加企微智能机器人消息接收和主动发送功能 #3815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
添加企微智能机器人消息接收和主动发送功能 #3815
+240
−0
Conversation
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
Co-authored-by: binarywang <[email protected]>
Copilot
AI
changed the title
[WIP] Fix message parsing issue in intelligent robot
添加企微智能机器人消息接收和主动发送功能
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
本 PR 为企业微信智能机器人模块添加了消息接收解析和主动发送消息的功能支持,解决了 API 模式创建的智能机器人回调消息无法被正确解析的问题。
主要变更包括:
- 在
WxCpXmlMessage中添加robotId和sessionId字段支持智能机器人消息解析 - 新增主动发送消息的请求/响应类和服务方法
- 完善相关测试用例和文档说明
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessage.java | 添加 robotId 和 sessionId 字段及 XStream 注解,支持智能机器人消息解析 |
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/intelligentrobot/WxCpIntelligentRobotSendMessageRequest.java | 新增主动发送消息请求类,包含 robotId、userid、message、sessionId、msgId 字段 |
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/intelligentrobot/WxCpIntelligentRobotSendMessageResponse.java | 新增主动发送消息响应类,包含 msgId 和 sessionId 字段 |
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpIntelligentRobotService.java | 在服务接口中添加 sendMessage 方法定义 |
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpIntelligentRobotServiceImpl.java | 实现 sendMessage 方法,调用微信 API 发送消息 |
| weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java | 添加 SEND_MESSAGE API 路径常量 |
| weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java | 添加智能机器人消息解析测试用例 |
| weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpIntelligentRobotServiceImplTest.java | 添加主动发送消息请求/响应的序列化和反序列化测试用例 |
| weixin-java-cp/INTELLIGENT_ROBOT.md | 更新文档,添加主动发送消息和接收消息的使用说明和示例代码 |
weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java
Show resolved
Hide resolved
...java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpIntelligentRobotServiceImplTest.java
Show resolved
Hide resolved
...java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpIntelligentRobotServiceImplTest.java
Show resolved
Hide resolved
...java/me/chanjar/weixin/cp/bean/intelligentrobot/WxCpIntelligentRobotSendMessageResponse.java
Show resolved
Hide resolved
…gentrobot/WxCpIntelligentRobotSendMessageResponse.java Co-authored-by: Copilot <[email protected]>
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.
问题
API 模式创建的智能机器人回调消息无法被
WxCpXmlMessage正确解析,缺少主动发送消息的 API。变更
消息接收支持
WxCpXmlMessage添加robotId和sessionId字段及 XStream 注解主动发送消息 API
WxCpIntelligentRobotSendMessageRequest/Response类WxCpIntelligentRobotService添加sendMessage()方法SEND_MESSAGEAPI 路径常量文档和测试
INTELLIGENT_ROBOT.md添加使用示例参考文档: https://developer.work.weixin.qq.com/document/path/100719
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
developer.work.weixin.qq.com/usr/bin/curl curl -s REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.