{"id":18517610,"url":"https://github.com/urinx/weixinbot","last_synced_at":"2025-05-14T07:09:48.679Z","repository":{"id":43899121,"uuid":"50764285","full_name":"Urinx/WeixinBot","owner":"Urinx","description":"网页版微信API，包含终端版微信及微信机器人","archived":false,"fork":false,"pushed_at":"2019-11-27T08:44:08.000Z","size":1175,"stargazers_count":7293,"open_issues_count":200,"forks_count":1985,"subscribers_count":488,"default_branch":"master","last_synced_at":"2025-04-11T02:51:40.137Z","etag":null,"topics":["api","web-weixin-pipeline","wechat","weixinbot","wxapi"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Urinx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-31T07:53:08.000Z","updated_at":"2025-04-10T07:33:08.000Z","dependencies_parsed_at":"2022-08-28T08:12:33.775Z","dependency_job_id":null,"html_url":"https://github.com/Urinx/WeixinBot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urinx%2FWeixinBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urinx%2FWeixinBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urinx%2FWeixinBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Urinx%2FWeixinBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Urinx","download_url":"https://codeload.github.com/Urinx/WeixinBot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092788,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","web-weixin-pipeline","wechat","weixinbot","wxapi"],"created_at":"2024-11-06T17:05:36.771Z","updated_at":"2025-05-14T07:09:43.669Z","avatar_url":"https://github.com/Urinx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WeixinBot [![star this repo](http://github-svg-buttons.herokuapp.com/star.svg?user=Urinx\u0026repo=WeixinBot\u0026style=flat\u0026background=1081C1)](http://github.com/Urinx/WeixinBot) [![fork this repo](http://github-svg-buttons.herokuapp.com/fork.svg?user=Urinx\u0026repo=WeixinBot\u0026style=flat\u0026background=1081C1)](http://github.com/Urinx/WeixinBot/fork) ![python](https://img.shields.io/badge/python-2.7%20\u0026%203.6-ff69b4.svg)\n\n网页版微信API，包含终端版微信及微信机器人\n\n## Contents\n* [Demo](#Demo)\n* [Web Weixin Pipeline](#Web-Weixin-Pipeline)\n* [Web Weixin API](#Web-Weixin-API)\n* [Discussion Group](#Discussion-Group)\n* [Recent Update](#Recent-Update)\n\n## \u003ca name=\"Demo\"\u003eDemo\u003c/a\u003e\n为了确保能正常运行示例脚本，请安装所需的第三方包。\n\n```\npip install -r requirements.txt\n```\n\n注：下面演示的图片与功能可能不是最新的，具体请看源码。\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"imgs/1.png\" width=\"500\" height=\"550\"/\u003e\n\u003c/div\u003e\n\n按照操作指示在手机微信上扫描二维码然后登录，你可以选择是否开启自动回复模式。\n\n![2](imgs/2.png)\n\n开启自动回复模式后，如果接收到的是文字消息就会自动回复，包括群消息。\n\n![3](imgs/3.png)\n\n名片，链接，动画表情和地址位置消息。\n\n![4](imgs/4.png)\n\n![5](imgs/5.png)\n\n网页版上有的功能目前基本上都能支持。\n\n## \u003ca name=\"Web-Weixin-Pipeline\"\u003eWeb Weixin Pipeline\u003c/a\u003e\n\n```\n       +--------------+     +---------------+   +---------------+\n       |              |     |               |   |               |\n       |   Get UUID   |     |  Get Contact  |   | Status Notify |\n       |              |     |               |   |               |\n       +-------+------+     +-------^-------+   +-------^-------+\n               |                    |                   |\n               |                    +-------+  +--------+\n               |                            |  |\n       +-------v------+               +-----+--+------+      +--------------+\n       |              |               |               |      |              |\n       |  Get QRCode  |               |  Weixin Init  +------\u003e  Sync Check  \u003c----+\n       |              |               |               |      |              |    |\n       +-------+------+               +-------^-------+      +-------+------+    |\n               |                              |                      |           |\n               |                              |                      +-----------+\n               |                              |                      |\n       +-------v------+               +-------+--------+     +-------v-------+\n       |              | Confirm Login |                |     |               |\n+------\u003e    Login     +---------------\u003e New Login Page |     |  Weixin Sync  |\n|      |              |               |                |     |               |\n|      +------+-------+               +----------------+     +---------------+\n|             |\n|QRCode Scaned|\n+-------------+\n```\n\n\n## \u003ca name=\"Web-Weixin-API\"\u003eWeb Weixin API\u003c/a\u003e\n\n### 登录\n\n| API | 获取 UUID |\n| --- | --------- |\n| url | https://login.weixin.qq.com/jslogin |\n| method | POST |\n| data | URL Encode |\n| params | **appid**: `应用ID` \u003cbr\u003e **fun**: new `应用类型` \u003cbr\u003e **lang**: zh\\_CN `语言` \u003cbr\u003e **_**: `时间戳` |\n\n返回数据(String):\n```\nwindow.QRLogin.code = 200; window.QRLogin.uuid = \"xxx\"\n```\n\u003e 注：这里的appid就是在微信开放平台注册的应用的AppID。网页版微信有两个AppID，早期的是`wx782c26e4c19acffb`，在微信客户端上显示为应用名称为`Web微信`；现在用的是`wxeb7ec651dd0aefa9`，显示名称为`微信网页版`。\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"imgs/8.jpg\" width=\"320\" height=\"211\"/\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n| API | 绑定登陆（webwxpushloginurl） |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxpushloginurl |\n| method | GET |\n| params | **uin**: xxx |\n\n返回数据(String):\n```\n{'msg': 'all ok', 'uuid': 'xxx', 'ret': '0'}\n\n通过这种方式可以省掉扫二维码这步操作，更加方便\n```\n\u003cbr\u003e\n\n| API | 生成二维码 |\n| --- | --------- |\n| url | https://login.weixin.qq.com/l/ `uuid` |\n| method | GET |\n\u003cbr\u003e\n\n| API | 二维码扫描登录 |\n| --- | --------- |\n| url | https://login.weixin.qq.com/cgi-bin/mmwebwx-bin/login |\n| method | GET |\n| params | **tip**: 1 `未扫描` 0 `已扫描` \u003cbr\u003e **uuid**: xxx \u003cbr\u003e **_**: `时间戳` |\n\n返回数据(String):\n```\nwindow.code=xxx;\n\nxxx:\n\t408 登陆超时\n\t201 扫描成功\n\t200 确认登录\n\n当返回200时，还会有\nwindow.redirect_uri=\"https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=xxx\u0026uuid=xxx\u0026lang=xxx\u0026scan=xxx\";\n```\n\u003cbr\u003e\n\n| API | webwxnewloginpage |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage |\n| method | GET |\n| params | **ticket**: xxx \u003cbr\u003e **uuid**: xxx \u003cbr\u003e **lang**: zh_CN `语言` \u003cbr\u003e **scan**: xxx \u003cbr\u003e **fun**: new |\n\n返回数据(XML):\n```\n\u003cerror\u003e\n\t\u003cret\u003e0\u003c/ret\u003e\n\t\u003cmessage\u003eOK\u003c/message\u003e\n\t\u003cskey\u003exxx\u003c/skey\u003e\n\t\u003cwxsid\u003exxx\u003c/wxsid\u003e\n\t\u003cwxuin\u003exxx\u003c/wxuin\u003e\n\t\u003cpass_ticket\u003exxx\u003c/pass_ticket\u003e\n\t\u003cisgrayscale\u003e1\u003c/isgrayscale\u003e\n\u003c/error\u003e\n```\n\u003cbr\u003e\n\n### 微信初始化\n\n| API | webwxinit |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?pass_ticket=xxx\u0026skey=xxx\u0026r=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\tUin: xxx, \u003cbr\u003e\t\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Sid: xxx, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\tSkey: xxx, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; DeviceID: xxx, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; } \u003cbr\u003e } |\n\n返回数据(JSON):\n```\n{\n\t\"BaseResponse\": {\n\t\t\"Ret\": 0,\n\t\t\"ErrMsg\": \"\"\n\t},\n\t\"Count\": 11,\n\t\"ContactList\": [...],\n\t\"SyncKey\": {\n\t\t\"Count\": 4,\n\t\t\"List\": [\n\t\t\t{\n\t\t\t\t\"Key\": 1,\n\t\t\t\t\"Val\": 635705559\n\t\t\t},\n\t\t\t...\n\t\t]\n\t},\n\t\"User\": {\n\t\t\"Uin\": xxx,\n\t\t\"UserName\": xxx,\n\t\t\"NickName\": xxx,\n\t\t\"HeadImgUrl\": xxx,\n\t\t\"RemarkName\": \"\",\n\t\t\"PYInitial\": \"\",\n\t\t\"PYQuanPin\": \"\",\n\t\t\"RemarkPYInitial\": \"\",\n\t\t\"RemarkPYQuanPin\": \"\",\n\t\t\"HideInputBarFlag\": 0,\n\t\t\"StarFriend\": 0,\n\t\t\"Sex\": 1,\n\t\t\"Signature\": \"Apt-get install B\",\n\t\t\"AppAccountFlag\": 0,\n\t\t\"VerifyFlag\": 0,\n\t\t\"ContactFlag\": 0,\n\t\t\"WebWxPluginSwitch\": 0,\n\t\t\"HeadImgFlag\": 1,\n\t\t\"SnsFlag\": 17\n\t},\n\t\"ChatSet\": xxx,\n\t\"SKey\": xxx,\n\t\"ClientVersion\": 369297683,\n\t\"SystemTime\": 1453124908,\n\t\"GrayScale\": 1,\n\t\"InviteStartCount\": 40,\n\t\"MPSubscribeMsgCount\": 2,\n\t\"MPSubscribeMsgList\": [...],\n\t\"ClickReportInterval\": 600000\n}\n```\n\u003cbr\u003e\n\n| API | webwxstatusnotify |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN\u0026pass_ticket=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Code: 3, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; FromUserName: `自己ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ToUserName: `自己ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ClientMsgId: `时间戳` \u003cbr\u003e } |\n\n返回数据(JSON):\n```\n{\n\t\"BaseResponse\": {\n\t\t\"Ret\": 0,\n\t\t\"ErrMsg\": \"\"\n\t},\n\t...\n}\n```\n\u003cbr\u003e\n\n### 获取联系人信息\n\n| API | webwxgetcontact |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin//webwxgetcontact?pass_ticket=xxx\u0026skey=xxx\u0026r=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n\n返回数据(JSON):\n```\n{\n\t\"BaseResponse\": {\n\t\t\"Ret\": 0,\n\t\t\"ErrMsg\": \"\"\n\t},\n\t\"MemberCount\": 334,\n\t\"MemberList\": [\n\t\t{\n\t\t\t\"Uin\": 0,\n\t\t\t\"UserName\": xxx,\n\t\t\t\"NickName\": \"Urinx\",\n\t\t\t\"HeadImgUrl\": xxx,\n\t\t\t\"ContactFlag\": 3,\n\t\t\t\"MemberCount\": 0,\n\t\t\t\"MemberList\": [],\n\t\t\t\"RemarkName\": \"\",\n\t\t\t\"HideInputBarFlag\": 0,\n\t\t\t\"Sex\": 0,\n\t\t\t\"Signature\": \"你好，我们是地球三体组织。在这里，你将感受到不一样的思维模式，以及颠覆常规的世界观。而我们的目标，就是以三体人的智慧，引领人类未来科学技术500年。\",\n\t\t\t\"VerifyFlag\": 8,\n\t\t\t\"OwnerUin\": 0,\n\t\t\t\"PYInitial\": \"URINX\",\n\t\t\t\"PYQuanPin\": \"Urinx\",\n\t\t\t\"RemarkPYInitial\": \"\",\n\t\t\t\"RemarkPYQuanPin\": \"\",\n\t\t\t\"StarFriend\": 0,\n\t\t\t\"AppAccountFlag\": 0,\n\t\t\t\"Statues\": 0,\n\t\t\t\"AttrStatus\": 0,\n\t\t\t\"Province\": \"\",\n\t\t\t\"City\": \"\",\n\t\t\t\"Alias\": \"Urinxs\",\n\t\t\t\"SnsFlag\": 0,\n\t\t\t\"UniFriend\": 0,\n\t\t\t\"DisplayName\": \"\",\n\t\t\t\"ChatRoomId\": 0,\n\t\t\t\"KeyWord\": \"gh_\",\n\t\t\t\"EncryChatRoomId\": \"\"\n\t\t},\n\t\t...\n\t],\n\t\"Seq\": 0\n}\n```\n\u003cbr\u003e\n\n| API | webwxbatchgetcontact |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxbatchgetcontact?type=ex\u0026r=xxx\u0026pass_ticket=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Count: `群数量`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; List: [ \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; { UserName: `群ID`, EncryChatRoomId: \"\" }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ... \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ], \u003cbr\u003e } |\n\n返回数据(JSON)同上\n\u003cbr\u003e\u003cbr\u003e\n\n### 同步刷新\n\n| API | synccheck |\n| --- | --------- |\n| protocol | https |\n| host | webpush.weixin.qq.com \u003cbr\u003e webpush.wx2.qq.com \u003cbr\u003e webpush.wx8.qq.com \u003cbr\u003e webpush.wx.qq.com \u003cbr\u003e webpush.web2.wechat.com \u003cbr\u003e webpush.web.wechat.com |\n| path | /cgi-bin/mmwebwx-bin/synccheck |\n| method | GET |\n| data | URL Encode |\n| params | **r**: `时间戳` \u003cbr\u003e **sid**: xxx \u003cbr\u003e **uin**: xxx \u003cbr\u003e **skey**: xxx \u003cbr\u003e **deviceid**: xxx \u003cbr\u003e **synckey**: xxx \u003cbr\u003e **_**: `时间戳` |\n\n返回数据(String):\n```\nwindow.synccheck={retcode:\"xxx\",selector:\"xxx\"}\n\nretcode:\n\t0 正常\n\t1100 失败/登出微信\nselector:\n\t0 正常\n\t2 新的消息\n\t7 进入/离开聊天界面\n```\n\u003cbr\u003e\n\n| API | webwxsync |\n| --- | --------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsync?sid=xxx\u0026skey=xxx\u0026pass_ticket=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; SyncKey: xxx, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; rr: `时间戳取反` \u003cbr\u003e } |\n\n返回数据(JSON):\n```\n{\n\t'BaseResponse': {'ErrMsg': '', 'Ret': 0},\n\t'SyncKey': {\n\t\t'Count': 7,\n\t\t'List': [\n\t\t\t{'Val': 636214192, 'Key': 1},\n\t\t\t...\n\t\t]\n\t},\n\t'ContinueFlag': 0,\n\t'AddMsgCount': 1,\n\t'AddMsgList': [\n\t\t{\n\t\t\t'FromUserName': '',\n\t\t\t'PlayLength': 0,\n\t\t\t'RecommendInfo': {...},\n\t\t\t'Content': \"\", \n\t\t\t'StatusNotifyUserName': '',\n\t\t\t'StatusNotifyCode': 5,\n\t\t\t'Status': 3,\n\t\t\t'VoiceLength': 0,\n\t\t\t'ToUserName': '',\n\t\t\t'ForwardFlag': 0,\n\t\t\t'AppMsgType': 0,\n\t\t\t'AppInfo': {'Type': 0, 'AppID': ''},\n\t\t\t'Url': '',\n\t\t\t'ImgStatus': 1,\n\t\t\t'MsgType': 51,\n\t\t\t'ImgHeight': 0,\n\t\t\t'MediaId': '', \n\t\t\t'FileName': '',\n\t\t\t'FileSize': '',\n\t\t\t...\n\t\t},\n\t\t...\n\t],\n\t'ModChatRoomMemberCount': 0,\n\t'ModContactList': [],\n\t'DelContactList': [],\n\t'ModChatRoomMemberList': [],\n\t'DelContactCount': 0,\n\t...\n}\n```\n\u003cbr\u003e\n\n### 消息接口\n\n| API | webwxsendmsg |\n| --- | ------------ |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?pass_ticket=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Msg: { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Type: 1 `文字消息`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Content: `要发送的消息`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; FromUserName: `自己ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ToUserName: `好友ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; LocalID: `与clientMsgId相同`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ClientMsgId: `时间戳左移4位随后补上4位随机数` \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; } \u003cbr\u003e } |\n\n返回数据(JSON):\n```\n{\n\t\"BaseResponse\": {\n\t\t\"Ret\": 0,\n\t\t\"ErrMsg\": \"\"\n\t},\n\t...\n}\n```\n\n| API | webwxrevokemsg |\n| --- | ------------ |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxrevokemsg |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; SvrMsgId: msg_id, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ToUserName: user_id, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ClientMsgId: local_msg_id \u003cbr\u003e  } |\n\n返回数据(JSON):\n```\n{\n\t\"BaseResponse\": {\n\t\t\"Ret\": 0,\n\t\t\"ErrMsg\": \"\"\n\t}\n}\n```\n\n#### 发送表情\n\n| API | webwxsendmsgemotion |\n| --- | ------------ |\n| url | https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsendemoticon?fun=sys\u0026f=json\u0026pass_ticket=xxx |\n| method | POST |\n| data | JSON |\n| header | ContentType: application/json; charset=UTF-8 |\n| params | { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; BaseRequest: { Uin: xxx, Sid: xxx, Skey: xxx, DeviceID: xxx }, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Msg: { \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Type: 47 `emoji消息`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; EmojiFlag: 2, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; MediaId: `表情上传后的媒体ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; FromUserName: `自己ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ToUserName: `好友ID`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; LocalID: `与clientMsgId相同`, \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ClientMsgId: `时间戳左移4位随后补上4位随机数` \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; } \u003cbr\u003e } |\n\n\u003cbr\u003e\n\n### 图片接口\n\n| API | webwxgeticon |\n| --- | ------------ |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgeticon |\n| method | GET |\n| params | **seq**: `数字，可为空` \u003cbr\u003e **username**: `ID` \u003cbr\u003e **skey**: xxx |\n\u003cbr\u003e\n\n| API | webwxgetheadimg |\n| --- | --------------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetheadimg |\n| method | GET |\n| params | **seq**: `数字，可为空` \u003cbr\u003e **username**: `群ID` \u003cbr\u003e **skey**: xxx |\n\u003cbr\u003e\n\n| API | webwxgetmsgimg |\n| --- | --------------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetmsgimg |\n| method | GET |\n| params | **MsgID**: `消息ID` \u003cbr\u003e **type**: slave `略缩图` or `为空时加载原图` \u003cbr\u003e **skey**: xxx |\n\u003cbr\u003e\n\n### 多媒体接口\n\n| API | webwxgetvideo |\n| --- | --------------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetvideo |\n| method | GET |\n| params | **msgid**: `消息ID` \u003cbr\u003e **skey**: xxx |\n\u003cbr\u003e\n\n| API | webwxgetvoice |\n| --- | --------------- |\n| url | https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetvoice |\n| method | GET |\n| params | **msgid**: `消息ID` \u003cbr\u003e **skey**: xxx |\n\u003cbr\u003e\n\n### 账号类型\n\n| 类型 | 说明 |\n| :--: | --- |\n| 个人账号 | 以`@`开头，例如：`@xxx` |\n| 群聊 | 以`@@`开头，例如：`@@xxx` |\n| 公众号/服务号 | 以`@`开头，但其`VerifyFlag` \u0026 8 != 0 \u003cbr\u003e\u003cbr\u003e `VerifyFlag`: \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 一般个人公众号/服务号：8 \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 一般企业的服务号：24 \u003cbr\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 微信官方账号`微信团队`：56 |\n| 特殊账号 | 像文件传输助手之类的账号，有特殊的ID，目前已知的有：\u003cbr\u003e `filehelper`, `newsapp`, `fmessage`, `weibo`, `qqmail`, `tmessage`, `qmessage`, `qqsync`, `floatbottle`, `lbsapp`, `shakeapp`, `medianote`, `qqfriend`, `readerapp`, `blogapp`, `facebookapp`, `masssendapp`, `meishiapp`, `feedsapp`, `voip`, `blogappweixin`, `weixin`, `brandsessionholder`, `weixinreminder`, `officialaccounts`, `notification_messages`, `wxitil`, `userexperience_alarm`, `notification_messages` |\n\u003cbr\u003e\n\n### 消息类型\n\n消息一般格式：\n```\n{\n\t\"FromUserName\": \"\",\n\t\"ToUserName\": \"\",\n\t\"Content\": \"\",\n\t\"StatusNotifyUserName\": \"\",\n\t\"ImgWidth\": 0,\n\t\"PlayLength\": 0,\n\t\"RecommendInfo\": {...},\n\t\"StatusNotifyCode\": 4,\n\t\"NewMsgId\": \"\",\n\t\"Status\": 3,\n\t\"VoiceLength\": 0,\n\t\"ForwardFlag\": 0,\n\t\"AppMsgType\": 0,\n\t\"Ticket\": \"\",\n\t\"AppInfo\": {...},\n\t\"Url\": \"\",\n\t\"ImgStatus\": 1,\n\t\"MsgType\": 1,\n\t\"ImgHeight\": 0,\n\t\"MediaId\": \"\",\n\t\"MsgId\": \"\",\n\t\"FileName\": \"\",\n\t\"HasProductId\": 0,\n\t\"FileSize\": \"\",\n\t\"CreateTime\": 1454602196,\n\t\"SubMsgType\": 0\n}\n```\n\u003cbr\u003e\n\n| MsgType | 说明 |\n| ------- | --- |\n| 1  | 文本消息 |\n| 3  | 图片消息 |\n| 34 | 语音消息 |\n| 37 | 好友确认消息 |\n| 40 | POSSIBLEFRIEND_MSG |\n| 42 | 共享名片 |\n| 43 | 视频消息 |\n| 47 | 动画表情 |\n| 48 | 位置消息 |\n| 49 | 分享链接 |\n| 50 | VOIPMSG |\n| 51 | 微信初始化消息 |\n| 52 | VOIPNOTIFY |\n| 53 | VOIPINVITE |\n| 62 | 小视频 |\n| 9999 | SYSNOTICE |\n| 10000 | 系统消息 |\n| 10002 | 撤回消息 |\n\u003cbr\u003e\n\n**微信初始化消息**\n```html\nMsgType: 51\nFromUserName: 自己ID\nToUserName: 自己ID\nStatusNotifyUserName: 最近联系的联系人ID\nContent:\n\t\u003cmsg\u003e\n\t    \u003cop id='4'\u003e\n\t        \u003cusername\u003e\n\t        \t// 最近联系的联系人\n\t            filehelper,xxx@chatroom,wxid_xxx,xxx,...\n\t        \u003c/username\u003e\n\t        \u003cunreadchatlist\u003e\n\t            \u003cchat\u003e\n\t                \u003cusername\u003e\n\t                \t// 朋友圈\n\t                    MomentsUnreadMsgStatus\n\t                \u003c/username\u003e\n\t                \u003clastreadtime\u003e\n\t                    1454502365\n\t                \u003c/lastreadtime\u003e\n\t            \u003c/chat\u003e\n\t        \u003c/unreadchatlist\u003e\n\t        \u003cunreadfunctionlist\u003e\n\t        \t// 未读的功能账号消息，群发助手，漂流瓶等\n\t        \u003c/unreadfunctionlist\u003e\n\t    \u003c/op\u003e\n\t\u003c/msg\u003e\n```\n\n**文本消息**\n```\nMsgType: 1\nFromUserName: 发送方ID\nToUserName: 接收方ID\nContent: 消息内容\n```\n\n**图片消息**\n```html\nMsgType: 3\nFromUserName: 发送方ID\nToUserName: 接收方ID\nMsgId: 用于获取图片\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cimg length=\"6503\" hdlength=\"0\" /\u003e\n\t\t\u003ccommenturl\u003e\u003c/commenturl\u003e\n\t\u003c/msg\u003e\n```\n\n**小视频消息**\n```html\nMsgType: 62\nFromUserName: 发送方ID\nToUserName: 接收方ID\nMsgId: 用于获取小视频\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cimg length=\"6503\" hdlength=\"0\" /\u003e\n\t\t\u003ccommenturl\u003e\u003c/commenturl\u003e\n\t\u003c/msg\u003e\n```\n\n**地理位置消息**\n```\nMsgType: 1\nFromUserName: 发送方ID\nToUserName: 接收方ID\nContent: http://weixin.qq.com/cgi-bin/redirectforward?args=xxx\n// 属于文本消息，只不过内容是一个跳转到地图的链接\n```\n\n**名片消息**\n```js\nMsgType: 42\nFromUserName: 发送方ID\nToUserName: 接收方ID\nContent:\n\t\u003c?xml version=\"1.0\"?\u003e\n\t\u003cmsg bigheadimgurl=\"\" smallheadimgurl=\"\" username=\"\" nickname=\"\"  shortpy=\"\" alias=\"\" imagestatus=\"3\" scene=\"17\" province=\"\" city=\"\" sign=\"\" sex=\"1\" certflag=\"0\" certinfo=\"\" brandIconUrl=\"\" brandHomeUrl=\"\" brandSubscriptConfigUrl=\"\" brandFlags=\"0\" regionCode=\"\" /\u003e\n\nRecommendInfo:\n\t{\n\t\t\"UserName\": \"xxx\", // ID\n\t\t\"Province\": \"xxx\", \n\t\t\"City\": \"xxx\", \n\t\t\"Scene\": 17, \n\t\t\"QQNum\": 0, \n\t\t\"Content\": \"\", \n\t\t\"Alias\": \"xxx\", // 微信号\n\t\t\"OpCode\": 0, \n\t\t\"Signature\": \"\", \n\t\t\"Ticket\": \"\", \n\t\t\"Sex\": 0, // 1:男, 2:女\n\t\t\"NickName\": \"xxx\", // 昵称\n\t\t\"AttrStatus\": 4293221, \n\t\t\"VerifyFlag\": 0\n\t}\n```\n\n**语音消息**\n```html\nMsgType: 34\nFromUserName: 发送方ID\nToUserName: 接收方ID\nMsgId: 用于获取语音\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cvoicemsg endflag=\"1\" cancelflag=\"0\" forwardflag=\"0\" voiceformat=\"4\" voicelength=\"1580\" length=\"2026\" bufid=\"216825389722501519\" clientmsgid=\"49efec63a9774a65a932a4e5fcd4e923filehelper174_1454602489\" fromusername=\"\" /\u003e\n\t\u003c/msg\u003e\n```\n\n**动画表情**\n```html\nMsgType: 47\nFromUserName: 发送方ID\nToUserName: 接收方ID\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cemoji fromusername = \"\" tousername = \"\" type=\"2\" idbuffer=\"media:0_0\" md5=\"e68363487d8f0519c4e1047de403b2e7\" len = \"86235\" productid=\"com.tencent.xin.emoticon.bilibili\" androidmd5=\"e68363487d8f0519c4e1047de403b2e7\" androidlen=\"86235\" s60v3md5 = \"e68363487d8f0519c4e1047de403b2e7\" s60v3len=\"86235\" s60v5md5 = \"e68363487d8f0519c4e1047de403b2e7\" s60v5len=\"86235\" cdnurl = \"http://emoji.qpic.cn/wx_emoji/eFygWtxcoMF8M0oCCsksMA0gplXAFQNpiaqsmOicbXl1OC4Tyx18SGsQ/\" designerid = \"\" thumburl = \"http://mmbiz.qpic.cn/mmemoticon/dx4Y70y9XctRJf6tKsy7FwWosxd4DAtItSfhKS0Czr56A70p8U5O8g/0\" encrypturl = \"http://emoji.qpic.cn/wx_emoji/UyYVK8GMlq5VnJ56a4GkKHAiaC266Y0me0KtW6JN2FAZcXiaFKccRevA/\" aeskey= \"a911cc2ec96ddb781b5ca85d24143642\" \u003e\u003c/emoji\u003e \n\t\t\u003cgameext type=\"0\" content=\"0\" \u003e\u003c/gameext\u003e\n\t\u003c/msg\u003e\n```\n\n**普通链接或应用分享消息**\n```html\nMsgType: 49\nAppMsgType: 5\nFromUserName: 发送方ID\nToUserName: 接收方ID\nUrl: 链接地址\nFileName: 链接标题\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cappmsg appid=\"\"  sdkver=\"0\"\u003e\n\t\t\t\u003ctitle\u003e\u003c/title\u003e\n\t\t\t\u003cdes\u003e\u003c/des\u003e\n\t\t\t\u003ctype\u003e5\u003c/type\u003e\n\t\t\t\u003ccontent\u003e\u003c/content\u003e\n\t\t\t\u003curl\u003e\u003c/url\u003e\n\t\t\t\u003cthumburl\u003e\u003c/thumburl\u003e\n\t\t\t...\n\t\t\u003c/appmsg\u003e\n\t\t\u003cappinfo\u003e\n\t\t\t\u003cversion\u003e\u003c/version\u003e\n\t\t\t\u003cappname\u003e\u003c/appname\u003e\n\t\t\u003c/appinfo\u003e\n\t\u003c/msg\u003e\n```\n\n**音乐链接消息**\n```html\nMsgType: 49\nAppMsgType: 3\nFromUserName: 发送方ID\nToUserName: 接收方ID\nUrl: 链接地址\nFileName: 音乐名\n\nAppInfo: // 分享链接的应用\n\t{\n\t\tType: 0, \n\t\tAppID: wx485a97c844086dc9\n\t}\n\nContent:\n\t\u003cmsg\u003e\n\t\t\u003cappmsg appid=\"wx485a97c844086dc9\"  sdkver=\"0\"\u003e\n\t\t\t\u003ctitle\u003e\u003c/title\u003e\n\t\t\t\u003cdes\u003e\u003c/des\u003e\n\t\t\t\u003caction\u003e\u003c/action\u003e\n\t\t\t\u003ctype\u003e3\u003c/type\u003e\n\t\t\t\u003cshowtype\u003e0\u003c/showtype\u003e\n\t\t\t\u003cmediatagname\u003e\u003c/mediatagname\u003e\n\t\t\t\u003cmessageext\u003e\u003c/messageext\u003e\n\t\t\t\u003cmessageaction\u003e\u003c/messageaction\u003e\n\t\t\t\u003ccontent\u003e\u003c/content\u003e\n\t\t\t\u003ccontentattr\u003e0\u003c/contentattr\u003e\n\t\t\t\u003curl\u003e\u003c/url\u003e\n\t\t\t\u003clowurl\u003e\u003c/lowurl\u003e\n\t\t\t\u003cdataurl\u003e\n\t\t\t\thttp://ws.stream.qqmusic.qq.com/C100003i9hMt1bgui0.m4a?vkey=6867EF99F3684\u0026amp;guid=ffffffffc104ea2964a111cf3ff3edaf\u0026amp;fromtag=46\n\t\t\t\u003c/dataurl\u003e\n\t\t\t\u003clowdataurl\u003e\n\t\t\t\thttp://ws.stream.qqmusic.qq.com/C100003i9hMt1bgui0.m4a?vkey=6867EF99F3684\u0026amp;guid=ffffffffc104ea2964a111cf3ff3edaf\u0026amp;fromtag=46\n\t\t\t\u003c/lowdataurl\u003e\n\t\t\t\u003cappattach\u003e\n\t\t\t\t\u003ctotallen\u003e0\u003c/totallen\u003e\n\t\t\t\t\u003cattachid\u003e\u003c/attachid\u003e\n\t\t\t\t\u003cemoticonmd5\u003e\u003c/emoticonmd5\u003e\n\t\t\t\t\u003cfileext\u003e\u003c/fileext\u003e\n\t\t\t\u003c/appattach\u003e\n\t\t\t\u003cextinfo\u003e\u003c/extinfo\u003e\n\t\t\t\u003csourceusername\u003e\u003c/sourceusername\u003e\n\t\t\t\u003csourcedisplayname\u003e\u003c/sourcedisplayname\u003e\n\t\t\t\u003ccommenturl\u003e\u003c/commenturl\u003e\n\t\t\t\u003cthumburl\u003e\n\t\t\t\thttp://imgcache.qq.com/music/photo/album/63/180_albumpic_143163_0.jpg\n\t\t\t\u003c/thumburl\u003e\n\t\t\t\u003cmd5\u003e\u003c/md5\u003e\n\t\t\u003c/appmsg\u003e\n\t\t\u003cfromusername\u003e\u003c/fromusername\u003e\n\t\t\u003cscene\u003e0\u003c/scene\u003e\n\t\t\u003cappinfo\u003e\n\t\t\t\u003cversion\u003e29\u003c/version\u003e\n\t\t\t\u003cappname\u003e摇一摇搜歌\u003c/appname\u003e\n\t\t\u003c/appinfo\u003e\n\t\t\u003ccommenturl\u003e\u003c/commenturl\u003e\n\t\u003c/msg\u003e\n```\n\n**群消息**\n```\nMsgType: 1\nFromUserName: @@xxx\nToUserName: @xxx\nContent:\n\t@xxx:\u003cbr/\u003exxx\n```\n\n**红包消息**\n```\nMsgType: 49\nAppMsgType: 2001\nFromUserName: 发送方ID\nToUserName: 接收方ID\nContent: 未知\n```\n注：根据网页版的代码可以看到未来可能支持查看红包消息，但目前走的是系统消息，见下。\n\n**系统消息**\n```\nMsgType: 10000\nFromUserName: 发送方ID\nToUserName: 自己ID\nContent:\n\t\"你已添加了 xxx ，现在可以开始聊天了。\"\n\t\"如果陌生人主动添加你为朋友，请谨慎核实对方身份。\"\n\t\"收到红包，请在手机上查看\"\n```\n\n\n## \u003ca name=\"Discussion-Group\"\u003eDiscussion Group\u003c/a\u003e\n如果你希望和 WeixinBot 的其他开发者交流，或者有什么问题和建议，欢迎大家加入微信群【Youth fed the dog】一起讨论。扫描下面的二维码添加机器人为好友，并回复【Aidog】获取入群链接。\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"imgs/groupQrcode.jpg\" width=\"220\" height=\"220\" alt=\"join us\"/\u003e\n\u003c/div\u003e\n\n注：这个不是群的二维码，是机器人拉你入群，记得回复机器人【Aidog】哦~ （secret code: Aidog）\n\n## \u003ca name=\"Recent-Update\"\u003eRecent Update\u003c/a\u003e\n\n- association_login\n\t目前网页版微信已经可以脱离扫码，但是依然需要在客户端进行确认登录。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furinx%2Fweixinbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furinx%2Fweixinbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furinx%2Fweixinbot/lists"}