Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of sending template message in WeChat Mini Programs

Shulou Source: shulou.com Published: 2022-06-03 19:29:33 11月12日 Update

This article mainly introduces the example analysis of sending template messages in WeChat Mini Programs, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let the editor take you to know it.

Send template message in WeChat Mini Programs

Refer to Wechat public platform Api document address: https://mp.weixin.qq.com/debug/wxadoc/dev/api/notice.html# template message management

The implementation logic is divided into:

1. Get access_token

2. Send template messages (including user's openid, template's template_id, user-triggered form form_id or payment's pre-prepay_id)

Note:

1. The user's openid is obtained through user authorization.

2. The template_id of the template is viewed from the "template message" of the public platform of Mini programs.

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 user payment message is sent, the value can be the pre-pay _ id that places the order payment.

Error return code Note: errcode:41028,errmsg: "invalid form id hint: [YVJBEA0597ge21]"

There are several situations in which this error is reported:

1. If it is found that the value of form_id is "the formId is a mock one", it means that it is not tested on the real machine, but needs to be tested on the real machine.

2. The user who triggered the confirmation event is not the same as the user who sent the message.

3. The prepaid user is not the same as the user who sent the message.

Experience: the collection notice was found in the template message of Wechat public platform, thinking that the user triggered the payment and can send the receipt notice to the merchant. But I kept reporting this error, and only later found out that Wechat did not allow it.

Thank you for reading this article carefully. I hope the article "sample Analysis of sending template messages in WeChat Mini Programs" shared by the editor will be helpful to everyone. 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!

Tags: Users messages templates payments programs articles the public platforms forms errors examples analysis events references tests events childhood value interest at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information MariaDB Redmi Linux