3.0 KiB
3.0 KiB
WeChat Mini Program Customer Service Management
This document describes the new customer service management functionality added to the WxJava Mini Program SDK.
Overview
Previously, the mini program module only had:
WxMaCustomserviceWorkService- For binding mini programs to enterprise WeChat customer serviceWxMaMsgService.sendKefuMsg()- For sending customer service messages
The new WxMaKefuService adds comprehensive customer service management capabilities:
Features
Customer Service Account Management
kfList()- Get list of customer service accountskfAccountAdd()- Add new customer service accountkfAccountUpdate()- Update customer service accountkfAccountDel()- Delete customer service account
Session Management
kfSessionCreate()- Create customer service sessionkfSessionClose()- Close customer service sessionkfSessionGet()- Get customer session statuskfSessionList()- Get customer service session list
Usage Example
// Get the customer service management service
WxMaKefuService kefuService = wxMaService.getKefuService();
// Add a new customer service account
WxMaKfAccountRequest request = WxMaKfAccountRequest.builder()
.kfAccount("service001@example")
.kfNick("Customer Service 001")
.kfPwd("password123")
.build();
boolean result = kefuService.kfAccountAdd(request);
// Create a session between user and customer service
boolean sessionResult = kefuService.kfSessionCreate("user_openid", "service001@example");
// Get customer service list
WxMaKfList kfList = kefuService.kfList();
Bean Classes
Request Objects
WxMaKfAccountRequest- For customer service account operationsWxMaKfSessionRequest- For session operations
Response Objects
WxMaKfInfo- Customer service account informationWxMaKfList- List of customer service accountsWxMaKfSession- Session informationWxMaKfSessionList- List of sessions
API Endpoints
The service uses the following WeChat Mini Program API endpoints:
https://api.weixin.qq.com/cgi-bin/customservice/getkflist- Get customer service listhttps://api.weixin.qq.com/customservice/kfaccount/add- Add customer service accounthttps://api.weixin.qq.com/customservice/kfaccount/update- Update customer service accounthttps://api.weixin.qq.com/customservice/kfaccount/del- Delete customer service accounthttps://api.weixin.qq.com/customservice/kfsession/create- Create sessionhttps://api.weixin.qq.com/customservice/kfsession/close- Close sessionhttps://api.weixin.qq.com/customservice/kfsession/getsession- Get sessionhttps://api.weixin.qq.com/customservice/kfsession/getsessionlist- Get session list
Integration
The service is automatically available through the main WxMaService interface:
WxMaKefuService kefuService = wxMaService.getKefuService();
This fills the gap mentioned in the original issue and provides full customer service management capabilities for WeChat Mini Programs.