钉钉自定义机器人 API 官方文档
一、自定义机器人
郑重警告⚠️
每个机器人每分钟只可以发送 20
条信息,多了,会被禁止使用 10
分钟.
shell 示例代码
msg='shark:我就是我'
url="https://oapi.dingtalk.com/robot/send?access_token=bd5fb98176ad5c5a1a34cb7147cac10c847e9c37e3c31e30311cc413079c899f"
curl $url \
-H 'Content-Type: application/json' \
-d '{"msgtype": "text",
"text": {
"content": "'${msg}'"
}
}'
python 示例代码
import requests
content = {
"msgtype": "text",
"text": {
"content": "出发!"
},
"at": {
# "atMobiles": [
# # 单独 @ 某个人
# "131xxxxxx81"
# ],
# "isAtAll": False
# @ 所有人
"isAtAll": True
}
}
headers = {"Content-Type": "application/json;charset=utf-8"}
url = "https://oapi.dingtalk.com/robot/send?access_token=xxx"
r = requests.post(url=url,headers=headers,json=content)
print(r.content)