Foreword

WeChat officials have adjusted the distribution conditions of template messages in order to improve the experience of using template messages. The original template message will be upgraded to “subscription message”, and the template message interface will be offline on April 10, 2020 (new applets released after January 10, 2020 can only be used Subscription message), then the template message can no longer be pushed using the original interface, so developers need to make timely adjustments.

The difference between template messages and subscription messages

Whether it is a template message or a new subscription message, sending applet messages is done in three steps:

  • Get the template ID (that is, create a template)
  • Get permission to issue
  • Send a message

    From the point of view, only the step of “getting permission to issue” is changed, and the rest are the same.

    Template message

    When the user completes a specific interaction (payment or submission of form) in the applet to collect the formid, the subsequent use of the formid can push the template message to the user at any time within 7 days.

    • Be sure to carry formid when sending template messages
    • Push is valid for 7 days
    • Users can only choose to receive passively, and the right to issue is in the hands of developers

      Subscribe news

      When the user clicks a specific button in the applet, a pop-up window for applying for a subscription pops up. After agreeing, the applet can push service notifications to the user at any subsequent time.

      • Sending subscription messages requires user authorization first
      • Authorization can send one service notification at a time, you can repeat authorization, each authorization will be saved as a separate record
      • Unlimited push time
      • The user chooses to accept it independently, and the right to issue is in the hands of the user

        Summary

        The previous “template message” distribution does not require user authorization. In theory, it can be designed to allow users to click once to get permissions. In this process, the user is not aware. As long as the formid is available, it is in the public template library. Some can be delivered, and there are no restrictions on the type of data. What messages users receive depends entirely on the developer.

        The current “subscribe message” is more like a switch. It requires users to actively click the authorization to obtain the permission to send messages. The user does not receive messages, and what subscription messages are received, the decision is in the hands of the user. In addition, the subscription message also strictly controls the data type and length, and those that do not meet the requirements cannot be delivered. (Blood and tears lesson, and you can only know what type this field is after adding a template. For template messages with variables, please pay attention to whether the variables meet the field requirements)

        Subscription message usage scenario

        Although the “template message” and “subscribe message” are both to recall users and push message reminders, because the time limit for template message push is too strict, compared to some small programs with a long service period, 7 days Restrictions cannot provide complete services.

        For example, for small programs such as air tickets, the interval from booking to travel for a user is likely to be more than 7 days. If you want to send a message such as “Flight Delay Reminder” to the user, it may not be possible. Therefore, for small programs with low-frequency and long-term services, “subscribe to news” is very important.

        In addition, there are a small number of small programs that use “template messages” as marketing tools to push advertisements and induce users to click, which greatly affects the user experience. The launch of “Subscribe News” made up for these two problems perfectly.

        Different from “template message”, users need to authorize subscription before sending messages. For service scenarios that are just needed, such as “takeaway delivery message” for takeaway applet and “arrival notice” for ecommerce applet, etc. Scenarios and subscription rates are relatively high.

        Instead of the service scenario just needed, you can “guide subscription” to the user, so first let the user actively trigger the subscription. For example, for the e-commerce applet, it can guide users to subscribe to the “price reduction notice” of their favorite products; while the content-type applet can guide users to subscribe to topics that interest them.

        Pit guide for upgrading subscription messages

        1. Turn up the subscription popup

        To trigger user subscription, the API provided by WeChat Mini Program is: wx.requestSubscribeMessage. The triggering condition must be the user’s click behavior (bindap event) or initiate a payment callback before calling the subscription message interface. The bindsubmit event of the form does not work. If you originally obtained the formid in the form and want to upgrade to a subscription message, here are two ideas for reference:

        • Change the form’s bindsubmit event to a bingtap event. Get the form data manually, call the subscription message interface through the bindtap event, and submit the form after completing the subscription. (Suitable when the amount of form data is small)
        • In the bindsubmit event, add a pop-up window that guides the user to subscribe. For example, use wx.showModal (the callback function is the bindtap event), call up the subscription message interface based on whether the user confirms, and then complete the form submission after completing the subscription.

          2. Turn up the subscription popup while jumping to the page

          When the user clicks the button to trigger the subscription popup and jump to the page at the same time, on Android, the subscription popup can be displayed normally on the page that has been redirected. On iOS, it will not be displayed normally, but on the top. A page displays a popup. So from the user experience perspective and in order to collect subscription records normally, you must wait for the subscription to complete before jumping.

          3. The user selects “Always keep the above selections and never ask again”

          When the user selects “Always keep the above selections and never ask again”, then this popup will never be awakened again. At the same time, if you select “Cancel”, every time you call this API in the future, it will be automatically rejected; if you select “Allow”, authorization will be automatically allowed each time.

          Currently, you can use wx.getSetting () to get the subscription status of user subscription messages. For details, see Official Documentation . The required base version library is 2.10.0, that is, WeChat version 7.0.9 and above.

          Under the condition that some specific elements trigger the application for subscription permissions (such as wx.showModal above to invoke the subscription interface), you can determine whether to trigger based on the subscription status. Use wx.getSetting (), can get whether the user has checked “Always keep the above selection, don’t ask again” and the subscription status of this subscription message. When wx.getSetting () returns that the user has refused to subscribe to this subscription message, the guided subscription popup of wx.showModal is not displayed.

          4. How many subscription messages can be collected in one subscription?

          wx.requestSubscribeMessage can subscribe to a maximum of 3 messages in one call, that is, a maximum of 3 tmplIds. One-time subscription / long-term subscription after iOS client version 7.0.6 and Android client version 7.0.7 only supports multiple template messages. One subscription before iOS client version 7.0.5 and Android client version 7.0.6 only Supports a template message. For details, see Official Documents .

          5. Parameter restrictions for sending subscription messages

          Sending a subscription message must strictly follow “ Subscribe to the message parameter value content limit description “to complete.

          When creating a template, according to the keywords selected, when sending a subscription message, you need to fill in the content according to the instructions in the above table. If the parameters are not met, the sending will fail. For example, the name.DATA on the figure is less than 10 pure Chinese characters or less than 20 pure letters or symbols. If the parameter value is known to Cloud 2020, a data.name1.value invalid error will be reported; if the parameter value of phrase.DATA is More than 5 Chinese characters are also reported as errors.

          Through the above pit-proof guide, you can make applet developers take less detours and finish the upgrade easily and quickly at the last minute of the deadline. Next, you will learn how to access subscription messages by knowing the “knowledge push” of the cloud.

          Knowledge push opens up the obstacle of message push between different platforms. Notifications are pushed to multiple platforms such as WeChat applet, QQ applet, Alipay applet, Android, iOS, etc. No coding required, out-of-the-box, one-stop user access. Easily complete message push, user conversion, data analysis, etc. Work at multiple levels. “

          Access subscription message

          Developers can enter the subscription message access wizard on the know push page:

          The first three steps are similar to accessing WeChat. For details, see WeChat Mini Program Access . Enter SDK “, you need to fill in AppScret. AppSecret is used to activate the template message service, and you can check it in” Settings-Development Settings “in the background of the applet.

          Report subscription messages as directed.

          Access is completed after passing verification

          Get template ID

          Search for a suitable template in the template library, click on the option, select the required keywords and submit it to complete the template creation.

          You can view, add, and delete templates in My Templates, and get the template ID here.

          Get permission to issue

          The WeChat applet provides the wx.requestSubscribeMessage interface to initiate the subscription permission interface

          Interface for reporting subscription status

          Know Cloud provides wx.BaaS.subscribeMessage (options) SDK to collect subscription status

          Parameter description

          Subscription

          After the user clicks or initiates a payment callback, the subscription message interface is invoked and the subscription status is reported through the SDK.

          Sample code

          In the function, we will call the WeChat API wx.requestSubscribeMessage to apply for sending subscription permissions. After the pop-up window pops up, we will receive a success callback. When the user agrees to the subscription in the pop-up window, the subscription result is accepted and the subscription will be accepted. The template_id (template ID) and subscription_type (subscription type) are stored in the subscription array, and can be reported by calling the SDK.

          • Currently only one-time subscriptions are supported
          • You need to report the template ID whose subscription result is accept

            View and manipulate subscription records collected in Subscription History

            Send a subscription message

            1. Send online
            2. Trigger by trigger
            3. Cloud function sending

              1. Send online

              By sending a subscription message online to the user in “Subscription Message”. Fill in the required content, you can choose to send immediately or regularly.

              Smart filtering

              When screening target users, it is recommended that developers use intelligent filtering services to ensure the reach and conversion rate of template messages.

              2. Triggered by a trigger

              Create trigger

              Click “Engine”-“Trigger” to create a new trigger.

              Trigger type: That is, the trigger source. Each trigger can only select one trigger type. Different trigger types can perform different action options.

              Set conditions

              When the trigger type is selected, the developer needs to specify the trigger condition to trigger the execution of subsequent actions. The trigger condition is related to the trigger type one by one. The trigger can be triggered when the trigger condition is met.

              Setting actions

              Select “Send Subscription Message” as the action type. It is similar to sending online. Fill in the relevant content and complete the trigger creation after the template verification. If the updated_at is a string, it can be converted using the filter form {{updated_at | date: ”year m month d day H: i”}}. In addition, you can click “Add Action” to continue setting actions.

              More content can be found in Know the Cloud-Trigger Tutorial

              3. Send via cloud function

              Creating cloud functions

              Click “Engine”-“Cloud function”-“Add” to complete the creation of the cloud function.

              Sample code

              After writing the cloud function, click Save to complete the modification of the cloud function.

              Use triggers with cloud functions

              When the logic of the subscription message to be sent is more complicated, you can trigger by writing a cloud function.

              For details, please refer to the chapter in the development document “ Using cloud functions to send subscription messages

              Precautions

              Sending subscription messages must strictly follow “ Subscription message parameter value content limit description ” to fill in, “online sending” and “trigger” set actions corresponding to existing templates Parameter value limit. If the parameter value is incorrect, it will result in sending failure. The sending details can be viewed in “Knowledge Push”-“Log”.

              Upgrade benefits

              By January 17, 2020, new users who register through the link below will receive a $ 90 voucher.

              (Register Portal ???? https://cloud.minapp.com/?invitation=aiwphp)