目前钉钉支持群聊消息的通过接口发送,需要建立群聊:
1、创建群聊
2、群聊设置自定义机器人:
根据提示自定义设置,最后获取webhook地址
3、发送消息实现:
def sendDing(msg):
'''
发送钉钉消息功能
'''
dingding_url = 'https://oapi.dingtalk.com/robot/send?access_token=******'
data = {"msgtype": "text","text": {"content": "内部群:"+str(msg)}}
headers = {'Content-Type':'application/json;charset=UTF-8'}
send_data = json.dumps(data).encode('utf-8')
ret = requests.post(url=dingding_url,data=send_data,headers=headers)
print(ret.text)
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有