Home >Backend Development >PHP Tutorial >Can I reply with different content according to different cities when following on WeChat for the first time?
Looking at the documentation, it doesn’t seem to work.
Please give me some guidance.
Looking at the documentation, it doesn’t seem to work.
Please give me some guidance.
There is no good method. The city in the user information will be very inaccurate. Many users fill in the city information of their hometown, not their current location. When WeChat pushed attention events, it did not push the user’s IP
Sure. . When following the push, get the user information, which contains city, but the user must also fill in the information. . . . Another option is for the user to report their geographical location, but this is triggered when there is no way to pay attention to it, and the user can disagree.
Yes, but it’s a bit troublesome.
When the system background receives the information pushed by WeChat, it determines whether it is the user's attention
If the user is paying attention, the user’s openid will be obtained based on the received information
Go to the WeChat server to obtain user information based on openid
Reply with different content based on the city field obtained from the user information
Note: When receiving a WeChat message push, you must respond immediately within 5 seconds. If there is no response, multiple identical messages will be sent, resulting in repeated processing on your side
When paying attention, you can receive the user's information in the server background (how to get it? See the documentation). You can reply to the user with different content based on the city in the user's information