当前位置: 首页 > news >正文

wordpress导航主题haow成都网站改版优化

wordpress导航主题haow,成都网站改版优化,mac下搭建wordpress,鞍山58二手车现在使用飞书的人越来越多了,飞书有一个最大的好处,可以使用webhook简便的发送群消息。而在工作中,也经常会因为一些运维方面的工作,需要给飞书发送群消息,来实时提醒相关负责人,及时处理工作。 一、先看一下效果吧&a…

现在使用飞书的人越来越多了,飞书有一个最大的好处,可以使用webhook简便的发送群消息。而在工作中,也经常会因为一些运维方面的工作,需要给飞书发送群消息,来实时提醒相关负责人,及时处理工作。

一、先看一下效果吧:

最后有整个项目代码下载

二、飞书创建群

三、java通过webhook发飞书发送消息

通过上一步,已经获取到如下信息(根据实际情况复制出来,后面会用到):

webhook地址:https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxx

签名校验:xxxxxxx

上面两个获取到了,下面就是java发送了

1、bootstrap.yml中配置如下:

spring:application:name: base
server:port: 9080servlet:context-path: /
feishu:aiUrl: https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxx #飞书机器人通知secret: xxxxxxxxxxxxxxxxsignName: 基础平台

2、controller代码

package com.ck.controller;import com.ck.config.FeiShuAiClient;
import com.ck.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;@RestController
@RequestMapping("/test")
@Api(tags = "TestController", description = "测试")
public class TestController {private static final Logger logger = LoggerFactory.getLogger(TestController.class);@Autowiredprivate TestService testService;@Autowiredprivate FeiShuAiClient feiShuAiClient;@GetMapping("/send")@ApiOperation("发送内空")public String find(String name) {name="当前发送内容:"+name;feiShuAiClient.sendMsg(name);return "发送成功";}
}

3、发送飞书代码

 /*** 发送结果* @param content*/public void sendMsg(String content){content="【"+signName+"】"+content;Long timestamp = getTimestamp();String sign = Sign(timestamp);FeiShuContentVo contentVo = new FeiShuContentVo(content);FeiShuAiVo aiVo = new FeiShuAiVo();aiVo.setTimestamp(timestamp.toString());aiVo.setSign(sign);aiVo.setMsg_type("text");aiVo.setContent(contentVo);String paramJson = GsonUtils.toJson(aiVo);String result = doPost(aiUrl,paramJson);log.info("飞书发送内容:"+content+",发送结果:"+result);}public String genSign(String secret, long timestamp) {//把timestamp+"\n"+密钥当做签名字符串String stringToSign = timestamp + "\n" + secret;//使用HmacSHA256算法计算签名Mac mac = null;try {mac = Mac.getInstance("HmacSHA256");mac.init(new SecretKeySpec(stringToSign.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));byte[] signData = mac.doFinal(new byte[]{});return new String(Base64.encodeBase64(signData));} catch (Exception e) {e.printStackTrace();}return null;}

四、验证

五:代码下载地址:百度网盘 请输入提取码

通过百度网盘分享的文件:send-feishu-msg
链接:https://pan.baidu.com/s/1Dlyy64Tqwer8sSJu7vJGgQ?pwd=yv0l 
提取码:yv0l

http://www.tj-hxxt.cn/news/76188.html

相关文章:

  • 没技术怎么做网站国外网站seo免费
  • 免费建站自己的网址哪里做网站便宜
  • 网站如何优化关键词网站推广网站
  • 车牌照损坏在网站做的能用吗网络营销课程有哪些
  • 西安淘宝网站建设公司排名品牌推广平台
  • 濮阳推广公司seo关键词排名优化教程
  • wordpress 识别pc手机seo薪酬
  • 南京网站推广哪家便宜今日国内新闻头条15条
  • 珠海网站开发定制千锋教育学费一览表
  • 娄底网站建设360官方网站网址
  • 中文的网站做不成二维码销售crm客户管理系统
  • 网站建设的大公司好百度手游app下载
  • 阜阳中国建设银行官网站关键词排名优化是什么意思
  • 纯静态网站挂马今日头条热搜
  • 网页界面设计的英文缩写搜索引擎营销优化的方法
  • 壹搜网站建设优化排名全网推广的方式有哪些
  • 怎么用DREAMWAVER做网站google推广平台怎么做
  • 建站快车复制网站内容免费留电话号码的广告
  • 长春平面网站建设东莞网络营销
  • 和生活app下载安装最新版上海seo优化培训机构
  • 个人做金融网站能赚钱吗网络营销策划是什么
  • 价格低廉换个说法seo经验
  • 易语言和网站做交互百度推广一个点击多少钱
  • 毕业设计 旅游网站建设企业推广软件
  • 网站在线制作平台免费模板网站
  • 资讯网站的好处网络营销方案总结
  • 找网络公司做网站需要注意什么谷歌搜索广告
  • 怎么做销售网站营销外包公司
  • 靓号网建站营销网络图
  • 蓝色企业网站模板百度站长提交网址