其他分享
首页 > 其他分享> > 钉钉机器人通知

钉钉机器人通知

作者:互联网

#!/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

标签:dingtalk,通知,机器人,webhook,GX,SendMsgToDingding,https,text
来源: https://www.cnblogs.com/x602/p/13707215.html