《微信機器人開發(fā)必備:微信Web協(xié)議大全》要點:
本文介紹了微信機器人開發(fā)必備:微信Web協(xié)議大全,希望對您有用。如果有疑問,可以聯(lián)系我們。
相關(guān)主題:web微信和微信機器人
https://login.wx.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1476606163580
appid: wx782c26e4c19acffb(固定值)
redirect_rui: https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage(url編碼)
fun:new(固定值)
lang: zh_CN(固定值)
_: unix時間戳
window.QRLogin.code = 200; window.QRLogin.uuid = "gf5Gk61zEA==";
window.QRLogin.uuid的值就是我們需要的uuid
https://login.weixin.qq.com/qrcode/gf5Gk61zEA==
固定格式: https://login.weixin.qq.com/qrcode/{uuid}
https://login.weixin.qq.com/l/gf5Gk61zEA==
固定格式: https://login.weixin.qq.com/l/{uuid}
https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=gf5Gk61zEA==&tip=0&r=862560455&_=1476606163582
loginicon:true
uuid: uuid
tip:0
r:862560455(非必須)
_: unix時間戳
window.code=408;// 登錄超時(408)
window.code=201;window.userAvatar=' userAvatar為用戶頭像
window.code=200;// 確認登錄(200), redirect_uri獲取cookie
window.redirect_uri="https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=AYfheMIH6tt9EmcZ0DxCKF4a@qrticket_0&uuid=YeGrrvqmHQ==&lang=zh_CN&scan=1476606728";
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=AYfheMIH6tt9EmcZ0DxCKF4a@qrticket_0&uuid=YeGrrvqmHQ==&lang=zh_CN&scan=1476606728&fun=new&version=v2&lang=zh_CN
上一步的redirect_uri
<error>
<ret>0</ret>
<message></message>
<skey>@crypt_14ae1b12_b73ba2673448154847d7007a2de3c53b</skey>
<wxsid>jSsRlGGPyY7U8det</wxsid>
<wxuin>566148615</wxuin>
<pass_ticket>kUY4PSgKNy4eOlWI%2FwIBMVULe3KHPVyvDqw1%2B4DVVu9McVvE2d5fL7LFOfa4iYnk</pass_ticket>
<isgrayscale>1</isgrayscale>
</error>
skey
, wxsid
, wxuin
, pass_ticket
和返回的cookie
都需要保存(后面要用)
獲取聯(lián)系人信息, 公眾號信息, 自己的賬號信息
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=862039733&lang=zh_CN&pass_ticket=kUY4PSgKNy4eOlWI%252FwIBMVULe3KHPVyvDqw1%252B4DVVu9McVvE2d5fL7LFOfa4iYnk
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":"566148615",
"Sid":"jSsRlGGPyY7U8det",
"Skey":"@crypt_14ae1b12_b73ba2673448154847d7007a2de3c53b",
"DeviceID":"e119795675188164"
}
}
Uin,Sid,Skey:登錄后獲取的xml中的數(shù)據(jù)
DeviceID: e +隨機數(shù)
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"Count":11,
"ContactList":[...],//聯(lián)系人信息, 公眾號信息, 群
"SyncKey":{
"Count":4,
"List":[
{
"Key":1,
"Val":635705559
},
...//同步key值, 下次請求時要寫到上
]
},
"User":{
"Uin": xxx,
"UserName": xxx,
"NickName": xxx,
"HeadImgUrl": xxx,
"RemarkName":"",
"PYInitial":"",
"PYQuanPin":"",
"RemarkPYInitial":"",
"RemarkPYQuanPin":"",
"HideInputBarFlag":0,
"StarFriend":0,
"Sex":1,
"Signature":"Apt-get install B",
"AppAccountFlag":0,
"VerifyFlag":0,
"ContactFlag":0,
"WebWxPluginSwitch":0,
"HeadImgFlag":1,
"SnsFlag":17
},
"ChatSet":"xxx",
"SKey":"@crypt_14ae1b12_b73ba2673448154847d7007a2de3c53b",
"ClientVersion":369302288,
"SystemTime":1476608977,
"GrayScale":1,
"InviteStartCount":40,
"MPSubscribeMsgCount":7,
"ClickReportInterval":600000
}
客戶端讀取消息后要發(fā)起請求, 告訴服務(wù)器消息已經(jīng)讀取, 從而通知手機客戶端
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify?pass_ticket=ZDJfLCa0EAKrLn2CdD7MDl%252B54GwlW0IEiwYOsm6II%252F8W57y0pF1F8fqS%252B5z4INU5
pass_ticket 登錄請求返回的xml中的值
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":566148615,
"Sid":"EKjoZCMRIvrY7NIP",
"Skey":"@crypt_14ae1b12_f59314a579c67b15f838d09feb79c17f",
"DeviceID":"e098855372553243"
},
"Code":3,
"FromUserName":自己ID,
"ToUserName":自己ID,
"ClientMsgId":時間戳
}
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"MsgID":"1525762281689643050"
}
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.snjht.com/jiaocheng/14287.html