VBS调用Webhook推消息给企业微信

tao 2023-8-22 921

测试过好用,可以代替SMTP用邮件发


Dim token,url,params
params = "{""msgtype"":""text"",""text"":{""content"":""XXXX你想写的内容XXXX""}}"
url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXX你自己的XXXX"
Function HttpRequest(url,mode,params)
    Dim oauth_http
    Set oauth_http=CreateObject("MSXML2.XMLHTTP")
    oauth_http.Open mode,url,False
    If UCase(mode) = "POST" Then
    oauth_http.setRequestHeader "Content-Type","application/json"
    End If
    oauth_http.Send(params)
    HttpRequest = oauth_http.responseText
    'msgbox HttpRequest
    Set oauth_http = nothing
End Function

MsgBox (HttpRequest(url,"POST",params))


最新回复 (0)
返回
发新帖