Skip to content

Commit

Permalink
🆕 #2825 【企业微信】增加分配在职成员的客户群的接口
Browse files Browse the repository at this point in the history
  • Loading branch information
xslong authored Sep 26, 2022
1 parent 65134bd commit 320bbfe
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,24 @@ WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize,
*/
WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner) throws WxErrorException;


/**
* 企业可通过此接口,将在职成员为群主的群,分配给另一个客服成员。
* <per>
* 注意:
* 继承给的新群主,必须是配置了客户联系功能的成员
* 继承给的新群主,必须有设置实名
* 继承给的新群主,必须有激活企业微信
* 同一个人的群,限制每天最多分配300个给新群主
* 为保障客户服务体验,90个自然日内,在职成员的每个客户群仅可被转接2次。
* </pre>
* @param chatIds 需要转群主的客户群ID列表。取值范围: 1 ~ 100
* @param newOwner 新群主ID
* @return 分配结果 ,主要是分配失败的群列表
* @throws WxErrorException the wx error exception
*/
WxCpUserExternalGroupChatTransferResp onjobTransferGroupChat(String[] chatIds, String newOwner) throws WxErrorException;

/**
* <pre>
* 企业可通过此接口获取成员联系客户的数据,包括发起申请数、新增客户数、聊天数、发送消息数和删除/拉黑成员的客户数等指标。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,18 @@ public WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds,
return WxCpUserExternalGroupChatTransferResp.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatTransferResp onjobTransferGroupChat(String[] chatIds, String newOwner) throws WxErrorException {
JsonObject json = new JsonObject();
if (ArrayUtils.isNotEmpty(chatIds)) {
json.add("chat_id_list", new Gson().toJsonTree(chatIds).getAsJsonArray());
}
json.addProperty("new_owner", newOwner);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GROUP_CHAT_ONJOB_TRANSFER);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalGroupChatTransferResp.fromJson(result);
}

@Override
public WxCpUserExternalUserBehaviorStatistic getUserBehaviorStatistic(Date startTime, Date endTime,
String[] userIds, String[] partyIds) throws WxErrorException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,10 @@ interface ExternalContact {
* The constant GROUP_CHAT_TRANSFER.
*/
String GROUP_CHAT_TRANSFER = "/cgi-bin/externalcontact/groupchat/transfer";
/**
* The constant GROUP_CHAT_ONJOB_TRANSFER.
*/
String GROUP_CHAT_ONJOB_TRANSFER = "/cgi-bin/externalcontact/groupchat/onjob_transfer";
/**
* The constant LIST_USER_BEHAVIOR_DATA.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,19 @@ public void testTransferGroupChat() throws WxErrorException {
assertNotNull(result);
}

/**
* Test onjob transfer group chat.
*
* @throws WxErrorException the wx error exception
*/
@Test
public void testOnjobTransferGroupChat() throws WxErrorException {
String[] str = {"wrHlLKQAAAFbfB99-BO97YZlcywznGZg", "error_group_id"};
WxCpUserExternalGroupChatTransferResp result = this.wxCpService.getExternalContactService().onjobTransferGroupChat(str
, "x");
System.out.println(result);
assertNotNull(result);
}
/**
* Test get user behavior statistic.
*/
Expand Down

0 comments on commit 320bbfe

Please sign in to comment.