# Subscribe to messages at once
Dxplaination: Service Account subscription notification function (see the left directory "subscription notification") open gray test, service number one-time subscription message ability can be used normally
Developers can let WeChat users authorize third parties through one-time subscription message licensingMobile App ( access instructions ) or Service Account get the opportunity to send a subscription message to an authorized WeChat user.Authorized WeChat users can not need to follow the service number. 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)
Message posting location explaination: For those who have been concerned about Service Account, the message will be sent to the service number session;If you do not pay attention to the service number, it will be sent to the service notification.
Service 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 Service 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 Service 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.The business domain name needs to log in Service Account, and set the business domain name in the settings - service number settings - function 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
- Interface details can be found in Send a one-time subscription message