《微信机器人开发必备:微信Web协议大全(3)》要点:
本文介绍了微信机器人开发必备:微信Web协议大全(3),希望对您有用。如果有疑问,可以联系我们。
相关主题:web微信和微信机器人
仅用于统计
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxstatreport?fun=new&lang=zh_CN
header Content-Type:application/json;charset=UTF-8
content
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?lang=zh_CN&pass_ticket=tM909DkHH8fXLR7hhwIgn9MqmSuCxx6%252BcdaA9qE203zxP7fMT%252FtxPlY7opbnnVE2
lang zh_CN
pass_ticket 登录后返回信息中获取
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":566148615,
"Sid":"2qui+CC4YTiiI2zk",
"Skey":"@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0",
"DeviceID":"e784205590563506"
},
"Msg":{
"Type":1,
"Content":"@啊啊啊 啊啊啊啊啊啊",
"FromUserName":"@595d9f44c64e2f480baa0d6430ca58ef053a768daa6d7b3fcc4bece244bcbce3",
"ToUserName":"@@9e1c0ab62b5ab222835786c00192fb1e10c75f8082c245d360ac6a6bd2efe2df",
"LocalID":"14766146756340722",
"ClientMsgId":"14766146756340722"
},
"Scene":0
}
Type:1(文字消息),
Content:要发送的消息,
FromUserName:自己ID,
ToUserName:好友ID,
LocalID:与clientMsgId相同,
ClientMsgId:时间戳左移4位随后补上4位随机数
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"MsgID":"4527210051674039705",
"LocalID":"14766146756340722"
}
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendemoticon?fun=sys&lang=zh_CN
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":566148615,
"Sid":"2qui+CC4YTiiI2zk",
"Skey":"@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0",
"DeviceID":"e961665475339031"
},
"Msg":{
"Type":47,
"EmojiFlag":2,
"EMoticonMd5":"44682e637b75a3f5d6747d61dbd23a15",
"FromUserName":"@595d9f44c64e2f480baa0d6430ca58ef053a768daa6d7b3fcc4bece244bcbce3",
"ToUserName":"@e5403f77c2193da671790c1a242d0b43ac6f570e5047993ef745d13d6376b57b",
"LocalID":"14766150190560991",
"ClientMsgId":"14766150190560991"
},
"Scene":0
}
Type:47 emoji消息,
EmojiFlag:2,
MediaId:表情上传后的媒体ID,
FromUserName:自己ID,
ToUserName:好友ID,
LocalID:与clientMsgId相同,
ClientMsgId:时间戳左移4位随后补上4位随机数
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"MsgID":"1604548346807369725",
"LocalID":"14766150190560991"
}
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg?fun=async&f=json&lang=zh_CN
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":566148615,
"Sid":"2qui+CC4YTiiI2zk",
"Skey":"@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0",
"DeviceID":"e374531581999650"
},
"Msg":{
"Type":3,
"MediaId":"@crypt_4d268bd0",
"FromUserName":"@595d9f44c64e2f480baa0d6430ca58ef053a768daa6d7b3fcc4bece244bcbce3",
"ToUserName":"@e5403f77c2193da671790c1a242d0b43ac6f570e5047993ef745d13d6376b57b",
"LocalID":"14766158484990338",
"ClientMsgId":"14766158484990338"
},
"Scene":0
}
Type:3媒体消息,
MediaId:表情上传后的媒体ID,
FromUserName:自己ID,
ToUserName:好友ID,
LocalID:与clientMsgId相同,
ClientMsgId:时间戳左移4位随后补上4位随机数
响应
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"MsgID":"6722400141243782346",
"LocalID":"14766158484990338"
}
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendappmsg?fun=async&f=json
header Content-Type:application/json;charset=UTF-8
content
{
"BaseRequest":{
"Uin":566148615,
"Sid":"NO0RlTCXvpBGaag7",
"Skey":"@crypt_14ae1b12_3bdec7023595f68f9900b5d9d7d30b75",
"DeviceID":"e984332143788024"
},
"Msg":{
"Type":6,
"Content":"<appmsg appid='wxeb7ec651dd0aefa9' sdkver=''><title>top10.csv</title><des></des><action></action><type>6</type><content></content><url></url><lowurl></lowurl><appattach><totallen>1760</totallen><attachid>@crypt_f672a24d_9d9c7d6a3b5ec058db1e6eb3d7c66917ede2e615535e9659365322de110ac41877d9a3b878ed82c0959f9b4602ef6e6d784ae853ab4e242d201cb19b9ee255a337f884eab998c5c43e7d433c01f14c91</attachid><fileext>csv</fileext></appattach><extinfo></extinfo></appmsg>",
"FromUserName":"@257b5aa7fb7b1672afb889be97197478cf618d9bab2b470cf767a61ae9f7f321",
"ToUserName":"@@ab3e18c922f8ab162762f6da231236137ca52871419ec9cafc2421607e82e1ca",
"LocalID":"14767614604200494",
"ClientMsgId":"14767614604200494"
},
"Scene":0
}
响应
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
},
"MsgID":"6923581840474342573",
"LocalID":"14767614604200494"
}
https://file.wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json
header Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryoWmrkW7MIGyBhlOt
content
id 文件id
name 文件名
type 文件类型
lastModifieDate 最后修改时间
size 文件大小
mediatype 文件媒体类型 doc pic
uploadmediarequest(json字符串)
UploadType上传类型2
BaseRequest
Uin登录中获得
Sid登录中获得
Skey登录中获得
DeviceID设备id
ClientMediaId文件本地消息id
TotalLen文件总大小
StartPos开始位置
DataLen数据长度
MediaType媒体类型4
FromUserName发送用户id
ToUserName接受用户id
FileMd5文件md5
webwx_data_ticket cookie中信息
pass_ticket
filename 文件流
响应
{
"BaseResponse":{
"Ret":0,
"ErrMsg":""
}
,
"MediaId":"@crypt_6084141c_c73c046b750fd6e3e82d0aba4839b89b30851de7eace0446a4f73b524e3b43d41b24048e9c10cf7ba3387d04d63e6bd75bf8e3237acdddda5d4e3ede176617370573ebb2f820595076c55906a50a50a7",
"StartPos":25929,
"CDNThumbImgHeight":0,
"CDNThumbImgWidth":0
}
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&MsgID=6829659093985341608&skey=%40crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0&type=slave
MsgID:消息ID
type: slave 略缩图or为空时加载原图
skey: xxx
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgeticon?seq=637275253&username=@aa357b7fc1ccb2e77a2632a6251fb6de2c5dd1c0ec503f04b25cfd34c256956a&skey=@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0
seq:数字,可为空
username: ID
skey: xxx
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetheadimg?seq=0&username=@@eca74ece82ad7947d262c59d53ab5d001e8776374141377cc025956b44bd1c03&skey=@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0
seq:数字,可为空
username:群ID
skey: xxx
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetvoice?msgid=6181125285738858128&skey=@crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0
msgid:消息ID
skey: xxx
https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetvideo?msgid=114757855447263581&skey=%40crypt_14ae1b12_1bb5e370393b8cd502919825fe9dbfc0
msgid:消息ID
skey: xxx