Jenkins 通知到 企业微信群

创建企业微信内部群

1,创建群
2,创建群机器人,获取toten。

# -*- coding: utf-8 -*-
import json
import requests
import json
import time

def jenkins():
    # 企业微信机器人的webhook
    #  文档地址
    # https://work.weixin.qq.com/api/doc?notreplace=true#90000/90136/91770
    // 创建一个内部群,创建微信机器人,获取token
    weixinToken="微信群token"

    con={"msgtype": "text","text":
        {"content": "站点构建提醒
构建站点:Developer
构建结果:FAILURE
构建失败,请您检查代码并重新构建,谢谢",
         "mentioned_list":["@all"]
        },

        }

    conMd={"msgtype": "markdown","markdown": {"content": "实时新增用户反馈<font color="warning">132例</font>,请相关同事注意。
 
         >类型:<font color="comment">用户反馈</font> 
  
         >普通用户反馈:<font color="comment">117例</font> 
   
         >VIP用户反馈:<font color="comment">15例</font>",
         }
         }

    jd=json.dumps(conMd).encode('utf-8')
    header={'Content-Type':'application/json'}
    res=requests.post(weixinToken,data=jd,headers=header)
    print (res.text)

if __name__=="__main__":
    jenkins()

最终结果

原文地址:https://www.cnblogs.com/trimphNuan/p/12804106.html