Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop template messages on Wechat Public platform

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how Wechat public platform develops template messages. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Apply for template message permission

The application of template message requires that the account has been activated with the permission of WeChat Pay.

In the backend of Wechat public platform, enter "Features"-> "add feature plug-ins"-> "template message" to apply for a template message.

Click to apply

When applying, you can choose 2 related industries.

After the application is submitted and approved, you can see a list of template messages in the template library.

Enter the template you want to use and click add

Add it and store it in my template Library.

Check the details of the template, you can see the id of the template and the parameter names of each content.

Different template messages have different content structures. These id and field names will be used in the program.

2. Develop template message SDK

Template messages are defined as follows:

Template messages are also sent using access token as authorization.

Basically, we only need to modify the advanced SDK on Wechat public platform. The SDK implementation of the template message is as follows

Third, construct the template message body

Let's take the horizontal version of a successful purchase notification in the messaging industry as an example, and its content is as follows.

According to the above conditions, we construct the message body as follows

Call SDK to send, with the following code

Require_once ('weixin.class.php'); $weixin = new class_weixin (); var_dump ($weixin- > send_template_message (urldecode (json_encode ($template)

The results are as follows:

Thank you for reading! This is the end of the article on "how to develop templates on Wechat Public platform". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it for more people to see!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report