If you have developed the WeChat public platform before using the Weibo fan service platform, it is strongly recommended to read this document to understand the details of the migration process;
The migration of WeChat developers was considered at the beginning of the design of Weibo fan service interface, so the migration cost is not high; However, developers still need to adapt to the following three differences:
Difference 1: When applying for the message interface, WeChat fills in Token and Weibo fills in Appkey
stay Application message interface In Weibo, developers need to fill in the URL and Appkey, while WeChat requires developers to fill in the URL and Token;
WeChat Token is a character filled in by developers at will, and is only used to "verify the validity of URL";
The Weibo Appkey is provided by the Weibo official. In addition to "verifying the validity of the URL", it is also used to represent the identity of the developer;
In the "Verify URL Validity" phase, the AppSecret corresponding to the developer's Appkey is used to generate signature; In other words, the encryption process of Weibo's signature field is basically the same as that of WeChat. The only difference is that the Token field used for WeChat encryption is replaced by the AppSecret field on Weibo;
Difference 2: access_ Token generation methods and validity periods are different
WeChat access_ The token is obtained by calling the corresponding interface through the AppID and AppSecret of the public account;
The access of Weibo's fan service interface_ Token certificate is in the Application message interface At this time, after the URL is verified successfully, the powder service platform will automatically return (as shown in the following figure);
In addition, access to Weibo's fan service interface_ Token vouchers can also be obtained through the OAuth2.0 authorization interface of Weibo, but this is currently under development and has not been launched yet;
About the validity period, WeChat access_ The valid period of the token is 7200 seconds, which needs developers to refresh constantly; But access to Weibo's fan service interface_ The token certificate is valid for one year. Developers can find the Blue V account to rebind or authorize it one year later;
About Weibo access_ For more information about token, see:
Difference 3: There are some differences in interface parameters
1. About receive messages and Send passive message Two functions, WeChat is in push XML format, and Weibo is in push JSON format by default, but Weibo is also compatible with WeChat XML format;
If third-party developers want to use WeChat XML compatible format, they can use the http://open.weibo.com/wiki/Eps/push/set_format Interface to switch between XML and JSON. For more details, refer to WeChat XML format compatible ;
2. About Send customer service message Function, WeChat call parameter is access_ Token, token, msgtype and message content. The corresponding parameter of Weibo is access_ token,receiver_ ID, type and data fields; The ID and source fields in the document are mainly used to support the old version of fan service. New developers should ignore them;
Microblogging Send customer service message At present, the function only supports three types of formats: plain text, graphic message and location information;