Categories
Uncategorized

C ++ micro-channel web and application protocol

Micro-channel achieved push alarm message

table of Contents

1 Introduction 2 …

1.1 Background … 2

Comparison prior art 2 1.2 …

The overall process … 2 2

3 micro-channel web-based analytical … 3

3.1 users get uuid. 3

3.2 acquiring two-dimensional code picture … 4

Whether the user is logged polling detection 3.3 … 4

3.4 Login redirect url and get the micro-channel public participation … 5

3.5 … 5 micro-channel initialization

3.6 11 get contact list …

3.7 Batch obtain contact details … 13

Detecting whether or not a micro-channel message 3.8 … 16

3.9 Get the latest news … 17

3.10 pushed through the micro-channel alarm messages … 22

3.11 upload files to the server … 24 micro letter

Send pictures … 27 3.12

4 Some code status code value Description … 28

4.1 BaseResponse in the Ret 28

4.2 Synchronization message and check the return value selector 28 retcode

4.3 Returns the message type … 29

5 … 30 implement the steps

Technological constraints 6 … 32

7 32 technology promotion …

 

 

 

1 Introduction

1.1 Background

Micro letter has been widely applied by everyone, and convenient mobile micro-letter, you can receive messages anytime, anywhere. Currently there is a demand push projects through the micro channel alarm message. But there is no micro-channel external interface, push alarm can not be achieved. Convenient micro-letter shortcuts no way to use. Log may be implemented through a web interface to the micro-channel micro message, friend information acquisition, transmission micro-channel message to obtain micro-channel messages and the like;

1.2 Comparison prior art

Existing technology mainly through the client computer, or mobile client to receive alarm, the client computer can only be viewed on a computer, not convenient. The mobile client need to develop a corresponding mobile phone system app, go through a complicated transfer protocol. Long development cycle, implementation complexity. And requires installation of special app can receive alarm. Receive and transmit alarm is not convenient. Web through the micro channel port to push the alarm, the alarm can be realized easily pushed, the alarm can be sent to the micro-channel users, micro-channel group number of the micro-channel public.

2 overall process

Micro-letter web interface call flow shown in Figure 2-1,

(1) the user must first obtain the UUID, with a user identifier;

(2) Then, as the UUID parameter acquiring the two-dimensional code scanning user login, and then waits for the user to scan the two-dimensional code;

After (3) the user to scan two-dimensional code becomes the user’s head; round robin to see if the user clicks the login button;

After (4) user logs on, it returns a redirect URL, as the user’s login URL;

With the URL to the server to log micro letter, return key value of the user, user id, user identification id, cookie

(5) calls the initialization interface, initialization micro-channel main interface, home user information, the user’s own user login information, detect whether someone a message over the key group. Each key for a different message;

(6) Get all your friends, micro-channel group number of public information;

(7) queries the server has micro-channel message to the logged in user, including micro-channel communications messages, friends remark modify messages. Parses the message protocol, shown in the window;

(8) designates the user sends a micro-channel message; alarm messages may be transmitted via the transmission interface micro channel;

                       

Figure 2-1 micro-channel process interface call

3 micro-channel interface for parsing the page

3.1 users get uuid

    Description: displaying a two-dimensional code, and for obtaining the desired uuid log, identifying and acquiring two-dimensional code scan code for the same user

    Request method: GET

    Address: https: //login.wx.qq.com/jslogin appid = wx782c26e4c19acffb & fun = new & lang = zh_CN?

    get parameters:

  •  

parameter

Sample values

Explanation

appid

wx782c26e4c19acffb

Fixed value

fun

new

Fixed value

lang

zh_CN

It represents the Chinese character set

    return:

window.QRLogin.code = 200; window.QRLogin.uuid = “wb7R2kx9dA==”;

 

3.2 acquiring two-dimensional code picture

    Note: Picture shows a two-dimensional code for landing, uuid address in the {uuid} pass the first step acquired

    Request method: GET

    Address: https: //login.wx.qq.com/qrcode/ {uuid}

    get parameters:

  •  

parameter

Sample values

Explanation

t

webwx

Fixed value

    Returns: the two-dimensional code binary stream, the browser will open directly display a two-dimensional code picture, the client needs to be saved to a local file, then use the label to load display;

 

Are 3.3 Polling Test User Login

    Explanation: An attempt to log in. At this point, if the user has completed the sweep phone code and click login, a real url address used to log in is returned. Otherwise, the interface is probably not return after 10s scan code or unregistered status code

    Request method: GET

    Address: https: //login.wx.qq.com/cgi-bin/mmwebwx-bin/login

    get parameters:

  •  

parameter

Sample values

Explanation

tip

1

1: 0 Not Scan: a scan

uuid

wb7R2kx9dA==

The first step in the acquired uuid

    Returns: redirect_uri value may be used directly in the next step “well log parameters and get” request

window.code = 200 (408 not to scan code, but the code 201 as scan click log 200 is successful login); window.redirect_uri = “https://wx.qq.com/cgi-bin/mmwebwx-bin / webwxnewloginpage ticket = AfrMMbhsnElmA7xc1R9CWUq- @ qrticket_0 & uuid = 4ZnG7WZ0Cg == & lang = zh_CN & scan = 1520738372 “?;

3.4 Login redirect url and get the micro-channel public participation

    Description: After the access is possible to obtain a set of public parameters, for subsequent access to all interfaces. This also means that if this part of the data breach, on behalf of other people can freely operate your micro-letter (the operation is limited to support web version) at this time

    Request method: GET

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage

    get parameters: direct spend all parameters can be returned in step redirect_uri

    Returns: acquiring and storing the skey parameter returns four values, wxsid, wxuin, pass_ticket, return cookie is saved to a local file, you need to take this cookie file below interface calls.

Return result:


  0
  
  @crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4
  +urBrYI292xoIknf
  211722515
  qg%2BL%2BfjNnoHyqYsL3xj0KoNi5nqchsInPWWSxDwqCJ8%3D  1

3.5 micro-channel initialization

    Note: Contacts initialization micro-channel home bar, the public number, etc. (not in the address book of contacts), initialize the registrant’s own information (including nickname, etc.), the initial synchronization messages used SycnKey

    Request mode: POST

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

qg%2BL%2BfjNnoHyqYsL3xj0KoNi5nqchsInPWWSxDwqCJ8%3D

Value of public participation

    post parameters: (JSON format)

{

    BaseRequest: {

        Uin: 211722515,

        Sid: +urBrYI292xoIknf,

        Skey: @crypt_8b4f09cc_a5871dc10130a48703b9afd5602152e4,

DeviceID: e545297464380306 DeviceID upper side can use the following code generation, consistent during each login. String DeviceID = “e” + String.valueOf (new Random () nextLong ().) Substring (1, 16).;

    }

}

 

    Returns: skey acquire and store values ​​of four parameters, wxsid, wxuin, pass_ticket, Cookie and returned in the return webwx_data_ticket, webwx_auth_ticket

 

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

    },

    “Count”: 11,

“ContactList”: [{micro-channel home contact is not stored in the address book contacts

        “Uin”: 0,

        “UserName”: “filehelper”,

“NickName”: “File Transfer Assistant”

        “HeadImgUrl”: “/cgi-bin/mmwebwx-bin/webwxgeticon?seq=680769514&username=filehelper&[email protected]_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

    },

…… here omission remaining 10 contact information

    ],

“SyncKey”: {syncKey with the synchronization message, for later polling message interface

        “Count”: 4,

        “List”: [{

            “Key”: 1,

            “Val”: 700722177

        }, {

            “Key”: 2,

            “Val”: 700723184

        }, {

            “Key”: 3,

            “Val”: 700723136

        }, {

            “Key”: 1000,

            “Val”: 1520723642

        }]

    },

{Registrant information: “User”

        “Uin”: 211722515,

“UserName”: “@ f4c054c78f40743b095b85409dbdc1b3”, micro-channel random code, and each contact group has, per log randomly assigned by a micro channel end

“NickName”: “nickname micro test signal”

        “HeadImgUrl”: “/cgi-bin/mmwebwx-bin/webwxgeticon?seq=1730335888&[email protected]&[email protected]_8b4f09cc_a5871dc10130a48703b9afd5602152e4”,

        “RemarkName”: “”,

        “PYInitial”: “”,

        “PYQuanPin”: “”,

        “RemarkPYInitial”: “”,

        “RemarkPYQuanPin”: “”,

        “HideInputBarFlag”: 0,

        “StarFriend”: 0,

        “Sex”: 1,

“Signature”: “This is the 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”: “no hands will be able to visit Taobao, this is what” Black Technology “small British Columbia, he said:?! Chinese is so easy to slip right | decode new era”

“Digest”: “mouth to speak will be able to visit Taobao, addiction” black technology “small British Columbia that do not want to go home!”

            “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”: “China Daily World News”

    }],

    “ClickReportInterval”: 600000

}

3.6 get the contact list

    Description: Get all the contacts in the phone contacts (including the person, group, public number, etc.)

    Request mode: POST

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

yp5RfCpb%2FsNVex0Uepn1BWXNCYCqTfqe8NOYzan%2B4Y4%3D

Value of public participation

skey

@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050

Value of public participation

    post parameters:

 

{

“BaseRequest”: {public parameter values ​​are in

        “Uin”: 211722515,

        “Sid”: “+FhlgkGS3wD/GKQw”,

        “Skey”: “@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050”,

        “DeviceID”: “e609547902722302”

    }

}

    Returns: contact information for all your contacts, mainly in view MemberList

 

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

    },

    “MemberCount”: 771,

    “MemberList”: [{

            “Uin”: 0,

“UserName”: “@ 9c30c8d81e75a7eff0603cdd5de860b18fe92995845473fc2f0cda6ed76053cb”, (micro-channel random code, hidden rules: front contact is @, @@ for the group)

“NickName”: “Nandi Wardhana”, (micro-channel contact’s nickname)

            “HeadImgUrl”: “/cgi-bin/mmwebwx-bin/webwxgeticon?seq=620986971&[email protected]6ed76053cb&[email protected]_8b4f09cc_1b827f84b1535b6be801f00427499050”,

            “ContactFlag”: 3,

“MemberCount”: 0, (if the group is, this field indicates the number of members)

“MemberList”: [], (group member list)

“RemarkName”: “”, (Note name, if empty, it is not given him Remarks)

            “HideInputBarFlag”: 0,

“Sex”: 1, (sex, 1 male, 2 female)

“Signature”: “Stay young naturally …”, (Signed)

“VerifyFlag”: 0, (used to determine whether a public service number or number field)

            “OwnerUin”: 0,

            “PYInitial”: “NANDIWARDHANA”,

“PYQuanPin”: “NandiWardhana”, (phonetic spelling of the name)

            “RemarkPYInitial”: “”,

            “RemarkPYQuanPin”: “”,

            “StarFriend”: 0,

            “AppAccountFlag”: 0,

            “Statues”: 0,

            “AttrStatus”: 2359303,

“Province”: “Jakarta Raya”, (province)

“City”: “”, (city)

            “Alias”: “”,

            “SnsFlag”: 17,

            “UniFriend”: 0,

“DisplayName”: “”, (if it is members of the group, within the field indicates the name of the group)

            “ChatRoomId”: 0,

            “KeyWord”: “”,

“EncryChatRoomId”: “”, (if the group is the group id field indicates, unlike the micro-channel random code @@)

            “IsOwner”: 0

        },

… omitted the remaining 770 contacts

    ]

}

3.7 Batch get contact details

    Description: Bulk get contact details of the person or group can be. The main group is to get get the details within the group contact list. The main details of the person to obtain detailed information about a person in the group to obtain.

    Request mode: POST

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxbatchgetcontact

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

yp5RfCpb%2FsNVex0Uepn1BWXNCYCqTfqe8NOYzan%2B4Y4%3D

Value of public participation

type

ex

I do not know what is the meaning of this

    post parameters:

{

    “BaseRequest”: {

        “Uin”: 211722515,

        “Sid”: “+FhlgkGS3wD/GKQw”,

        “Skey”: “@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050”,

        “DeviceID”: “e862192966399662”

    },

    “Count”: 2,

“List”: [{represented here for details of all the contacts needed

            “UserName”: “@@e203c90e07d64242336d573acd4a1db1c01ccb92ca05410444a3003c282c21db”,

            “EncryChatRoomId”: “”

        },

        {

            “UserName”: “@ba194a63575be7fd0f4ea4e4547b2942d0dccc7fffc00ef5a6d141f93adb7739”,

            “EncryChatRoomId”: “”

        }

    ]

}

 

    return:

 

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

    },

    “Count”: 2,

    “ContactList”: [{

            “Uin”: 0,

            “UserName”: “@ba194a63575be7fd0f4ea4e4547b2942d0dccc7fffc00ef5a6d141f93adb7739”,

“NickName”: “Chi Master ‘

            “HeadImgUrl”: “/cgi-bin/mmwebwx-bin/webwxgeticon?seq=680786093&[email protected]f93adb7739&skey=”,

            “ContactFlag”: 3,

            “MemberCount”: 0,

            “MemberList”: [],

“RemarkName”: “Feng brother”

            “HideInputBarFlag”: 0,

            “Sex”: 2,

“Signature”: “ will find “,

            “VerifyFlag”: 0,

            “OwnerUin”: 0,

            “PYInitial”: “ZSF”,

            “PYQuanPin”: “zhangsanfeng”,

            “RemarkPYInitial”: “FG”,

            “RemarkPYQuanPin”: “fengge”,

            “StarFriend”: 0,

            “AppAccountFlag”: 0,

            “Statues”: 0,

            “AttrStatus”: 111719,

“Province”: “Beijing”

“City”: “Pinggu”

            “Alias”: “”,

            “SnsFlag”: 17,

            “UniFriend”: 0,

            “DisplayName”: “”,

            “ChatRoomId”: 0,

            “KeyWord”: “”,

            “EncryChatRoomId”: “0”,

            “IsOwner”: 0

        }

… here omit the second contact information

    ]

}

Detecting whether there is a micro channel message 3.8

    Description: Check the synchronization message. Here check not only sync, check out if there are new messages, and then out specific synchronous interface.

    Request method: GET, need to pass to get the cookie, or else fail

    Address: https: //webpush2.weixin.qq.com/cgi-bin/mmwebwx-bin/synccheck

    get parameters:

  •  

parameter

Sample values

Explanation

deviceid

e547171618594402

Reference 5 GENERATION

sid

+FhlgkGS3wD/GKQw

Value of public participation

skey

@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050

Value of public participation

synckey

1_700722177|2_700724323|3_700724315|1000_1520925834

After the micro-channel initialization acquired key 4, the key will return with each value to obtain the latest information (refer to 9) after the update, it is an object each time a record of the current state of synchronization after a synchronization message.

uin

211722515

Value of public participation

    return:

 

window.synccheck={retcode:”0″,selector:”2″}

retcodeSUCCESS ( “0”, “success”), TICKET_ERROR ( “- 14”, “ticket error”), PARAM_ERROR ( “1”, “incoming parameter error”), NOT_LOGIN_WARN ( “1100”, “not logged prompt”) , NOT_LOGIN_CHECK ( “1101”, “not detected login”), COOKIE_INVALID_ERROR ( “1102”, “cookie value is invalid”), LOGIN_ENV_ERROR ( “1203”, “current exception login environment, for safety’s sake please do not log in the web end “), TOO_OFEN (” 1205 “,” operation frequency “);

selectorNORMAL ( “0”, “normal”), NEW_MSG ( “2”, “new messages”), MOD_CONTACT ( “4”, “someone changes their nickname or you modify someone else’s notes”), ADD_OR_DEL_CONTACT ( ” 6 “,” presence or delete new friends information “), ENTER_OR_LEAVE_CHAT (” 7 “,” enters or leaves the chat interface “);

 

3.9 Get the latest news

    Description: When the synchronization check interface displays a new message, invoking the interface for specific news. News here is broad, including messages, modify group name, change of members of the group, add friends and so on.

    Request mode: POST, need to pass to get the cookie, or else fail

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxsync

    get parameters:

  •  

parameter

Sample values

Explanation

sid

+FhlgkGS3wD/GKQw

Value of public participation

skey

@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050

Value of public participation

uin

211722515

Value of public participation

    post parameters:

 

{

    “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)

}

 

    Returns: There are key SyncCheckKey AddMsgList, ModContactList, DelContactList, a new round of message synchronization detection messages, a new round of acquisition news synckey

 

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

    },

“AddMsgCount”: 1, the new information

    “AddMsgList”: [{

“MsgId”: “320984672637990367”, the server returns the message id, it may be used to withdraw the interface parameters. If this is the picture, this parameter can also be invoked as a micro-channel to obtain one picture parameter interface.

“FromUserName”: “@ abf90232027117affa7f0c0df3d1bf20”, a message people

“ToUserName”: “@ abf90232027117affa7f0c0df3d1bf20”, to whom

“MsgType”: 51, message type, one of text, pictures … 3, refer to the specific message type table

        “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, modify contacts

    “ModContactList”: [],

“DelContactCount”: 0, delete contacts

    “DelContactList”: [],

“ModChatRoomMemberCount”: 0, members of the group changes

    “ModChatRoomMemberList”: [],”ContinueFlag”: 0,

“SyncKey”: {updated with a new round of news these 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”: {a new message by detecting the 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

        }]

    }

 

}

 

3.10 alarm message through the micro-channel push

    Description: send text messages (including facial expressions), you can not send pictures or documents.

    Request mode: POST, need to pass to get the cookie, or else fail

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

yp5RfCpb%2FsNVex0Uepn1BWXNCYCqTfqe8NOYzan%2B4Y4%3D

Value of public participation

    post parameters:

{

    “BaseRequest”: {

        “Uin”: 211722515,

        “Sid”: “+FhlgkGS3wD/GKQw”,

        “Skey”: “@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050”,

        “DeviceID”: “e107694022625701”

    },

    “Msg”: {

        “Type”: 1,

“Content”: “Oh”

        “FromUserName”: “@abf90232027117affa7f0c0df3d1bf20”,

        “ToUserName”: “filehelper”,

“LocalID”: “15209344559450477”, the time stamp is then left 4-bit random number S.4

“ClientMsgId”: “15209344559450477” “MediaId”: “” If this value is passed before the picture

    },

    “Scene”: 0

}

 

    return:

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

    },

“MsgID”: “7615282929538795099”, the server returns the message id, and other parameters may be used to withdraw interface

“LocalID”: “15209344559450477” local news id, a parameter when you send a request

}

3.11 upload files to the server micro letter

    Description: send pictures when you need to call this interface to upload images to the server micro-channel, micro-channel will return a picture id, carry the id when sending messages to send pictures.

    Request mode: POST (Content-Type herein should be set to multipart / form-data; boundary = … —————— 41184676334)

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

yp5RfCpb%2FsNVex0Uepn1BWXNCYCqTfqe8NOYzan%2B4Y4%3D

Value of public participation

    post parameters:

 

—————————–41184676334

Content-Disposition: form-data; name = “id” herein random

 

WU_FILE_0

—————————–41184676334

Content-Disposition: form-data; name = “name” Picture Name

 

Desert.jpg

—————————–41184676334

Content-Disposition: form-data; name = “type” image type

 

image/jpeg

—————————–41184676334

Content-Disposition: form-data; name = “lastModifiedDate” transmission time, the parameter None

 

Tue Jul 14 2009 13:32:31 GMT+0800

—————————–41184676334

Content-Disposition: form-data; name = “size” image size

 

845941

—————————–41184676334

Content-Disposition: form-data; name = “chunks” total number of sub-batch upload

 

2

—————————–41184676334

Content-Disposition: form-data; name = “chunk” is currently the first few batches

 

0

—————————–41184676334

Content-Disposition: form-data; name = “mediatype” When transfer pictures, here to write pic

 

pic

—————————–41184676334

Content-Disposition: form-data; name=”uploadmediarequest”

{ “UploadType”: 2, is fixed at 2 “BaseRequest”: { “Uin”: 211722515, “Sid”: “+ FhlgkGS3wD / GKQw”, “Skey”: “@ crypt_8b4f09cc_1b827f84b1535b6be801f00427499050”, “DeviceID”: “e787605163473377”}, “ClientMediaId”: 1520935168955, “TotalLen”: 845941, file size “StartPos”: 0, “DataLen”: 845941, file size “MediaType”: 4, fixed to 4, represents the picture “fromUserName”: “@ abf90232027117affa7f0c0df3d1bf20”, the fill parameters can not fill “ToUserName”: “filehelper”, which can be filled from time to fill parameter “FileMd5”: “ba45c8f60456a672e003a875e469d0eb” the random parameter can be a 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 files for the stream here, front-end written in is to this effect

 

    Returns: may upload batches, returned the following results last successful upload

 

{

    “BaseResponse”: {

        “Ret”: 0,

        “ErrMsg”: “”

}, MediaId following parameters transmitted as the next reference image into the interface, the picture that can be transmitted

    “MediaId”: “@crypt_14402eb3_bb9eee20e7239fcd3323a0ea5a36cfd5e7fd162b72e03088efa4f63f53219c6f672c6be3ec1865291a70f38bb82bc5bf1d42166996b4a0313abe95454bff0316c19bfd29b71f4f98ccb7d301eed7b74995e35eabfd3f8264a3d684b8e9f08485ad00c3955cdc5b60ac96e67a9ca24bf7a01b9363ae0364f75fa0c9e6235e2dc91aef95b34c71c503deada9898a28ce5bf13d908f7834f7cae427aaba68aff5500125314f73b79f5a63103d430aa162420262e3d1a5e5f110cba0f2ee20017aaf0f127303153dcf63f9e5a56ff8c64f5dfb3f229011374b34fe7a905b0ee055d85b76827e2e68b8947c7b5fcd56c98ede9f012b6160a193762f63842886dca36872727db0c3cd4761af96c56bfdfb0a42630fee9954c764b5cd31f6ff666649b028bb1852366e639e1008cee678d5e587aabbe78014307ae1fbe638e2c0b52115”,

    “StartPos”: 845941,

    “CDNThumbImgHeight”: 75,

    “CDNThumbImgWidth”: 100,

    “EncryFileName”: “Desert.jpg”

}

3.12 send pictures

    Description: Back to upload files to the server after a successful micro-letters, calls the interface to send pictures.

    Request mode: POST

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg

    get parameters:

  •  

parameter

Sample values

Explanation

pass_ticket

yp5RfCpb%2FsNVex0Uepn1BWXNCYCqTfqe8NOYzan%2B4Y4%3D

Value of public participation

fun

async

 

    post parameters: with text messaging, just one more MediaId

    Returns: with text messaging

15, Get Picture

    Description: Back to upload files to the server after a successful micro-letters, calls the interface to send pictures.

    Request method: GET

    Address: https: //wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg

    get parameters:

  •  

parameter

Sample values

Explanation

MsgID

3176600141007621447

Message returned from the server id

skey

@crypt_8b4f09cc_1b827f84b1535b6be801f00427499050

Value of public participation

type

slave

The parameters are compared with thumbnails, compared with no artwork

    Carrying three cookie value: wxuin, wxsid, webwx_data_ticket

    Returns: a stream of pictures

 

4 illustrate some status code value code

4.1 BaseResponse in the Ret

SUCCESS ( “0”, “success”),

TICKET_ERROR ( “- 14”, “ticket error”),

PARAM_ERROR ( “1”, “incoming parameter error”),

NOT_LOGIN_WARN ( “1100”, “not logged prompt”),

NOT_LOGIN_CHECK ( “1101”, “not detected login”),

COOKIE_INVALID_ERROR ( “1102”, “cookie value invalid”),

LOGIN_ENV_ERROR ( “1203”, “abnormal current login environment, for safety’s sake please do not end in a web log”),

TOO_OFEN ( “1205”, “operation frequency”);

4.2 Synchronization message and check the return value selector retcode

 

retcode

SUCCESS ( “0”, “success”),

TICKET_ERROR ( “- 14”, “ticket error”),

PARAM_ERROR ( “1”, “incoming parameter error”),

NOT_LOGIN_WARN ( “1100”, “not logged prompt”),

NOT_LOGIN_CHECK ( “1101”, “not detected login”),

COOKIE_INVALID_ERROR ( “1102”, “cookie value invalid”),

LOGIN_ENV_ERROR ( “1203”, “abnormal current login environment, for safety’s sake please do not end in a web log”),

TOO_OFEN ( “1205”, “operation frequency”);

selector

NORMAL ( “0”, “normal”),

NEW_MSG ( “2”, “new messages”),

MOD_CONTACT ( “4”, “someone changes their nickname or you modify someone else’s notes”),

ADD_OR_DEL_CONTACT ( “6”, “existence delete or add a friend Information”),

ENTER_OR_LEAVE_CHAT ( “7”, “enters or leaves the chat interface”);

4.3 Returns the message type

TEXT (1, “Text message type”),

IMAGE (3, “picture messaging”),

VOICE (34, “Voice messages”),

VIDEO (43, “small video message”),

MICRO_VIDEO (62, “short video message”),

EMOTI_CON (47, “expression message”),

MEDIA (49, “multimedia message”),

VOIP_MSG(50, “”),

VOIP_NOTIFY(52, “”),

VOIP_INVITE(53, “”),

LOCATION(48, “”),

STATUS_NOTIFY (51, “status notification that he visited one of the chat page”),

SYS_NOTICE(9999, “”),

POSSIBLE_FRIEND_MSG(40, “”),

VERIFY_MSG (37, “friend requests”),

SHARE_CARD (42, “Share card”),

SYS (10000, “System Messages”),

RECALLED (10002, “withdraw message”);

 

5 implements steps

(1) develop QT interface, click on the login button again, download the two-dimensional code, waits for the user to scan;

 

(2) scanning the two-dimensional code using a mobile phone, log micro-channel;

After a successful login, select micro-channel users to send, file transfer assistant, micro-channel group, the public number. Check if pushed to the micro letter box, indicate whether you want to send a letter to the micro, modify, click the Save button after good. The default is to send the file transfer assistant, then click on the Send test. To see whether sent successfully. Send button is the heartbeat every minute of time to send a message, to let you know that normal communications connection, testing. No practical effect. Due to limitations of micro letter, sent to own their own can not be issued file transfer assistant, micro-channel group, micro-channel public number, their only displays the message, the phone will not end the message screen prompts. It is best to have two phone accounts, send a landing, a receiving messages. Because the micro-channel at the same time can only sign in a window-side or client-side web page, so after the micro-channel logged in, you can not go to login page or the client, otherwise they will be squeezed login, leading to send failed.

 

(3) viewed in the micro-channel mobile terminal, the push message can view the alarm, the alarm message client computer can synchronize the mobile phone to push the specified user.

 

(4) As shown above, in order to avoid interrupting the user an alarm message when the user does not want to receive the warning message, the user sends an alarm log or the user accepts the alarm message, the reverse can be controlled by commands on the mobile micro-channel: QStockView: stop (or QStockView: stop) to stop receiving a warning message, control commands may also reverse QStockView: start (or QStockView: start) to begin receiving a warning message; case-insensitive, intervening spaces, or the command is invalid. After sending the command succeeds, it returns a notification message. It indicates that the command is sent successfully.

6 technological constraints

Due to limitations of micro letter, sent to own their own can not be issued file transfer assistant, micro-channel group, micro-channel public number, their only displays the message, the phone will not end the message screen prompts. It is best to have two phone accounts, send a landing, a receiving messages. Because the micro-channel at the same time can only sign in a window-side or client-side web page, so after the micro-channel logged in, you can not go to login page or the client, otherwise they will be squeezed login, leading to send failed. And micro-channel transmission frequency is not too fast, otherwise it will lead to micro letter sent frequently sent is limited, you need to wait 30-60 minutes before you can continue to send. Therefore, a timer may be used to send a message, message transmission frequency of 1 / sec;

 

7 Application of Techniques

In other project site, if there is an alarm message needs to be pushed to the micro-letter, you can reuse the way to docking micro-letter web interface to facilitate micro-letter shortcuts for alarm push;

 

download link:

https://www.cnblogs.com/bclshuai/p/11380657.html

Baidu cloud disk download address:

Link: https: //pan.baidu.com/s/1swkQzCIKI3g3ObcebgpIDg

Extraction code: mc8l

Micro-channel public number to obtain the latest software and video presentation

QStockView

 

Leave a Reply