WxJava icon indicating copy to clipboard operation
WxJava copied to clipboard

Add enterprise WeChat intelligent robot interface support

Open Copilot opened this issue 3 months ago • 0 comments

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 robots
  • POST /cgi-bin/intelligent_robot/update - Update robot configuration
  • POST /cgi-bin/intelligent_robot/get - Retrieve robot information
  • POST /cgi-bin/intelligent_robot/chat - Conduct AI conversations
  • POST /cgi-bin/intelligent_robot/reset_session - Reset conversation context
  • POST /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 metadata
  • WxCpIntelligentRobotCreateRequest/Response - Robot creation
  • WxCpIntelligentRobotChatRequest/Response - AI conversation handling
  • WxCpIntelligentRobotUpdateRequest - Robot configuration updates

Integration

The service follows existing WxJava patterns and integrates seamlessly:

  • Added to main WxCpService interface as getIntelligentRobotService()
  • 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.

Copilot avatar Aug 31 '25 14:08 Copilot