栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

使用python通过接口方式发送钉钉消息

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用python通过接口方式发送钉钉消息

目前钉钉支持群聊消息的通过接口发送,需要建立群聊:

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)
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/339556.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号