Skip to content

Commit

Permalink
binarywang#3079 成员群发提醒
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjun96 committed Jul 13, 2023
1 parent b564b1a commit 52c0d3c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
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 @@ -408,7 +408,8 @@ public WxCpUserExternalGroupChatStatistic getGroupChatStatistic(Date startTime,
}
json.add("owner_filter", ownerFilter);
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(LIST_GROUP_CHAT_DATA);
final String url = this.mainService.getWxCpConfigStorage()
.getApiUrl(LIST_GROUP_CHAT_DATA);
return WxCpUserExternalGroupChatStatistic.fromJson(this.mainService.post(url, json.toString()));
}

Expand All @@ -418,6 +419,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 @@ -613,6 +613,29 @@ public void testGetJoinWay() throws WxErrorException {

final String configId = "";

this.wxCpService.getExternalContactService().getJoinWay(configId);
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");
}
}

0 comments on commit 52c0d3c

Please sign in to comment.