text
#!/bin/bash
#-*- coding:utf-8 -*-
Message=${1}
curl https://oapi.dingtalk.com/robot/send?access_token=0b63fc24************************** \
-H 'Content-Type: application/json' \
-d "
{\"msgtype\": \"text\",
\"text\": {
\"content\": \"消息内容:$Message\"
}
}"
发送文本内容并@指定的人
curl 'https://oapi.dingtalk.com/robot/send?access_token=0b63fc24**************************' \
-H 'Content-Type: application/json' \
-d '{"msgtype":"text","text":{"content":"哈哈哈"},"at":{"atMobiles":["13911111111"],"isAtAll":true}}'
actionCard
#!/bin/bash
function SendMessageToDingding(){
Dingding_Url="https://oapi.dingtalk.com/robot/send?access_token=0b63fc24**************************"
# 发送钉钉消息
curl "${Dingding_Url}" -H 'Content-Type: application/json' -d "
{
\"actionCard\": {
\"title\": \"$1\",
\"text\": \"$2\",
\"hideAvatar\": \"0\",
\"btnOrientation\": \"0\",
\"btns\": [
{
\"title\": \"$1\",
\"actionURL\": \"\"
}
]
},
\"msgtype\": \"actionCard\"
}"
}
Subject="$1"
Body="$2"
SendMessageToDingding $Subject $Body