mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2642【企业微信】增加客户群加入群聊管理相关接口
This commit is contained in:
@@ -56,7 +56,6 @@ public interface WxCpExternalContactService {
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpContactWayInfo getContactWay(@NonNull String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新企业已配置的「联系我」方式
|
||||
*
|
||||
@@ -171,6 +170,50 @@ public interface WxCpExternalContactService {
|
||||
*/
|
||||
String unionidToExternalUserid(@NotNull String unionid,String openid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
*
|
||||
* 配置客户群进群方式
|
||||
* 企业可以在管理后台-客户联系中配置「加入群聊」的二维码或者小程序按钮,客户通过扫描二维码或点击小程序上的按钮,即可加入特定的客户群。
|
||||
* 企业可通过此接口为具有客户联系功能的成员生成专属的二维码或者小程序按钮。
|
||||
* 如果配置的是小程序按钮,需要开发者的小程序接入小程序插件。
|
||||
* 注意:
|
||||
* 通过API添加的配置不会在管理端进行展示,每个企业可通过API最多配置50万个「加入群聊」(与「联系我」共用50万的额度)。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param wxCpGroupJoinWayInfo
|
||||
* @return {@link WxCpGroupJoinWayResult}
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpGroupJoinWayResult addJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
*更新客户群进群方式配置
|
||||
* 更新进群方式配置信息。注意:使用覆盖的方式更新。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param wxCpGroupJoinWayInfo
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp updateJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取客户群进群方式配置
|
||||
* 获取企业配置的群二维码或小程序按钮。
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param configId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpGroupJoinWayInfo getJoinWay(@NonNull String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 删除客户群进群方式配置
|
||||
* 文档地址:https://developer.work.weixin.qq.com/document/path/92229
|
||||
* @param configId
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp delJoinWay( @NonNull String configId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 代开发应用external_userid转换
|
||||
* <pre>
|
||||
@@ -1025,4 +1068,5 @@ public interface WxCpExternalContactService {
|
||||
* @param productId 商品id
|
||||
*/
|
||||
void deleteProductAlbum(String productId) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -882,5 +882,43 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
||||
this.mainService.post(url, o.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpGroupJoinWayResult addJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException {
|
||||
if (wxCpGroupJoinWayInfo.getJoinWay().getChatIdList() != null && wxCpGroupJoinWayInfo.getJoinWay().getChatIdList().size() > 5) {
|
||||
throw new WxRuntimeException("使用该配置的客户群ID列表,支持5个");
|
||||
}
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_JOIN_WAY);
|
||||
String responseContent = this.mainService.post(url, wxCpGroupJoinWayInfo.getJoinWay().toJson());
|
||||
|
||||
return WxCpGroupJoinWayResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp updateJoinWay(@NonNull WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException {
|
||||
if (wxCpGroupJoinWayInfo.getJoinWay().getChatIdList() != null && wxCpGroupJoinWayInfo.getJoinWay().getChatIdList().size() > 5) {
|
||||
throw new WxRuntimeException("使用该配置的客户群ID列表,支持5个");
|
||||
}
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_JOIN_WAY);
|
||||
String responseContent = this.mainService.post(url, wxCpGroupJoinWayInfo.getJoinWay().toJson());
|
||||
return WxCpBaseResp.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpGroupJoinWayInfo getJoinWay(String configId) throws WxErrorException {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("config_id", configId);
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_JOIN_WAY);
|
||||
String responseContent = this.mainService.post(url,json);
|
||||
|
||||
return WxCpGroupJoinWayInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp delJoinWay(@NonNull String configId) throws WxErrorException {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("config_id", configId);
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(DEL_JOIN_WAY);
|
||||
String responseContent = this.mainService.post(url, json);
|
||||
return WxCpBaseResp.fromJson(responseContent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user