#!/bin/bash
webhook='https://oapi.dingtalk.com/robot/send?access_token=34XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
GX='更新服务'
host=`hostname -I | awk '{print $1}'`
ZT=$1
function SendMsgToDingding() {
curl $webhook -H 'Content-Type: application/json' -d "
{
'msgtype': 'text',
'text': {
'content': '$GX\n操作服务器:IP$host 状态是否成功:$ZT\n'
},
'at': {
'isAtAll': false
}
}"
}
SendMsgToDingding
遇到的问题
{"errcode":300001,"errmsg":"message param title is null "}
需要添加 增加at参数
自定义机器人开发:https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq