🆕 #2298【企业微信】增加服务商模式外部联系人unionid转换接口
This commit is contained in:
@@ -159,6 +159,29 @@ public interface WxCpExternalContactService {
|
||||
*/
|
||||
String convertToOpenid(String externalUserid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 服务商为企业代开发微信小程序的场景,服务商可通过此接口,将微信客户的unionid转为external_userid。
|
||||
* <pre>
|
||||
*
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc/90001/90143/93274
|
||||
*
|
||||
* 服务商代开发小程序指企业使用的小程序为企业主体的,非服务商主体的小程序。
|
||||
* 场景:企业客户在微信端从企业主体的小程序(非服务商应用)登录,同时企业在企业微信安装了服务商的第三方应用,服务商可以调用该接口将登录用户的unionid转换为服务商全局唯一的外部联系人id
|
||||
*
|
||||
* 权限说明:
|
||||
*
|
||||
* 仅认证企业可调用
|
||||
* unionid必须是企业主体下的unionid。即unionid的主体(为绑定了该小程序的微信开放平台账号主体)需与当前企业的主体一致。
|
||||
* unionid的主体(即微信开放平台账号主体)需认证
|
||||
* 该客户的跟进人必须在应用的可见范围之内
|
||||
* </pre>
|
||||
*
|
||||
* @param unionid 微信客户的unionid
|
||||
* @return 该企业的外部联系人ID
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String unionidToExternalUserid(String unionid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量获取客户详情.
|
||||
* <pre>
|
||||
|
||||
@@ -137,6 +137,16 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
||||
return tmpJson.get("openid").getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unionidToExternalUserid(@NotNull String unionid) throws WxErrorException {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("unionid", unionid);
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UNIONID_TO_EXTERNAL_USERID);
|
||||
String responseContent = this.mainService.post(url, json.toString());
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return tmpJson.get("external_userid").getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpExternalContactBatchInfo getContactDetailBatch(String userId,
|
||||
String cursor,
|
||||
|
||||
@@ -181,6 +181,7 @@ public interface WxCpApiPathConsts {
|
||||
String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list";
|
||||
String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid=";
|
||||
String CONVERT_TO_OPENID = "/cgi-bin/externalcontact/convert_to_openid";
|
||||
String UNIONID_TO_EXTERNAL_USERID = "/cgi-bin/externalcontact/unionid_to_external_userid";
|
||||
String GET_CONTACT_DETAIL_BATCH = "/cgi-bin/externalcontact/batch/get_by_user?";
|
||||
String UPDATE_REMARK = "/cgi-bin/externalcontact/remark";
|
||||
String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid=";
|
||||
|
||||
Reference in New Issue
Block a user