Skip to content

微信公众号推送通知

获取accesstoken

请求地址:https://api.weixin.qq.com/cgi-bin/stable_token?

请求body:

json
{
    "grant_type": "client_credential", 
    "appid": "wx*************", 
    "secret": "0a************"
}

返回结果:200 OK

Connection: close

Date: Wed, 21 Aug 2024 14:18:30 GMT

Content-Type: application/json; encoding=utf-8

Content-Length: 173

json
{
    "access_token": "83_8f5pJQs9****", 
    "expires_in": 7200
}

发送模板消息

请求地址:https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=83_8f5pJQs9****

请求body:

json
{
	"touser": "oTkp**************************",
	"template_id": "LnBy*********************",
	"url": "https://xxx.lancelotzhu.top",
	"data": {
		"system": {
			"value": "Drone"		
        },
        "time": {
			"value": "2024年8月21日 10:59:01"		
        },
        "content": {
			"value": "构建失败"		
        }
	}
}

信息

微信通知信息已经取消自定义颜色、emoji字符展示,详情见关于规范公众号模板消息的公告

返回结果:200 OK

Connection: close

Date: Wed, 21 Aug 2024 14:18:30 GMT

Content-Type: application/json; encoding=utf-8

Content-Length: 203

json
{
    "errcode": 0,
    "errmsg": "ok",
    "msgid": 3601412366887337989
}