Small program one-time subscription message for long-term push solution

Since mini-programs are only open to offline public services such as government affairs and people's livelihood, medical care, transportation, finance, and education for a long time, and the current projects do not meet the requirements of these main categories, they can only start from a one-time template.

A one-time template means that the user can authorize once and can push a message once, so the solution I use for a one-time template to push for a long time is to add a click-to-subscribe method in the clicked place, so that it can be continuously accumulated to achieve long-term push. Since the first authorization was selected "Always keep the above selection, do not ask again", so clicking later can basically achieve non-sensing authorization

insert image description here
1. First select a one-time template
insert image description here
2. Call it where the user clicks [only call requestSubscribeMessage at the clicked place, and call it if you can’t directly enter it]

<button @click="openNews()">预约直播</button>
 
openNews(){
  wx.requestSubscribeMessage({
    tmplIds: ['模板ID'],
    success (res) {}
  })
},

3. After calling up the subscription template, remember to check "Always keep the above selection, never ask again"
insert image description here

Guess you like

Origin blog.csdn.net/qq_43384836/article/details/125489323