WeChat Developer Migration Guide
If you have already developed the WeChat public platform before using the Weibo fan service platform, it is highly recommended to read this document to understand the details that need to be paid attention to during the migration process;
The Weibo fan service interface was designed with the migration issue of WeChat developers in mind, so the migration cost is not high; however, developers still need to make certain adaptations for the following three differences:
Difference 1: When applying for the message interface, fill in the Token for WeChat and the Appkey for Weibo
When applying for the message interface, Weibo requires developers to fill in the URL and Appkey, while WeChat requires developers to fill in the URL and Appkey. The developer fills in the URL and Token;
WeChat’s Token is a character filled in arbitrarily by the developer and is only used to “verify the validity of the URL”;
and Weibo’s Appkey It is provided by Weibo official. In addition to being used to "verify URL validity", it is also used to represent the developer's identity;
In the "Verify URL validity" link, the developer's Appkey The corresponding AppSecret is used to generate signature signatures; in other words, the signature field encryption process of Weibo is basically the same as that of WeChat. The only difference is that the Token field used for encryption in WeChat is replaced by the AppSecret field in Weibo;
Difference 2: The access_token generation method is different and the validity period is also different
WeChat’s access_token acquisition method is to obtain it by calling the corresponding interface through the AppID and AppSecret of the official account;
The access_token certificate when calling Weibo’s fan service interface is automatically returned by the fan server platform after successfully verifying the URL when applying for the message interface (as shown below);
In addition, Weibo’s The access_token credentials of the fan service interface can also be obtained through Weibo's OAuth2.0 authorization interface, but this is currently under development and has not been launched yet;
Regarding the validity period, the validity period of WeChat's access_token is 7200 seconds. Developers need to constantly refresh; However, the access_token certificate of Weibo’s fan service interface is valid for one year. Developers can find the Blue V account to rebind or authorize it after one year;
For more information about Weibo access_token, please see:
Difference 3: There are certain differences in interface parameters
1. About receiving There are two functions: messaging and sending passive messages. WeChat pushes XML format, and Weibo pushes JSON format by default, but Weibo is also compatible with WeChat XML format;
If third-party developers want to use WeChat XML For compatible formats, you can use the http://open.weibo.com/wiki/Eps/push/set_format interface to switch whether the format you need is XML or JSON. For more details, please refer to WeChat XML format compatibility;
2. Regarding the function of sending customer service messages, the calling parameters of WeChat are access_token, touser, msgtype and message content. The corresponding parameters of Weibo are access_token, receiver_id, type and data fields; the id and source fields in the document are mainly used Supports the old version of fan service, new developers please ignore it;
Weibo’s function of sending customer service messages currently only supports three types of formats: plain text, graphic messages and location information;