|
| 1 | +# WeChat Mini Program Customer Service Management |
| 2 | + |
| 3 | +This document describes the new customer service management functionality added to the WxJava Mini Program SDK. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Previously, the mini program module only had: |
| 8 | +- `WxMaCustomserviceWorkService` - For binding mini programs to enterprise WeChat customer service |
| 9 | +- `WxMaMsgService.sendKefuMsg()` - For sending customer service messages |
| 10 | + |
| 11 | +The new `WxMaKefuService` adds comprehensive customer service management capabilities: |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +### Customer Service Account Management |
| 16 | +- `kfList()` - Get list of customer service accounts |
| 17 | +- `kfAccountAdd()` - Add new customer service account |
| 18 | +- `kfAccountUpdate()` - Update customer service account |
| 19 | +- `kfAccountDel()` - Delete customer service account |
| 20 | + |
| 21 | +### Session Management |
| 22 | +- `kfSessionCreate()` - Create customer service session |
| 23 | +- `kfSessionClose()` - Close customer service session |
| 24 | +- `kfSessionGet()` - Get customer session status |
| 25 | +- `kfSessionList()` - Get customer service session list |
| 26 | + |
| 27 | +## Usage Example |
| 28 | + |
| 29 | +```java |
| 30 | +// Get the customer service management service |
| 31 | +WxMaKefuService kefuService = wxMaService.getKefuService(); |
| 32 | + |
| 33 | +// Add a new customer service account |
| 34 | +WxMaKfAccountRequest request = WxMaKfAccountRequest.builder() |
| 35 | + .kfAccount("service001@example") |
| 36 | + .kfNick("Customer Service 001") |
| 37 | + .kfPwd("password123") |
| 38 | + .build(); |
| 39 | +boolean result = kefuService.kfAccountAdd(request); |
| 40 | + |
| 41 | +// Create a session between user and customer service |
| 42 | +boolean sessionResult = kefuService.kfSessionCreate("user_openid", "service001@example"); |
| 43 | + |
| 44 | +// Get customer service list |
| 45 | +WxMaKfList kfList = kefuService.kfList(); |
| 46 | +``` |
| 47 | + |
| 48 | +## Bean Classes |
| 49 | + |
| 50 | +### Request Objects |
| 51 | +- `WxMaKfAccountRequest` - For customer service account operations |
| 52 | +- `WxMaKfSessionRequest` - For session operations |
| 53 | + |
| 54 | +### Response Objects |
| 55 | +- `WxMaKfInfo` - Customer service account information |
| 56 | +- `WxMaKfList` - List of customer service accounts |
| 57 | +- `WxMaKfSession` - Session information |
| 58 | +- `WxMaKfSessionList` - List of sessions |
| 59 | + |
| 60 | +## API Endpoints |
| 61 | + |
| 62 | +The service uses the following WeChat Mini Program API endpoints: |
| 63 | +- `https://api.weixin.qq.com/cgi-bin/customservice/getkflist` - Get customer service list |
| 64 | +- `https://api.weixin.qq.com/customservice/kfaccount/add` - Add customer service account |
| 65 | +- `https://api.weixin.qq.com/customservice/kfaccount/update` - Update customer service account |
| 66 | +- `https://api.weixin.qq.com/customservice/kfaccount/del` - Delete customer service account |
| 67 | +- `https://api.weixin.qq.com/customservice/kfsession/create` - Create session |
| 68 | +- `https://api.weixin.qq.com/customservice/kfsession/close` - Close session |
| 69 | +- `https://api.weixin.qq.com/customservice/kfsession/getsession` - Get session |
| 70 | +- `https://api.weixin.qq.com/customservice/kfsession/getsessionlist` - Get session list |
| 71 | + |
| 72 | +## Integration |
| 73 | + |
| 74 | +The service is automatically available through the main `WxMaService` interface: |
| 75 | + |
| 76 | +```java |
| 77 | +WxMaKefuService kefuService = wxMaService.getKefuService(); |
| 78 | +``` |
| 79 | + |
| 80 | +This fills the gap mentioned in the original issue and provides full customer service management capabilities for WeChat Mini Programs. |
0 commit comments