企业微信api接口,企业微信sdk
企业微信api接口,企业微信sdk
1、企业微信SDK接口API调用-企业微信好友收发消息
/**
* 给企业微信好友发消息
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
TalkToFriendTaskMessage.Builder bd = TalkToFriendTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
TalkToFriendTaskMessage req = bd.build();
// 将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.TalkToFriendTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 企业微信好友发来聊天消息
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {
try {
FriendTalkNoticeMessage req = vo.getContent().unpack(FriendTalkNoticeMessage.class);
log.debug(JsonFormat.printer().print(req));
log.debug(LocalDateTime.now()+" 微信好友发来聊天消息 对应的线程名: "+Thread.currentThread().getName());
//消息转发到pc端
asyncTaskService.msgSend2pc(String.valueOf(req.getWxId()), EnumMsgType.FriendTalkNotice, req);
// 告诉客户端消息已收到
MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), e.getMessage());
}
}
2、企业微信SDK接口API调用-通过手机号或微信好友添加客户
/**
* 企业微信搜索手机号添加微信
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
public void handleMsg(ChannelHandlerContext ctx ,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
AddCustomerFromSearchTaskMessage.Builder bd = AddCustomerFromSearchTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
AddCustomerFromSearchTaskMessage req = bd.build();
// 将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.AddCustomerFromSearchTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 从企业微信好友中添加客户
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
public void handleMsg(ChannelHandlerContext ctx ,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
AddCustomerFromWxTaskMessage.Builder bd = AddCustomerFromWxTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
AddCustomerFromWxTaskMessage req = bd.build();
// 将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.AddCustomerFromWxTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
3、企业微信SDK接口API调用-触发企业微信推送联系人列表
/**
* 触发推送企业微信联系人列表任务
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
CommonTriggerTaskMessage.Builder bd = CommonTriggerTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
CommonTriggerTaskMessage req = bd.build();
//将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.TriggerContactPushTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 企业微信推送联系人列表
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {
try {
ContactPushNoticeMessage req = vo.getContent().unpack(ContactPushNoticeMessage.class);
log.debug(JsonFormat.printer().print(req));
asyncTaskService.msgSend2pc(String.valueOf(req.getWxId()), EnumMsgType.ContactPushNotice, req);
// 告诉客户端消息已收到
MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), Constant.ERROR_MSG_DECODFAIL);
}
}
4、企业微信SDK接口API调用-触发企业微信推送会话列表
/**
* 触发企业微信推送会话列表任务
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
CommonTriggerTaskMessage.Builder bd = CommonTriggerTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
CommonTriggerTaskMessage req = bd.build();
//将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.TriggerConversationPushTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 企业微信聊天会话列表推送
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {
try {
ConversationPushNoticeMessage req = vo.getContent().unpack(ConversationPushNoticeMessage.class);
log.debug(JsonFormat.printer().print(req));
asyncTaskService.msgSend2pc(String.valueOf(req.getWxId()), EnumMsgType.ConversationPushNotice, req);
// 告诉客户端消息已收到
MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), Constant.ERROR_MSG_DECODFAIL);
}
}
5、企业微信SDK接口API调用-触发推送企业微信微信好友
/**
* 触发企业微信推送微信好友列表
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
CommonTriggerTaskMessage.Builder bd = CommonTriggerTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
CommonTriggerTaskMessage req = bd.build();
//将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.TriggerWechatFriendPushTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 企业微信好友列表推送,用于从微信好友中添加客户
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
@Async
public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {
try {
WxFriendPushNoticeMessage req = vo.getContent().unpack(WxFriendPushNoticeMessage.class);
log.debug(JsonFormat.printer().print(req));
asyncTaskService.msgSend2pc(String.valueOf(req.getWxId()), EnumMsgType.WxFriendPushNotice, req);
// 告诉客户端消息已收到
MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), Constant.ERROR_MSG_DECODFAIL);
}
}
企业微信api接口,企业微信sdk相关推荐
- 个人微信api接口调用-微信群管理
个人微信api接口调用-微信群管理 /*** 微信群聊管理* @author wechatno:tangjinjinwx* @blog http://www.wlkankan.cn*/@Asyncpu ...
- 微信API接口、微信二次开发API调用
微信API接口.微信二次开发API调用 微信协议接口调用-加微信好友及通过好友请求 加微信好友 /** * 微信自动添加好友 * @author wechatno:tangjin ...
- 个人号的微信API接口,微信机器人二次开发
前段时间应公司需求,要开发一套自定义的微信机器人,具体需求是可以自己批量添加好友.批量打标签等进行好友管理,社群管理需要自动聊天,自动回复,发朋友圈,转发语音,以及定时群发等,还可以提取聊天内容,进行 ...
- 用python配合微信API接口将微信个人号变为聊天机器人
操作系统:Ubuntu16.04 首先我们先安装itchat: 这里我之前安装过了,先在又安装了一边 使用 python3 -c "import itchat" 检查是否安装成功了 ...
- SERP调用企业微信API接口,发送文本信息实例
SERP企业轻量级ERP(SSDCRM)起源于vtigercrm早期版本.随着我们不停的迭代研发与完善,今日已经形成了自己鲜明的应用风格.我们在完善平台内部功能的基础上,积极研发平台与企业微信,钉钉, ...
- 微信API接口目录大全
微信API接口目录大全 1.基础消息类型 1.客户端发送的心跳包HeartBeatReq = 1001; 2.消息接收确认回复(接收或拒绝接收)MsgReceivedAck = 1002; 3.错 ...
- 微信api接口调用-发朋友圈
微信api接口调用-发朋友圈 /*** 发微信朋友圈* @author wechatno:tangjinjinwx* @blog http://www.wlkankan.cn*/@Asyncpubli ...
- 调用个人微信的API接口实现微信收发消息
调用个人微信的API接口实现微信收发消息 /** * 接受微信好友发来聊天消息 * @author wechatno:tangjinjinwx * @param ctx * @param vo */ ...
- java给朋友发微信_微信api接口,给微信好友收发消息
微信api接口,给微信好友收发消息 /** * 给微信好友发消息 * @author wechatno:tangjinjinwx * @blog http://www.wlkankan.cn */ @ ...
- 个人微信api接口调用-给微信好友或群聊发消息
个人微信api接口调用-给微信好友或群聊发消息 /*** 给微信好友发消息* @author wechatno:tangjinjinwx* @blog http://www.wlkankan.cn*/ ...
最新文章
- [转]Gearman分布式远程过程处理框架
- 数字电路可控门电路原理(三态/同相/反相、缓冲/驱动电路)
- 关于c++ pair自己遇到的一个问题?为何不一样?为何第一个程序不能返回pair内数组的值呢?(已经解决)
- IBM将推NVMe存储解决方案
- tomcat jsp导入java_[导入]Tomcat JSP Web 开发中的乱码问题小姐
- 计算机游戏手机攻略,云顶之弈无敌攻略,竟然是用手机玩出来的
- ios 语言本地化处理
- web前端知识天天学(3)
- 深度学习 --- 优化入门五(Batch Normalization(批量归一化)二)
- [NHFrog]发布第三个版本_NHibernate嵌入式代码生成器
- Caffe(12)--实现YOLOv2目标检测
- 计算二叉树叶子结点数
- 【FPGA】基于VGA的图像显示
- Photoshop教程_PS渐变工具找不到,怎样导入ps渐变样式?ps渐变使用教程.
- 华为连接wifi显示wifi未连接服务器,华为手机连接WIFI但是无法上网怎么解决
- 2021龙岩一中高考成绩查询,高考成绩放榜!龙岩各大高中喜报来了~
- Arranging The Sheep(移动思维)
- 【论文阅读01】2021 兵棋推演的智能决策技术与挑战 尹奇跃
- 火狐插件restclient发送post请求
- 夜神模拟器连接手柄无反应_夜神安卓模拟器怎么连接手柄 夜神模拟器连接手柄教程...