docs/MINIAPP_KEFU_SERVICE.md
This document describes the new customer service management functionality added to the WxJava Mini Program SDK.
Previously, the mini program module only had:
WxMaCustomserviceWorkService - For binding mini programs to enterprise WeChat customer serviceWxMaMsgService.sendKefuMsg() - For sending customer service messagesThe new WxMaKefuService adds comprehensive customer service management capabilities:
kfList() - Get list of customer service accountskfAccountAdd() - Add new customer service accountkfAccountUpdate() - Update customer service accountkfAccountDel() - Delete customer service accountkfSessionCreate() - Create customer service sessionkfSessionClose() - Close customer service sessionkfSessionGet() - Get customer session statuskfSessionList() - Get customer service session list// 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();
WxMaKfAccountRequest - For customer service account operationsWxMaKfSessionRequest - For session operationsWxMaKfInfo - Customer service account informationWxMaKfList - List of customer service accountsWxMaKfSession - Session informationWxMaKfSessionList - List of sessionsThe 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 listThe 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.