WxJava
WxJava copied to clipboard
Add enterprise WeChat intelligent robot interface support
This PR implements the enterprise WeChat intelligent robot interface as requested, providing comprehensive API support for managing and interacting with AI-powered robots in WeChat Work applications.
Overview
The implementation adds a new WxCpIntelligentRobotService that enables developers to:
- Create and manage intelligent robots with customizable names, descriptions, and avatars
- Conduct AI-powered conversations with session management for context continuity
- Update robot configurations including enabling/disabling robot status
- Reset conversation sessions to clear chat history when needed
- Delete robots when no longer required
Key Components
Service Interface
WxCpService wxCpService = ...; // Initialize WeChat Work service
WxCpIntelligentRobotService robotService = wxCpService.getIntelligentRobotService();
// Create a new intelligent robot
WxCpIntelligentRobotCreateRequest request = new WxCpIntelligentRobotCreateRequest();
request.setName("Customer Service Bot");
request.setDescription("AI-powered customer support");
WxCpIntelligentRobotCreateResponse response = robotService.createRobot(request);
// Start intelligent conversation
WxCpIntelligentRobotChatRequest chatRequest = new WxCpIntelligentRobotChatRequest();
chatRequest.setRobotId(response.getRobotId());
chatRequest.setUserid("user123");
chatRequest.setMessage("How can I help you today?");
WxCpIntelligentRobotChatResponse chatResponse = robotService.chat(chatRequest);
API Endpoints
The implementation follows WeChat Work's official API documentation and includes endpoints for:
POST /cgi-bin/intelligent_robot/create- Create robotsPOST /cgi-bin/intelligent_robot/update- Update robot configurationPOST /cgi-bin/intelligent_robot/get- Retrieve robot informationPOST /cgi-bin/intelligent_robot/chat- Conduct AI conversationsPOST /cgi-bin/intelligent_robot/reset_session- Reset conversation contextPOST /cgi-bin/intelligent_robot/delete- Remove robots
Bean Classes
Complete set of request/response classes with proper JSON serialization:
WxCpIntelligentRobot- Robot entity with status and metadataWxCpIntelligentRobotCreateRequest/Response- Robot creationWxCpIntelligentRobotChatRequest/Response- AI conversation handlingWxCpIntelligentRobotUpdateRequest- Robot configuration updates
Integration
The service follows existing WxJava patterns and integrates seamlessly:
- Added to main
WxCpServiceinterface asgetIntelligentRobotService() - Properly initialized in
BaseWxCpServiceImpl - Includes comprehensive documentation and usage examples
- All code follows project checkstyle standards and passes validation
This enhancement enables developers to build sophisticated AI-powered customer service, internal assistants, and automated conversation systems within enterprise WeChat applications.
Fixes #3682.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.