首页 > 其他分享 >调用企业微信机器人发送消息

调用企业微信机器人发送消息

时间:2022-10-20 16:01:53浏览次数:43  
标签:__ 调用 weixin 微信 机器人 send url markdown

1、在群聊中添加一个机器人

 

添加完机器人之后,复制Webhook地址

 

 

 

 具体推送消息说明,参考配置说明

 

#!/usr/bin/env python3
# -*-coding:utf-8 -*-
import requests


class SendMsg:
    @staticmethod
    def send_qy_weixin(msg):
     # Webhook地址 url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx' r = requests.post(url=url, json=msg, headers={'Content-type':'application/json'}) if __name__ == '__main__': send_message = { "msgtype": "markdown", "markdown": { "content": "# 网站打不开了!\n" + "> 时间:\n" + "> 域名:\n" + "> 详情:域名连续请求次,返回失败", "mentioned_list": ["@all"] } } print(SendMsg.send_qy_weixin(send_message))

 

标签:__,调用,weixin,微信,机器人,send,url,markdown
From: https://www.cnblogs.com/ai594ai/p/16810164.html

相关文章