# Subscribe to the event push for notifications

Users manipulate the subscription notification window

Scenarios: The user's action to subscribe to a notification within a picture and text scenario

parameter describe
ToUserName Service Account WeChat
FromUserName User openid
CreateTime timestamp
TemplateId Template id (one subscription may have multiple notifications with multiple id)
SubscribeStatusString User clicking behavior (consent, cancel notification)
PopupScene scene

Legal value of SubscribeStatusString

value Introductions
accept Users click "Agree"
reject Users click "Cancel"

Valid value of PopupScene

value Introductions
1 Popup from H5 page
2 The pop-up comes from a text message

XML Example

<xml>
    <ToUserName><![CDATA[gh_123456789abc]]></ToUserName>
    <FromUserName><![CDATA[otFpruAK8D-E6EfStSYonYSBZ8_4]]></FromUserName>
    <CreateTime>1610969440</CreateTime>
    <MsgType><![CDATA[event]]></MsgType>
    <Event><![CDATA[subscribe_msg_popup_event]]></Event>
    <SubscribeMsgPopupEvent>
        <List>
            <TemplateId><![CDATA[VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc]]></TemplateId>
            <SubscribeStatusString><![CDATA[accept]]></SubscribeStatusString>
            <PopupScene>2</PopupScene>
        </List>
        <List>
            <TemplateId><![CDATA[9nLIlbOQZC5Y89AZteFEux3WCXRRRG5Wfzkpssu4bLI]]></TemplateId>
            <SubscribeStatusString><![CDATA[reject]]></SubscribeStatusString>
            <PopupScene>2</PopupScene>
        </List>
    </SubscribeMsgPopupEvent>
</xml>

User Management of Subscription Notifications

Scenario: A user does something while doing notification management on the service notification management page

parameter describe
ToUserName Service Account WeChat
FromUserName User openid
CreateTime timestamp
TemplateId Template id (one subscription may have multiple notifications with multiple id)
SubscribeStatusString User clicking behavior (only pushes for users to decline notifications)

Legal value of SubscribeStatusString

value Introductions
reject Users click "Cancel"

XML Example

<xml>
    <ToUserName><![CDATA[gh_123456789abc]]></ToUserName>
    <FromUserName><![CDATA[otFpruAK8D-E6EfStSYonYSBZ8_4]]></FromUserName>
    <CreateTime>1610969440</CreateTime>
    <MsgType><![CDATA[event]]></MsgType>
    <Event><![CDATA[subscribe_msg_change_event]]></Event>
    <SubscribeMsgChangeEvent>
        <List>
            <TemplateId><![CDATA[VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc]]></TemplateId>
            <SubscribeStatusString><![CDATA[reject]]></SubscribeStatusString>
        </List>
    </SubscribeMsgChangeEvent>
</xml>

Send a subscription notification

Scenario: Call bizsend interface to send notification

parameter describe
ToUserName Service Account WeChat
FromUserName User openid
CreateTime timestamp
TemplateId Template id (one subscription may have multiple notifications with multiple id)
MsgID Message id
ErrorCode Push result status code (0 indicates success)
ErrorStatus Text implications of push result status code
  • Failure only includes system failure due to asynchronous pushing

XML Example

<xml>
    <ToUserName><![CDATA[gh_123456789abc]]></ToUserName>
    <FromUserName><![CDATA[otFpruAK8D-E6EfStSYonYSBZ8_4]]></FromUserName>
    <CreateTime>1610969468</CreateTime>
    <MsgType><![CDATA[event]]></MsgType>
    <Event><![CDATA[subscribe_msg_sent_event]]></Event>
    <SubscribeMsgSentEvent>
        <List>
            <TemplateId><![CDATA[VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc]]></TemplateId>
            <MsgID>1700827132819554304</MsgID>
            <ErrorCode>0</ErrorCode>
            <ErrorStatus><![CDATA[success]]></ErrorStatus>
        </List>
    </SubscribeMsgSentEvent>
</xml>