這個發微信的腳本是之前領導給的,只能羣發,可是若是用戶分組的話,得去企業微信號裏再建個應用,這樣就會有2個cropid和secret,能夠寫個文件,去文件裏取cropid和secretapi
#cat sendWeChat.shbash
#!/bin/bash CropID=wx3f2412099b302562 Secret=rJjcnyardWkvRZC7JRdBhtdbPcsfpd0gpaIJ8gWBrrZlhtjJFqYfKo1VtTB1WlHc GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret" Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F\" '{print $4}') PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken" #/usr/bin/curl --data-ascii "$(body $1 $2 $3)" $PURL #/usr/bin/curl --data-ascii '{ "touser": "@all", "toparty": " @all ","msgtype": "text","agentid": "1","text": {"content": "zabbix"},"safe":"0"}' $PURL agentid=$1 Content=$3 /usr/bin/curl --data-ascii "{ \"touser\": \"@all\", \"toparty\": \" @all \",\"msgtype\": \"text\",\"agentid\": \"${agentid}\",\"text\": {\"content\": \"$Content\"},\"safe\":\"0\"}" $PURL
、微信