1. Study From
https://www.cnblogs.com/elvi/p/11444388.html
2. 申请或者使用已经有的企业微信.
首先是获取一下企业id
方法如图:

3. 创建一个应用, 并且获取app的secret

然后能够看到相应的密钥

4. 编写一个shell 脚本发送消息, 注意 我这里还没搞明白 如何给群发
CropID='ww7a1xxxxxxxxa986'
Secret='lI9QYb_8xxxxxxxxxxxxxxxxxxZYVIE'
GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret"
Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F " '{print $10}')
PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken"
UserID=$1
PartyID=$2
AppID=$3
Msg=$4
function body() {
printf '{
'
printf '"touser": "'$UserID'",
'
printf '"toparty": "'$PartyID'",
'
printf '"msgtype": "text",
'
printf '"agentid": "'$AppID'",
'
printf '"text": {
'
printf '"content": "'$Msg'"
'
printf '},
'
printf '"safe":"0"
'
printf '}
'
}
#body $1
curl --data-ascii "$(body $1)" $PURL
printf '
'
echo "over!"
5. 进行测试验证即可.

./sendt "yourname|magic" 1 1000002 赵本帅测试发消息
最后
以上就是优美鸡最近收集整理的关于推送html到企业微信,Bash 脚本发送消息到企业微信的办法的全部内容,更多相关推送html到企业微信,Bash内容请搜索靠谱客的其他文章。
发表评论 取消回复