The original Official Account document (including subscription number and Service Account) has been upgraded to Official Account message template (original subscription number) and service number document.Official Account message template please refer to the contents of this directory, service document please click here to go.

# Subscribe to messages at once

Dxplaination: Service Account subscription notification function (see the left directory "subscription notification") open gray test, Official Account one-time subscription message capability can be used normally

Developers can let WeChat users authorize third parties through one-time subscription message licensingMobile App ( access instructions ) or Official Account get the opportunity to send a subscription message to an authorized WeChat user.Authorized WeChat users do not need to follow the Official Account message template. Each time a WeChat user is authorized, the developer gets permission to post a message once. (Note: Multiple authorizations under the same scene value of the same user do not accumulate issuing permissions, and only one can be issued.) To subscribe to more than one, different scene values are required)

Note: For those who have paid attention to Official Account, the message will be sent to the Official Account message template;Official Account message template will be sent to the service notice.

Official Account or web pages using a one-time subscription message flow as follows:

Step 1: Authorization is required for a user to be given a chance to push a subscription template message

To ensure that WeChat public accounts have permission to subscribe to a message (certified Official Account has permission and can be viewed in the interface permission list by logging in to the public platform), direct users to open the following link in the WeChat client:

https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid=wxaba38c7f163da69b&scene=1000&template_id=1uDxHNXwYQfBmXOfPJcjAS3FynHArD8aWMEFNRGSbCc&redirect_url=http%3a%2f%2fsupport.qq.com&reserved=test#wechat_redirect

Parameter explaination

parameter Do I have to? Introductions
action yes Just fill in get_confirm
appid yes Unique identifier for Official Account
scene yes The redirection will take the scene parameter, and the developer can fill in an integer value from 0 to 10000 to identify the subscribed scene value
template_id yes Subscribe to the message template ID, login the public platform background, in the interface permissions list can view the subscription template ID
redirect_url yes The callback address of the redirect after authorization, use UrlEncode to process the link. Note: The domain name of the redirect_url is required to match the registered business domain name, and the business domain name cannot take a path.Business domain name needs to log in Official Account, in the Settings - Official Account message template - function settings inside the business domain name settings.
reserved no It is used to maintain the status of the request and callback, and to authorize the request to be brought back to a third party as it is. This parameter can be used to prevent CSRF attacks (cross-site request forgery attacks). Third parties are advised to bring this parameter. It can be set to a simple random number plus a session for verification. Developers can fill in a-zA-Z0-9 parameter value of up to 128 bytes and require URLencode
#wechat_redirect yes You must bring this parameter with you whether you open the page directly or do a page 302 redirect.

Relevant information is returned when the user consents or revokes authorization

If the user clicks on consent or deauthorization, the page goes to:

redirect_url/?openid=OPENID&template_id=TEMPLATE_ID&action=ACTION&scene=SCENE

Parameter explaination

parameter Introductions
openid User unique identification, which is only carried when the user confirms authorization
template_id Subscribe Message Template ID
action The user clicks on the action, "confirm" on behalf of the user to confirm the authorization, "cancel" on behalf of the user to cancel the authorization
scene Subscription scenario value
reserved Bring the request back as it is

Step 2: Push the subscription template message through the API to the authorized WeChat user