🆕 #3079 【企业微信】增加提醒成员群发和停止企业群发的接口

This commit is contained in:
zhongjun 2023-07-13 11:18:36 +08:00 committed by GitHub
parent 831aac31ba
commit 753497579c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 0 deletions

View File

@ -690,6 +690,39 @@ public interface WxCpExternalContactService {
*/
WxCpMsgTemplateAddResult addMsgTemplate(WxCpMsgTemplate wxCpMsgTemplate) throws WxErrorException;
/**
* 提醒成员群发
* 企业和第三方应用可调用此接口重新触发群发通知提醒成员完成群发任务24小时内每个群发最多触发三次提醒
* <p>
* 请求方式: POST(HTTPS)
* <p>
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/remind_groupmsg_send?access_token=ACCESS_TOKEN
* <p>
* <a href="https://developer.work.weixin.qq.com/document/path/97610">文档地址</a>
*
* @param msgId 群发消息的id通过获取群发记录列表接口返回
* @return the wx cp msg template add result
*/
WxCpBaseResp remindGroupMsgSend(String msgId) throws WxErrorException;
/**
* 停止企业群发
* 企业和第三方应用可调用此接口停止无需成员继续发送的企业群发
* <p>
* 请求方式: POST(HTTPS)
* <p>
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/cancel_groupmsg_send?access_token=ACCESS_TOKEN
* <p>
* <a href="https://developer.work.weixin.qq.com/document/path/97611">文档地址</a>
*
* @param msgId 群发消息的id通过获取群发记录列表接口返回
* @return the wx cp msg template add result
*/
WxCpBaseResp cancelGroupMsgSend(String msgId) throws WxErrorException;
/**
* 发送新客户欢迎语
* <pre>

View File

@ -418,6 +418,24 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
return WxCpMsgTemplateAddResult.fromJson(this.mainService.post(url, wxCpMsgTemplate.toJson()));
}
@Override
public WxCpBaseResp remindGroupMsgSend(String msgId) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("msgid", msgId);
final String url = this.mainService.getWxCpConfigStorage()
.getApiUrl(REMIND_GROUP_MSG_SEND);
return WxCpBaseResp.fromJson(this.mainService.post(url, params.toString()));
}
@Override
public WxCpBaseResp cancelGroupMsgSend(String msgId) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("msgid", msgId);
final String url = this.mainService.getWxCpConfigStorage()
.getApiUrl(CANCEL_GROUP_MSG_SEND);
return WxCpBaseResp.fromJson(this.mainService.post(url, params.toString()));
}
@Override
public void sendWelcomeMsg(WxCpWelcomeMsg msg) throws WxErrorException {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(SEND_WELCOME_MSG);

View File

@ -1148,6 +1148,14 @@ public interface WxCpApiPathConsts {
* The constant ADD_MSG_TEMPLATE.
*/
String ADD_MSG_TEMPLATE = "/cgi-bin/externalcontact/add_msg_template";
/**
* 提醒成员群发
*/
String REMIND_GROUP_MSG_SEND = "/cgi-bin/externalcontact/remind_groupmsg_send";
/**
* 停止企业群发
*/
String CANCEL_GROUP_MSG_SEND = "/cgi-bin/externalcontact/cancel_groupmsg_send";
/**
* The constant SEND_WELCOME_MSG.
*/

View File

@ -615,4 +615,26 @@ public class WxCpExternalContactServiceImplTest {
this.wxCpService.getExternalContactService().getJoinWay(configId);
}
/**
* 提醒成员群发
*
* @throws WxErrorException
*/
@Test
public void testRemindGroupMsgSend() throws WxErrorException {
this.wxCpService.getExternalContactService()
.remindGroupMsgSend("msgGCAAAXtWyujaWJHDDGi0mACAAAA");
}
/**
* 测试取消提醒成员群发
*
* @throws WxErrorException
*/
@Test
public void testCancelGroupMsgSend() throws WxErrorException {
this.wxCpService.getExternalContactService()
.cancelGroupMsgSend("msgGCAAAXtWyujaWJHDDGi0mACAAAA");
}
}