微信网页版接口详解

  |   0 评论   |   0 浏览

微信网页版接口详解

一、网页版微信提供的HTTP接口

1、获取uuid

  • 说明 :用于获取显示二维码以及登录所需的 uuid ,标识获取二维码和扫码的为同一个用户
  • 请求方式 :GET
  • 地址https://login.wx.qq.com/jslogin
  • get参数
参数示例值说明
  • 返回 :
  window.QRLogin.code = 200; window.QRLogin.uuid = "wb7R2kx9dA==";

2、显示二维码

  • 说明 :展示一张用于登陆的二维码图片,地址里的**{uuid}传第一步所获取的uuid**
  • 请求方式 :GET
  • 地址https://login.wx.qq.com/qrcode/{uuid}
  • get参数
参数示例值说明
  • 返回 :二维码的二进制流,浏览器打开会直接显示一张二维码图片

3、轮询登录

  • 说明 :尝试登录。若此时用户手机已完成扫码并点击登录,则返回一个真正用于登录的url地址。否则接口大概10s后返回未扫码或未登录的状态码
  • 请求方式 :GET
  • 地址https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login
  • get参数
参数示例值说明
  • 返回

:redirect_uri的值可以直接用于下一步的“登录并获取公参”请求

window.code=200(408为未扫码,201为已扫码但未点击登录,200为成功登录);window.redirect_uri="https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=AfrMMbhsnElmA7xc1R9CWUq-@qrticket_0&uuid=4ZnG7WZ0Cg==&lang=zh_CN&scan=1520738372";

4、登录并获取公参

  • 说明 :访问后可获取一组公参,用于之后访问所有的接口。这也意味着如果这部分数据泄露,代表其他人可以在这段时间内随意操作你的微信(仅限于网页版支持的操作)
  • 请求方式 :GET
  • 地址https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage
  • get参数 :直接用上一步返回的redirect_uri中的所有参数即可
  • 返回

:获取并存储该返回值中的四个参数

skey 、 wxsid 、 wxuin 、 pass_ticket

,以及所返回Cookie中的

webwx_data_ticket , webwx_auth_ticket

<error>
    <ret>0</ret>
    <message></message>
    <skey>@crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4</skey>
    <wxsid>+urBrYI292xoIknf</wxsid>
    <wxuin>211722515</wxuin>
    <pass_ticket>qg%2BL%2BfjNnoHyqYsL3xj0KoNi5nqchsInPWWSxDwqCJ8%3D</pass_ticket>
    <isgrayscale>1</isgrayscale>
  </error>

5、微信初始化

  • 说明 :初始化微信首页栏的联系人、公众号等(不是通讯录里的联系人),初始化登录者自己的信息(包括昵称等),初始化同步消息所用的SycnKey
  • 请求方式 :POST
  • 地址https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit
  • get参数
参数示例值说明
  • post参数:(json格式)
  {
      BaseRequest: {
          Uin: 211722515,
          Sid: +urBrYI292xoIknf,
          Skey: @crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4,
          DeviceID: e545297464380306上边的DeviceID可以用如下代码生成,每次登录过程中保持一致。String DeviceID = "e" + String.valueOf(new Random().nextLong()).substring(1, 16);
      }
  }
  • 返回

:获取并存储该返回值中的四个参数

skey 、 wxsid 、 wxuin 、 pass_ticket ,以及所返回Cookie中的 webwx_data_ticket ,webwx_auth_ticket

  {
      "BaseResponse": {
          "Ret": 0,
          "ErrMsg": ""
      },
      "Count": 11,
      "ContactList": [{微信首页的联系人,不是保存在通讯录中的联系人
          "Uin": 0,
          "UserName": "filehelper",
          "NickName": "文件传输助手",
          "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=680769514&username=filehelper&skey=@crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4",
          "ContactFlag": 1,
          "MemberCount": 0,
          "MemberList": [],
          "RemarkName": "",
          "HideInputBarFlag": 0,
          "Sex": 0,
          "Signature": "",
          "VerifyFlag": 0,
          "OwnerUin": 0,
          "PYInitial": "WJCSZS",
          "PYQuanPin": "wenjianchuanshuzhushou",
          "RemarkPYInitial": "",
          "RemarkPYQuanPin": "",
          "StarFriend": 0,
          "AppAccountFlag": 0,
          "Statues": 0,
          "AttrStatus": 0,
          "Province": "",
          "City": "",
          "Alias": "",
          "SnsFlag": 0,
          "UniFriend": 0,
          "DisplayName": "",
          "ChatRoomId": 0,
          "KeyWord": "fil",
          "EncryChatRoomId": "",
          "IsOwner": 0
      }, 
          ......此处省略剩下的10个联系人信息
      ],
      "SyncKey": { 同步消息时用的syncKey,用于之后轮询消息的接口
          "Count": 4,
          "List": [{
              "Key": 1,
              "Val": 700722177
          }, {
              "Key": 2,
              "Val": 700723184
          }, {
              "Key": 3,
              "Val": 700723136
          }, {
              "Key": 1000,
              "Val": 1520723642
          }]
      },
      "User": { 登录者的信息
          "Uin": 211722515,
          "UserName": "@f4c054c78f40743b095b85409dbdc1b3", 微信随机码,每个联系人和群都有,每次登录由微信端随机分配
          "NickName": "测试微信号的昵称",
          "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=1730335888&username=@f4c054c78f40743b095b85409dbdc1b3&skey=@crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4",
          "RemarkName": "",
          "PYInitial": "",
          "PYQuanPin": "",
          "RemarkPYInitial": "",
          "RemarkPYQuanPin": "",
          "HideInputBarFlag": 0,
          "StarFriend": 0,
          "Sex": 1,
          "Signature": "这里是签名",
          "AppAccountFlag": 0,
          "VerifyFlag": 0,
          "ContactFlag": 0,
          "WebWxPluginSwitch": 0,
          "HeadImgFlag": 1,
          "SnsFlag": 17
      },
      "ChatSet": "filehelper,weixin,@52d5b97ca1bed2d76b405fba4c4ded6c893bd6b28cc514344dd9a7d8cd766286,@4baf3160e84b9e726efd1a0629d16b01,@@54a4fd2c81875aac779935330b67bf7905793bb66da9c6d4029f18f4927b3c1c,@@9542a551bfcafe1ae83b931d21b318573c8c6e2c67f3eaef189e7e9179cdb2d1,@ac3532106e21aa250cc746055a0c72d5,@d593e5745931641d060cdc9fcda5d996,@34f12e07290f62677137181998bf4c1eb0a9c128f2355562e8cc7967d0f9a044,@@31e445167b2fd23404b672f6f1a4a805fffbd369d6bae8efe959240a6c50cf46,@@c5fa6cb3779e217b5ae3e9b3d53faef09d6cde9615106ebe0a115de38976c7fc,@513fcb83ccc696b9d90206f0e80eb8e341e35e1f464b08446795132d180db040,@@b944058f6fd91b850867bb1f534205e86460b4b3a947f4ca4bd49109e532116f,@@859e98412d1faf03abdf784e97ed66b25c52dccc7ec446d681b2906525262fcd,@257fb1c805c1429ca45a737143d7a7e1302487d9bbb268bf2dd8a564bf814186,filehelper,@@dc3e7f04b1ccead2ecf8c50eaa476d6c71dc3f7396696be0724002e1ee228812,@@d1758feb60b1ff7ad262b8fb05ee9f1c1821722a0376a1431cee351c75cbebc3,@@e49ba13661221be9c9f81fb952391754ee74f98d2457f46364bdb745943b2bfc,@@a5cdd9eb797807cc081bc0e3ab3f101c9dc18d86d527c5defed8e8fd9010ec06,@@dfab3cde2a39ccdf31da803381528f130dae207583a5c088514bf4e1a0af49ab,@@13776e6ea475a8e86a46e4f242917db146664572e910dcca976047cb31e660f4,@@d1999c210e6f9a19d28b4a8fcc391a7b612c9765ff5bd078aaa022e1cc8bbf5c,",
      "SKey": "@crypt_8b4f09cc_ce5178b3c156048fff69cdf1fccc31e4",
      "ClientVersion": 637927733,
      "SystemTime": 1520742050,
      "GrayScale": 1,
      "InviteStartCount": 40,
      "MPSubscribeMsgCount": 1,
      "MPSubscribeMsgList": [{
          "UserName": "@4baf3160e84b9e726efd1a0629d16b01",
          "MPArticleCount": 1,
          "MPArticleList": [{
              "Title": "不动手就能逛淘宝,这又是什么“黑科技”?英国小哥表示:中文说得溜就是这么方便! | 解码新时代",
              "Digest": "张口说话就能逛淘宝,沉溺“黑科技”的英国小哥表示不想回家了!",
              "Cover": "http://mmbiz.qpic.cn/mmbiz_jpg/8vd2Hk2TS2Pfibh9ILZKicg5icBlWKHBIVibVM8Vupsg3NsfSnibzptB9XQxArqzFmfOw7nlk6ByTdNvWBoBf4NjVmQ/640?wxtype=jpeg&wxfrom=0",
              "Url": "http://mp.weixin.qq.com/s?__biz=MjM5MzI3NTI2MA==&mid=2651224106&idx=1&sn=0a5772013ae7c14dd9ac854f30fad934&chksm=bd6b54398a1cdd2f6f9c1d61c93aa3248968b8b56206a0af85341f510322b21548c975d8ebba&scene=0#rd"
          }],
          "Time": 1520732033,
          "NickName": "中国日报双语新闻"
      }],
      "ClickReportInterval": 600000
  }

6、获取联系人列表

参数示例值说明
  • post参数:
{
     "BaseRequest": {均是公参中的值
         "Uin": 211722515,
         "Sid": "+FhlgkGS3wD/GKQw",
         "Skey": "@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050",
         "DeviceID": "e609547902722302"
     }
 }
  • 返回

:所有通讯录中的联系人信息,主要在MemberList中查看

{
    "BaseResponse": {
        "Ret": 0,
        "ErrMsg": ""
    },
    "MemberCount": 771,
    "MemberList": [{
            "Uin": 0,
            "UserName": "@9c30c8d81e75a7eff0603cdd5de860b18fe92995845473fc2f0cda6ed76053cb",(微信随机码,潜规则:前面@为联系人,@@为群)
            "NickName": "Nandi Wardhana",(联系人的微信昵称)
            "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=620986971&username=@9c30c8d81e75a7eff0603cdd5de860b18fe92995845473fc2f0cda6ed76053cb&skey=@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050",
            "ContactFlag": 3,
            "MemberCount": 0,(如果是群,该字段表示成员数量)
            "MemberList": [],(群成员列表)
            "RemarkName": "",(备注名称,如果空则说明没有给他备注)
            "HideInputBarFlag": 0,
            "Sex": 1,(性别,1为男,2为女)
            "Signature": "Stay young naturally...",(签名)
            "VerifyFlag": 0,(用来判断是否是公众号或服务号的字段)
            "OwnerUin": 0,
            "PYInitial": "NANDIWARDHANA",
            "PYQuanPin": "NandiWardhana",(名字拼音全拼)
            "RemarkPYInitial": "",
            "RemarkPYQuanPin": "",
            "StarFriend": 0,
            "AppAccountFlag": 0,
            "Statues": 0,
            "AttrStatus": 2359303,
            "Province": "Jakarta Raya",(省份)
            "City": "",(城市)
            "Alias": "",
            "SnsFlag": 17,
            "UniFriend": 0,
            "DisplayName": "",(如果是群内成员,该字段表示群内名称)
            "ChatRoomId": 0,
            "KeyWord": "",
            "EncryChatRoomId": "",(如果是群,该字段表示群的id,不同于微信随机码@@那个)
            "IsOwner": 0
        },
        ... 此处省略剩下770个联系人信息
    ]
}

7、批量获取联系人详情

参数示例值说明
  • post参数:
{
      "BaseRequest": {
          "Uin": 211722515,
          "Sid": "+FhlgkGS3wD/GKQw",
          "Skey": "@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050",
          "DeviceID": "e862192966399662"
      },
      "Count": 2,
      "List": [{ 这里表示需要获取详情的所有联系人
              "UserName": "@@e203c90e07d64242336d573acd4a1db1c01ccb92ca05410444a3003c282c21db",
              "EncryChatRoomId": ""
          },
          {
              "UserName": "@ba194a63575be7fd0f4ea4e4547b2942d0dccc7fffc00ef5a6d141f93adb7739",
              "EncryChatRoomId": ""
          }
      ]
  }
  • 返回:* *
{
      "BaseResponse": {
          "Ret": 0,
          "ErrMsg": ""
      },
      "Count": 2,
      "ContactList": [{
              "Uin": 0,
              "UserName": "@ba194a63575be7fd0f4ea4e4547b2942d0dccc7fffc00ef5a6d141f93adb7739",
              "NickName": "张三丰",
              "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=680786093&username=@ba194a63575be7fd0f4ea4e4547b2942d0dccc7fffc00ef5a6d141f93adb7739&skey=",
              "ContactFlag": 3,
              "MemberCount": 0,
              "MemberList": [],
              "RemarkName": "丰哥",
              "HideInputBarFlag": 0,
              "Sex": 2,
              "Signature": "<span class=\"emoji emoji2600\"></span> 一定会找到<span class=\"emoji emoji1f31b\"></span>",
              "VerifyFlag": 0,
              "OwnerUin": 0,
              "PYInitial": "ZSF",
              "PYQuanPin": "zhangsanfeng",
              "RemarkPYInitial": "FG",
              "RemarkPYQuanPin": "fengge",
              "StarFriend": 0,
              "AppAccountFlag": 0,
              "Statues": 0,
              "AttrStatus": 111719,
              "Province": "北京",
              "City": "平谷",
              "Alias": "",
              "SnsFlag": 17,
              "UniFriend": 0,
              "DisplayName": "",
              "ChatRoomId": 0,
              "KeyWord": "",
              "EncryChatRoomId": "0",
              "IsOwner": 0
          }
          ...此处省略第二个联系人信息
      ]
  }

8、消息检查

参数示例值说明
  • 返回:
window.synccheck={retcode:"0",selector:"2"}

  retcode
  SUCCESS("0", "成功"),
  TICKET_ERROR("-14", "ticket错误"),
  PARAM_ERROR("1", "传入参数错误"),
  NOT_LOGIN_WARN("1100", "未登录提示"),
  NOT_LOGIN_CHECK("1101", "未检测到登录"),
  COOKIE_INVALID_ERROR("1102", "cookie值无效"),
  LOGIN_ENV_ERROR("1203", "当前登录环境异常,为了安全起见请不要在web端进行登录"),
  TOO_OFEN("1205", "操作频繁");

  selector
  NORMAL("0", "正常"),
  NEW_MSG("2", "有新消息"),
  MOD_CONTACT("4", "有人修改了自己的昵称或你修改了别人的备注"),
  ADD_OR_DEL_CONTACT("6", "存在删除或者新增的好友信息"),
  ENTER_OR_LEAVE_CHAT("7", "进入或离开聊天界面");

9、获取最新消息

  • 说明 :当同步检查接口显示有新消息时,调用该接口获取具体的新消息。此处的新消息为广义的,包括消息,修改群名,群内成员变化,加好友等。
  • 请求方式 :POST
  • 地址https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsync
  • get参数
参数示例值说明
  • ** *** post参数*:*** *
{
"BaseRequest": {
          "Uin": 211722515,
          "Sid": "+FhlgkGS3wD/GKQw",
          "Skey": "@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050",
          "DeviceID": "e304534670317808"
      },
      "SyncKey": {
          "Count": 4,
          "List": [{
              "Key": 1,
              "Val": 700722177
          }, {
              "Key": 2,
              "Val": 700724323
          }, {
              "Key": 3,
              "Val": 700724315
          }, {
              "Key": 1000,
              "Val": 1520925834
          }]
      },
      "rr": -508959981  String.valueOf(-new Date().getTime() / 1000)
  }
  • 主要有AddMsgList,ModContactList,DelContactList,新一轮消息同步的synckey
  {
      "BaseResponse": {
          "Ret": 0,
          "ErrMsg": ""
      },
      "AddMsgCount": 1, 新增信息
      "AddMsgList": [{
          "MsgId": "320984672637990367", 服务端返回的消息id,可用于撤回接口参数。如果是图片,该参数还可以作为调用微信获取图片接口的参数之一。
          "FromUserName": "@abf90232027117affa7f0c0df3d1bf20", 发消息的人
          "ToUserName": "@abf90232027117affa7f0c0df3d1bf20", 发给谁
          "MsgType": 51, 消息类型,1为文字,3为图片...,具体请参照消息类型表
          "Content": "",
          "Status": 3,
          "ImgStatus": 1,
          "CreateTime": 1520927383,
          "VoiceLength": 0,
          "PlayLength": 0,
          "FileName": "",
          "FileSize": "",
          "MediaId": "",
          "Url": "",
          "AppMsgType": 0,
          "StatusNotifyCode": 4,
          "ForwardFlag": 0,
          "AppInfo": {
              "AppID": "",
              "Type": 0
          },
          "HasProductId": 0,
          "Ticket": "",
          "ImgHeight": 0,
          "ImgWidth": 0,
          "SubMsgType": 0,
          "NewMsgId": 320984672637990367,
          "OriContent": "",
          "EncryFileName": ""
      }],
      "ModContactCount": 0, 联系人修改
      "ModContactList": [],
      "DelContactCount": 0, 联系人删除
      "DelContactList": [],
      "ModChatRoomMemberCount": 0, 群内成员变动
      "ModChatRoomMemberList": [],"ContinueFlag": 0,
      "SyncKey": { 新一轮消息更新用这些SyncKey
          "Count": 7,
          "List": [{
              "Key": 1,
              "Val": 700722177
          }, {
              "Key": 2,
              "Val": 700724325
          }, {
              "Key": 3,
              "Val": 700724315
          }, {
              "Key": 11,
              "Val": 700724093
          }, {
              "Key": 201,
              "Val": 1520927383
          }, {
              "Key": 1000,
              "Val": 1520925834
          }, {
              "Key": 1001,
              "Val": 1520917874
          }]
      },
      "SKey": "",
      "SyncCheckKey": { 新一轮消息同步用这些Key
          "Count": 7,
          "List": [{
              "Key": 1,
              "Val": 700722177
          }, {
              "Key": 2,
              "Val": 700724325
          }, {
              "Key": 3,
              "Val": 700724315
          }, {
              "Key": 11,
              "Val": 700724093
          }, {
              "Key": 201,
              "Val": 1520927383
          }, {
              "Key": 1000,
              "Val": 1520925834
          }, {
              "Key": 1001,
              "Val": 1520917874
          }]
      }
  
  }

10、创建群聊

11、修改群聊

12、发送消息

参数示例值说明
  • ** post参数 :**
{
      "BaseRequest": {
          "Uin": 211722515,
          "Sid": "+FhlgkGS3wD/GKQw",
          "Skey": "@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050",
          "DeviceID": "e107694022625701"
      },
      "Msg": {
          "Type": 1,
          "Content": "呵呵",
          "FromUserName": "@abf90232027117affa7f0c0df3d1bf20",
          "ToUserName": "filehelper",
          "LocalID": "15209344559450477", 时间戳左移4位随后补上4位随机数
          "ClientMsgId": "15209344559450477"     "MediaId": "" 如果是图片才传这个值
      },
      "Scene": 0
  }
  • 返回:
{
      "BaseResponse": {
          "Ret": 0,
          "ErrMsg": ""
      },
      "MsgID": "7615282929538795099", 服务端返回的消息id,可用于撤回等接口的参数
      "LocalID": "15209344559450477" 本地的消息id,是你自己发请求时的参数
}

13、上传文件到微信服务器

  • 说明 :发送图片时需要先调用该接口将图片上传至微信服务器,微信会返回一个图片的id,发送消息时携带该id即可发送图片。
  • 请求方式 :POST(此处的Content-Type应该设置为multipart/form-data; boundary=…------------------41184676334)
  • 地址https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia
  • get参数
参数示例值说明
  • ** post参数 :**
 -----------------------------41184676334
  Content-Disposition: form-data; name="id" 此处随意
  
  WU_FILE_0
  -----------------------------41184676334
  Content-Disposition: form-data; name="name" 图片名称
  
  Desert.jpg
  -----------------------------41184676334
  Content-Disposition: form-data; name="type" 图片类型
  
  image/jpeg
  -----------------------------41184676334
  Content-Disposition: form-data; name="lastModifiedDate" 发送时间,该参数可无
  
  Tue Jul 14 2009 13:32:31 GMT+0800
  -----------------------------41184676334
  Content-Disposition: form-data; name="size" 图片大小
  
  845941
  -----------------------------41184676334
  Content-Disposition: form-data; name="chunks" 总共分多少批上传
  
  2
  -----------------------------41184676334
  Content-Disposition: form-data; name="chunk" 当前是第几批
  
  0
  -----------------------------41184676334
  Content-Disposition: form-data; name="mediatype" 当传图片时,此处写pic
  
  pic
  -----------------------------41184676334
  Content-Disposition: form-data; name="uploadmediarequest" 

{ "UploadType": 2, 固定为2 "BaseRequest": { "Uin": 211722515, "Sid": "+FhlgkGS3wD/GKQw", "Skey": "@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050", "DeviceID": "e787605163473377" }, "ClientMediaId": 1520935168955, "TotalLen": 845941, 文件大小 "StartPos": 0, "DataLen": 845941, 文件大小 "MediaType": 4, 固定为4,表示图片 "FromUserName": "@abf90232027117affa7f0c0df3d1bf20", 该参数可填可不填 "ToUserName": "filehelper", 该参数可填可不填 "FileMd5": "ba45c8f60456a672e003a875e469d0eb" 该参数随机一个uuid即可 }

-----------------------------41184676334
  Content-Disposition: form-data; name="webwx_data_ticket"
  
  gSenocajd7UaXQesCD3smJ5p
  -----------------------------41184676334
  Content-Disposition: form-data; name="pass_ticket"
  
  yp5RfCpb/sNVex0Uepn1BWXNCYCqTfqe8NOYzan+4Y4=
  -----------------------------41184676334
  Content-Disposition: form-data; name="filename"; filename="Desert.jpg"
  Content-Type: application/octet-stream此处为该文件的流,前端写成<input type="file">就是这个效果
  • **返回:**可能分批次上传,最后上传成功时返回如下结果
{
      "BaseResponse": {
          "Ret": 0,
          "ErrMsg": ""
      },下面的MediaId参数,作为下一步发送图片接口的入参,就可以发送该图片了
      "MediaId": "@crypt_14402eb3_bb9eee20e7239fcd3323a0ea5a36cfd5e7fd162b72e03088efa4f63f53219c6f672c6be3ec1865291a70f38bb82bc5bf1d42166996b4a0313abe95454bff0316c19bfd29b71f4f98ccb7d301eed7b74995e35eabfd3f8264a3d684b8e9f08485ad00c3955cdc5b60ac96e67a9ca24bf7a01b9363ae0364f75fa0c9e6235e2dc91aef95b34c71c503deada9898a28ce5bf13d908f7834f7cae427aaba68aff5500125314f73b79f5a63103d430aa162420262e3d1a5e5f110cba0f2ee20017aaf0f127303153dcf63f9e5a56ff8c64f5dfb3f229011374b34fe7a905b0ee055d85b76827e2e68b8947c7b5fcd56c98ede9f012b6160a193762f63842886dca36872727db0c3cd4761af96c56bfdfb0a42630fee9954c764b5cd31f6ff666649b028bb1852366e639e1008cee678d5e587aabbe78014307ae1fbe638e2c0b52115",
      "StartPos": 845941,
      "CDNThumbImgHeight": 75,
      "CDNThumbImgWidth": 100,
      "EncryFileName": "Desert.jpg"
  }

14、发送图片

参数示例值说明
  • ** post参数 :**同发文本消息,只是多一个MediaId
  • **返回:**同发文本消息

15、获取图片

参数示例值说明
  • ** 携带3个cookie的值 :**wxuin,wxsid,webwx_data_ticket
  • **返回:**图片的流

二、一些状态码code值的说明

1. BaseResponse里的Ret

SUCCESS("0", "成功"),
   TICKET_ERROR("-14", "ticket错误"),
   PARAM_ERROR("1", "传入参数错误"),
   NOT_LOGIN_WARN("1100", "未登录提示"),
   NOT_LOGIN_CHECK("1101", "未检测到登录"),
   COOKIE_INVALID_ERROR("1102", "cookie值无效"),
   LOGIN_ENV_ERROR("1203", "当前登录环境异常,为了安全起见请不要在web端进行登录"),
   TOO_OFEN("1205", "操作频繁");

1. 同步消息检查返回值中retcode和selector

retcode
     SUCCESS("0", "成功"),
     TICKET_ERROR("-14", "ticket错误"),
     PARAM_ERROR("1", "传入参数错误"),
     NOT_LOGIN_WARN("1100", "未登录提示"),
     NOT_LOGIN_CHECK("1101", "未检测到登录"),
     COOKIE_INVALID_ERROR("1102", "cookie值无效"),
     LOGIN_ENV_ERROR("1203", "当前登录环境异常,为了安全起见请不要在web端进行登录"),
     TOO_OFEN("1205", "操作频繁");
   selector
     NORMAL("0", "正常"),
     NEW_MSG("2", "有新消息"),
     MOD_CONTACT("4", "有人修改了自己的昵称或你修改了别人的备注"),
     ADD_OR_DEL_CONTACT("6", "存在删除或者新增的好友信息"),
     ENTER_OR_LEAVE_CHAT("7", "进入或离开聊天界面");

2. 消息类型

   TEXT(1, "文本消息类型"),
   IMAGE(3, "图片消息"),
   VOICE(34, "语音消息"),
   VIDEO(43, "小视频消息"),
   MICRO_VIDEO(62, "短视频消息"),
   EMOTI_CON(47, "表情消息"),
   MEDIA(49, "多媒体消息"),
   VOIP_MSG(50, ""),
   VOIP_NOTIFY(52, ""),
   VOIP_INVITE(53, ""),
   LOCATION(48, ""),
   STATUS_NOTIFY(51, "状态通知,自己访问了某一个聊天页面"),
   SYS_NOTICE(9999, ""),
   POSSIBLE_FRIEND_MSG(40, ""),
   VERIFY_MSG(37, "好友请求"),
   SHARE_CARD(42, "分享名片"),
   SYS(10000, "系统消息"),
   RECALLED(10002, "撤回消息");

作者:闪客sun
来源:https://www.cnblogs.com/flashsun/p/


标题:微信网页版接口详解
作者:michael
地址:https://blog.junxworks.cn/articles/2023/05/15/1684143913529.html