Skip to content

#3079 企业微信-提醒成员群发,停止企业群发 #3080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,39 @@ WxCpUserExternalGroupChatStatistic getGroupChatStatistic(Date startTime, Integer
*/
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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,24 @@ public WxCpMsgTemplateAddResult addMsgTemplate(WxCpMsgTemplate wxCpMsgTemplate)
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,14 @@ interface ExternalContact {
* 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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,4 +615,26 @@ public void testGetJoinWay() throws WxErrorException {

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");
}
}