In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the preparation work for the development of Wechat public platform test interface, which has a certain reference value. Interested friends can refer to it. I hope you will learn a lot after reading this article. Now let the editor take you to know about it.
1. Apply for the official account of Wechat
If we want to develop the Wechat public platform, the first step is of course to have an official account. What? Do not know what is the Wechat official account, it seems that you have to go back to the furnace to refine, hehe. Popularly speaking, our Wechat platform is like a big society, in which there are individuals as well as various organizations. The ordinary WeChat account you use is individual, and the official account is those organizations, which are divided into two categories: one is those who provide all kinds of information, called Subscription account; the other is those who provide various services, called service numbers. Of course, at present, individuals can only apply for Subscription account, and only organizations, such as companies, can apply for a service number.
What's the difference between Subscription account and the service number? To put it simply, the service number is designed to provide services to users. You can use your own Wechat to add the WeChat account of China Merchants Bank to see what the service number is. Subscription account aims to provide users with information and information. A typical example is "XXX" WeChat account.
Specifically, the service number:
Only one group message can be sent within 1 month (30 days). 2. Messages sent to subscribers (fans) will be displayed in each other's chat list. 3. When sending a message to the user, the user will receive an instant message reminder. 4. The service number will be in the address book of subscribers (fans). 5. You can apply for custom menu. Subscription account: 1. You can send a group message every day (within 24 hours). 2. Messages sent to subscribers (fans) will be displayed in each other's Subscription account folder. 3. When sending messages to subscribers (fans), subscribers will not receive instant message reminders. 4. In the address book of subscribers (fans), Subscription account will be put into Subscription account's folder. 5. Subscription account does not support applying for custom menus.
Through this relatively big family, we roughly have an intuitive impression. To put it simply, Subscription account mainly provides all kinds of information and news for fans, and the function is relatively simple; while the service number is mainly for fans to provide various services, you can have custom menus. And more importantly, the service number can apply for more and more advanced platform interfaces. At this point, you should understand that when we do Wechat Mall, we need to apply for the Wechat service number.
For individual developers, it is not possible to apply for a service number. However, Tencent takes this into account and specially prepares a test account for us. Through this account, we can get all the functions and API calls of the Wechat service account.
All right, enough nonsense. Next, follow me step by step to apply for a Wechat test account.
Open the application address: http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
See the instructions above? Without the need for a public account, quickly apply for an interface test number to directly experience and test all the advanced interfaces of the public platform. You must be excited. As long as you enter your mobile phone number and verification code, you can apply for success immediately, as shown below:
Note that this test number is valid for one year, and WeChat account and QR code are assigned. Now pick up your mobile phone Wechat and scan the QR code pattern that has just been assigned to you, and you will find that you can follow the official account of the test you applied for in a minute.
After clicking to follow, we can find this official account in Subscription account. Please note that although it is placed in Subscription account, the test number can basically call all the advanced interfaces of the Wechat platform (see "list of available API categories"). So our test number is enough for us.
two。 Basic principles of Wechat Public platform Development
I don't know if you have noticed, but in the screenshot in the first section, we have a configuration item for "website interface configuration". In fact, this is the url address of the interface between Wechat platform and our website.
Let's take a look at this picture. Inside the blue box on the left is the Wechat platform, and inside the red box on the right is the server where our own website is located. The Wechat platform communicates with the website server through interface calls. When a Wechat user sends a message to our official account (the specific type of message will be introduced later), the Wechat backend server will determine whether the message is sent to our official account. If so, forward the message to our official account and send a request message to our configured website interface address. After receiving the message, our website will process it. The result of the processing (response message) is sent to the Wechat platform, forwarded by the platform, and finally displayed to the chat box of Wechat users.
This is a typical process of message exchange, with this impression, we understand that the focus of our work is on the server side of the website, that is, how to accept the request message sent by the Wechat platform. How to deal with it, and finally how to return the processing result to the Wechat platform (the green part in the picture).
3. Server environment preparation
If we want to accept and process messages sent by the Wechat platform, of course, we must have our own website server.
So, next we have to prepare our website server environment.
Many students like to use Baidu application engine BAE, because it is free to apply and does not need maintenance, which is indeed very convenient, but what I want to say here is that when we develop the program, we still do not recommend doing that, why? Because it is not good for debugging. The normal step should be to develop and debug locally, and then put it on the real server (such as Baidu BAE, etc.) without any problems. There is another topic, what language do we use to develop our website? In fact, as long as can be used to develop the language of the website, such as: Java, PHP, ASP.NET, Ruby, Python, Note.js and so on. The interaction between Wechat platform and our website is realized through interface calls, as long as our website can respond to the request message, it doesn't matter what language we use. Of course, it depends on which language you are best at, because more and more php is used in website development, so we choose php as the development language of our website.
Once the language is selected, the next step is to build a local development environment. In fact, the construction of the local development environment and ordinary php website development environment is the same, if you are not familiar with, you can directly to the Internet to download a WAMP suite, install it, and then download an eclipse as a development tool on it.
So what's the point? The key point is the communication between Wechat platform and our local server.
Let's look at the following picture:
Wechat platform calls our website through the websites URL and Token configured here, so we first need to apply for a url for our local server so that foreign networks can access our local website through this url. In other words, we should be able to publish the website on our local computer to the public network so that everyone can access it.
3.1 Mapping of local websites to public network domain names
It seems troublesome to publish a website running on your local computer to the public network so that all people can access it. Because you need to have a domain name first, then configure port mapping on the local router, and pay special attention to the firewall settings. However, now I would like to recommend a very good tool: the new peanut shell dynamic domain name tool. With this tool, you don't need to set up the port mapping of the router, worry about the settings of the firewall, or even apply for a domain name, because the new peanut shell has already solved it for you. All right, let's cut down the gossip so as not to be suspected of advertising. Then we officially begin to teach you how to publish a website running on your own computer to the Internet so that everyone can access it.
1. First of all, you need to have a website that works locally, and if you don't have your own new web project, then run it. For example, I created a new java web project in eclipse with only one jsp page and started to run it in tomcat.
two。 Type: localhost:8089/Demo in the browser to see if you can open the home page. (your url address may be different from mine)
3. If you can open it, then register a peanut shell account from here: https://console.oray.com/passport/register.html. Here: http://hsk.oray.com/download/ downloads the "New Peanut Shell client" and logs in with the account of the registration number after installation.
4. After logging in, you can immediately see the free level 2 domain name assigned by Peanut Shell for us. Mine is: xxx123.vicp.cc
5. Click the icon in the red circle to diagnose the domain name, and the word "successful" indicates that the domain name mapping is successful.
6. Go back to the domain name list page, right-"New Peanut Shell Management"
7. Click add Mapping on the pop-up page. We only need to enter the ip address and port number of our local website in the custom application tab (check "Open HTTP80 port of public network"), such as mine:
8. After clicking OK, the level 2 domain name assigned to us through peanut shells can visit our website anywhere on the Internet. In this way, we put the web website on our local computer on the Internet.
3.2 fill in the interface configuration information of Wechat platform
Next, fill in our level 2 domain name into the interface url (pay attention to the application name)
Token enters a string at random (mainly for verification, which will be explained later), for example: wx123
Click submit.
Thank you for reading this article carefully. I hope the article "what are the preparations for developing the test interface of Wechat public platform" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.