Ai
1 Star 0 Fork 0

wangpf/script

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qywx_msg.sh 886 Bytes
一键复制 编辑 原始数据 按行查看 历史
wangpf 提交于 2021-08-24 16:56 +08:00 . 添加企业微信消息推送
#!/bin/bash
#要发送的消息
msg=$1
content=$msg
#企业id
qywx_corpid=
#企业应用的secret
qywx_corpsecret=
#指定接收消息的成员
touser=
#指定接收消息的部门
toparty=
#企业应用的id
agentid=1000004
response_token="$(curl -s "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$qywx_corpid&corpsecret=$qywx_corpsecret")"
other_token="{\"errcode\":0,\"errmsg\":\"ok\",\"access_token\":\""
other_token2="\",\"expires_in\":7200}"
response_token=${response_token/$other_token/}
access_token=${response_token/$other_token2/}
msg_body="{\"touser\":\"$touser\",\"toparty\":\"$toparty\",\"msgtype\":\"text\",\"agentid\":$agentid,\"text\":{\"content\":\"$content\"}}"
req_send_msg_url=https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$access_token
req_msg=$(curl -s -H "Content-Type: application/json" -X POST -d $msg_body $req_send_msg_url)
echo $req_msg
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/NealC/script.git
git@gitee.com:NealC/script.git
NealC
script
script
master

搜索帮助