Precautions for sending template messages in the applet, And the applet Template
Send template messages in the Applet
For more information, see the public platform Api documentation at https://mp.weixin.qq.com/debug/wxadoc/dev/api/notice.html#model-based message management.
This reference address is detailed and detailed.
The implementation logic is divided:
1. Get access_token
2. Send the template message (including the user's openid, template_id of the template, the user-triggered form form_id or the pre-prepay_id of the Payment)
Note:
1. the user's openid is obtained through user authorization
2. view the template_id of the template on the "template message" of the mini-program public platform.
3. The from_id of the form is obtained from the report-submit = "true" in the form submission event triggered by the user. If the sent user pays the message, the value can be the pre-prepay_id of the order payment.
Error return code Note: errcode: 41028, errmsg: "invalid form id hint: [YVJBEA0597ge21]"
This error is reported in several cases:
1. If the value of form_id is "the formId is a mock one", it indicates that it is not tested on a real machine and must be tested on a real machine.
2. the user who triggered the event and the user who sent the message are not the same person
3. The pre-payment user and the user who sent the message are not the same person
TIPS: A collection notification is found in the template message on the public platform, so that the user can send a collection notification to the merchant when the payment is triggered. However, this error was reported until it was discovered that this error was not allowed.
However, you can only send receipt notifications, but what is the purpose? If you have any good solutions, please leave a message and let me know.