mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 16:18:51 +08:00
🆕 【公众号】增加返回响应信息完整内容的客服消息发送接口的方法
This commit is contained in:
parent
13b484a071
commit
37ae6807e6
@ -267,7 +267,7 @@ public interface WxCpTpService {
|
|||||||
* 获取WxMpConfigStorage 对象.
|
* 获取WxMpConfigStorage 对象.
|
||||||
*
|
*
|
||||||
* @return WxMpConfigStorage wx cp tp config storage
|
* @return WxMpConfigStorage wx cp tp config storage
|
||||||
* @Deprecated storage应该在service内部使用,提供这个接口,容易破坏这个封装
|
* @deprecated storage应该在service内部使用,提供这个接口,容易破坏这个封装
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
WxCpTpConfigStorage getWxCpTpConfigStorage();
|
WxCpTpConfigStorage getWxCpTpConfigStorage();
|
||||||
|
@ -25,14 +25,29 @@ public interface WxMpKefuService {
|
|||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* 发送客服消息
|
* 发送客服消息
|
||||||
* 详情请见: <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547&token=&lang=zh_CN">发送客服消息</a>
|
* 详情请见: <a href="https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html">发送客服消息</a>
|
||||||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param message the message
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean sendKefuMessage(WxMpKefuMessage message) throws WxErrorException;
|
boolean sendKefuMessage(WxMpKefuMessage message) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 发送客服消息
|
||||||
|
* 详情请见: <a href="https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html">发送客服消息</a>
|
||||||
|
* 接口url格式:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
* @return the response
|
||||||
|
* @throws WxErrorException 异常
|
||||||
|
*/
|
||||||
|
String sendKefuMessageWithResponse(WxMpKefuMessage message) throws WxErrorException;
|
||||||
|
|
||||||
//*******************客服管理接口***********************//
|
//*******************客服管理接口***********************//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,6 +57,7 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @return the wx mp kf list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfList kfList() throws WxErrorException;
|
WxMpKfList kfList() throws WxErrorException;
|
||||||
@ -53,6 +69,7 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @return the wx mp kf online list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfOnlineList kfOnlineList() throws WxErrorException;
|
WxMpKfOnlineList kfOnlineList() throws WxErrorException;
|
||||||
@ -64,6 +81,8 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param request the request
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfAccountAdd(WxMpKfAccountRequest request) throws WxErrorException;
|
boolean kfAccountAdd(WxMpKfAccountRequest request) throws WxErrorException;
|
||||||
@ -74,6 +93,10 @@ public interface WxMpKefuService {
|
|||||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">客服管理</a>
|
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">客服管理</a>
|
||||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param request the request
|
||||||
|
* @return the boolean
|
||||||
|
* @throws WxErrorException the wx error exception
|
||||||
*/
|
*/
|
||||||
boolean kfAccountUpdate(WxMpKfAccountRequest request) throws WxErrorException;
|
boolean kfAccountUpdate(WxMpKfAccountRequest request) throws WxErrorException;
|
||||||
|
|
||||||
@ -84,6 +107,8 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN
|
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param request the request
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException;
|
boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException;
|
||||||
@ -95,6 +120,9 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param kfAccount the kf account
|
||||||
|
* @param imgFile the img file
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfAccountUploadHeadImg(String kfAccount, File imgFile) throws WxErrorException;
|
boolean kfAccountUploadHeadImg(String kfAccount, File imgFile) throws WxErrorException;
|
||||||
@ -106,6 +134,8 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param kfAccount the kf account
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfAccountDel(String kfAccount) throws WxErrorException;
|
boolean kfAccountDel(String kfAccount) throws WxErrorException;
|
||||||
@ -120,6 +150,9 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param openid the openid
|
||||||
|
* @param kfAccount the kf account
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfSessionCreate(String openid, String kfAccount) throws WxErrorException;
|
boolean kfSessionCreate(String openid, String kfAccount) throws WxErrorException;
|
||||||
@ -132,6 +165,9 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param openid the openid
|
||||||
|
* @param kfAccount the kf account
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean kfSessionClose(String openid, String kfAccount) throws WxErrorException;
|
boolean kfSessionClose(String openid, String kfAccount) throws WxErrorException;
|
||||||
@ -144,6 +180,8 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param openid the openid
|
||||||
|
* @return the wx mp kf session get result
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfSessionGetResult kfSessionGet(String openid) throws WxErrorException;
|
WxMpKfSessionGetResult kfSessionGet(String openid) throws WxErrorException;
|
||||||
@ -156,6 +194,8 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @param kfAccount the kf account
|
||||||
|
* @return the wx mp kf session list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfSessionList kfSessionList(String kfAccount) throws WxErrorException;
|
WxMpKfSessionList kfSessionList(String kfAccount) throws WxErrorException;
|
||||||
@ -168,6 +208,7 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token=ACCESS_TOKEN
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @return the wx mp kf session wait case list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfSessionWaitCaseList kfSessionGetWaitCase() throws WxErrorException;
|
WxMpKfSessionWaitCaseList kfSessionGetWaitCase() throws WxErrorException;
|
||||||
@ -186,7 +227,7 @@ public interface WxMpKefuService {
|
|||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @param msgId 消息id顺序从小到大,从1开始
|
* @param msgId 消息id顺序从小到大,从1开始
|
||||||
* @param number 每次获取条数,最多10000条
|
* @param number 每次获取条数,最多10000条
|
||||||
* @return 聊天记录对象
|
* @return 聊天记录对象 wx mp kf msg list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException;
|
WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException;
|
||||||
@ -201,7 +242,7 @@ public interface WxMpKefuService {
|
|||||||
*
|
*
|
||||||
* @param startTime 起始时间
|
* @param startTime 起始时间
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @return 聊天记录对象
|
* @return 聊天记录对象 wx mp kf msg list
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpKfMsgList kfMsgList(Date startTime, Date endTime) throws WxErrorException;
|
WxMpKfMsgList kfMsgList(Date startTime, Date endTime) throws WxErrorException;
|
||||||
@ -222,6 +263,7 @@ public interface WxMpKefuService {
|
|||||||
*
|
*
|
||||||
* @param openid 用户id
|
* @param openid 用户id
|
||||||
* @param command "Typing":对用户下发“正在输入"状态 "CancelTyping":取消对用户的”正在输入"状态
|
* @param command "Typing":对用户下发“正在输入"状态 "CancelTyping":取消对用户的”正在输入"状态
|
||||||
|
* @return the boolean
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
boolean sendKfTypingState(String openid, String command) throws WxErrorException;
|
boolean sendKfTypingState(String openid, String command) throws WxErrorException;
|
||||||
|
@ -4,7 +4,6 @@ import com.google.gson.JsonObject;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||||
import me.chanjar.weixin.common.error.WxError;
|
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
|
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
|
||||||
import me.chanjar.weixin.mp.api.WxMpKefuService;
|
import me.chanjar.weixin.mp.api.WxMpKefuService;
|
||||||
@ -29,8 +28,12 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendKefuMessage(WxMpKefuMessage message) throws WxErrorException {
|
public boolean sendKefuMessage(WxMpKefuMessage message) throws WxErrorException {
|
||||||
String responseContent = this.wxMpService.post(MESSAGE_CUSTOM_SEND, message.toJson());
|
return this.sendKefuMessageWithResponse(message) != null;
|
||||||
return responseContent != null;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String sendKefuMessageWithResponse(WxMpKefuMessage message) throws WxErrorException {
|
||||||
|
return this.wxMpService.post(MESSAGE_CUSTOM_SEND, message.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user