1.点击左上角头像,打开微信管理平台 2.创建应用 3.获取五个参数 3.1获取应用的AgentId、Secret 3.2获取企业ID 配置接收消息服务器URL 企业微信限制过多,公司域名所有
配置接收消息服务器URL
企业微信限制过多,公司域名所有权检验不通过。采用接收消息服务器URL的方式。
先将请求打到公网服务器ngnix、再转发给内网穿透地址,请求Java后端。
免费的内网穿透
一分钟图文快速上手
使用vscode,将UTF-8 BOM文本编码改为UTF-8
编写代码参考的文章
//token public final static String TOKEN = "n5SHOwoXKo9UTQg2zv3Vs2B"; // encodingAESKey public final static String ENCODINGAES_KEY = "wVdvdhBY6EDWG96S7EjU6hg9BR3v7M5SS9a4jK"; //企业ID public final static String CORP_ID = "wwec27f62ca8"; //应用的凭证密钥 public final static String CORPSECRET = "PdDcN-ZjInXNsvNuzlPl55qZrLLVJvDvcIp3wZNt"; @GetMapping("/wei") public void list(httpservletRequest request, HttpServletResponse response) throws ioException { // 微信加密签名 String msg_signature = request.getParameter("msg_signature"); // 时间戳 String timestamp = request.getParameter("timestamp"); // 随机数 String nonce = request.getParameter("nonce"); // 随机字符串 String echostr = request.getParameter("echostr"); System.out.println("request=" + request.getRequestURL()); PrintWriter out = response.getWriter(); // 通过检验msg_signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 String result = null; try { WXBizMsGCrypt wxcpt = new WXBizMsgCrypt(TOKEN, ENCODINGAES_KEY, CORP_ID); result = wxcpt.VerifyURL(msg_signature, timestamp, nonce, echostr); } catch (AesException e) { e.printStackTrace(); } if (result == null) { result = TOKEN; } out.print(result); out.close(); out = null; }
设置成功
来源地址:https://blog.csdn.net/qq_43751489/article/details/129721000
--结束END--
本文标题: 企业微信消息推送(一)接收消息服务器URL
本文链接: https://www.lsjlt.com/news/422039.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-13
2024-05-13
2024-05-11
2024-05-11
2024-05-10
2024-05-07
2024-04-30
2024-04-30
2024-04-30
2024-04-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0