This article brings you some related issues about WeChat mini programs. It mainly introduces how to use official account template messages in mini programs. Let’s take a look at them together. I hope it will be helpful to everyone.
There is a reservation function in a small program I made recently, which successfully reminds the user that the reservation is successful and notifies the person who made the reservation
Because in the mini program, the first idea is to use "subscribe message"
A problem occurs at this time: the template usage of the subscription message is affected by the service category of the mini program. The current service category can only use one-time subscription, and user authorization is required every time a message is sent
This is not the desired result! ! ! [Recommendation:小program video tutorial]
So I looked for alternatives. Emails were too boring and text messages did not keep pace with the times. The official account had a template message, but it still didn’t work. If there is no corresponding public account registration, what should I use? Baidu also posted a blog asking
what can be used instead of subscribing to messages?
I sincerely thank all the enthusiastic friends for their answers
In the end I chose to use the template message of the public account
It will be easier to register the public account The official account is associated with the mini program.
The second problem occurs during the next process: when logging in to the mini program and replacing the session with code, the
unionID## cannot be obtained.
# I learned from the Internet that the reason was that there was no association configuration on the WeChat open platform. In order to get confirmation, I posted another blog post about not being able to get the unionID when logging in. Thank you again
Through these two blogs, I came up with two ways to complete the function, and tested them both successfully. Next, post the method ideas
The mini program customer is from Macau, soone time
authentication is required when registering the open platform for the customer The fee is
99 US dollars. The US dollar has increased in value and is now equivalent to more than
700in RMB.
Customer: Tencent is awesome! ! !
unionIDwhen logging in, and save it
openIDof the public account directly through
unionID, so I used a troublesome method (I don’t know any other good method yet)
openIDof each fan user into the data table. At this time, it is impossible to tell which fan is following. If the user has a public account
unionIDthrough
openIDand then save it to the data of the corresponding fan user . The
unionIDobtained at this time is
the same as the previously savedunionID
Let’s get the correspondingopenID
The second type is very simple to say, and it is also very simple to do for the backend
Use
General idea:The front end of this project is
uniapp, okay, first use
Probably like this
web-viewto adjust the official authorization interface. Note that it must be silent authorization. ! At this time, you will get the code, and then request the backend through this code... Then you can get the openID... With the openID, you can send the template message...
The above is the detailed content of Teach you how to use public account template messages in mini programs (with detailed ideas). For more information, please follow other related articles on the PHP Chinese website!