Contents

1 Event Push

1.1 Event of Opening a Product Homepage

1.2 Event of Following an Official Account

1.3 Event of Entering an Official Account

1.4 Asynchronous Push for Location Information

1.5 Push for Product Review Results

# Event Push

The events of opening a product homepage and following or entering an Official Account from a product homepage will be pushed to the URL provided by the merchant in the Official Accounts Platform > Developer Center. Developers can perform such operations as generating statistics or authenticating user identities through the pushed events to achieve more precise operation.

If the Weixin server does not receive the response within five seconds, the connection is broken and the request is initiated again. A maximum of three retries are made. We recommend that you use FromUserName + CreateTime to de-duplicate requests. If the merchant's server cannot ensure the request is processed within five seconds, it can return an empty string. When receiving the string, the Weixin server will not take any action or make a retry.

Event of Opening a Product Homepage

The event of opening a product homepage (e.g. by scanning QR code or from chats, Favorites, or Moments) will be pushed to the URL provided by the merchant, including the user's basic information and the code of the product homepage.

Example of pushing XML

<xml>
 <ToUserName><![CDATA[gh_4e47c9c9ecad]]></ToUserName>
 <FromUserName><![CDATA[okkeXs1nI-xU4ql8-5BXkv1f0gDo]]></FromUserName>
 <CreateTime>1438250110</CreateTime>
 <MsgType><![CDATA[event]]></MsgType>
 <Event><![CDATA[user_scan_product]]></Event>
 <KeyStandard><![CDATA[ean13]]></KeyStandard>
 <KeyStr><![CDATA[6901481811083]]></KeyStr>
 <Country><![CDATA[China]]></Country>
 <Province><![CDATA[Guangdong]]></Province>
 <City><![CDATA[Jieyang]]></City>
 <Sex>1</Sex>
 <Scene>2</Scene>
 <ExtInfo><![CDATA[123]]></ExtInfo>
</xml>

Pushed Parameters

Parameter Description
ToUserName The original ID of the merchant's Official Account
FromUserName User's openid
CreateTime Message creation time (integer)
MsgType Message type (event)
Event Event type. "user_scan_product" represents an event of opening a product homepage.
KeyStandard Product coding standard
KeyStr Product coding content
Country Country set by the user in Weixin
Province Province set by the user in Weixin
City City set by the user in Weixin
Sex Gender of the user. 1: male; 2: female; 0:unknown.
Scene Scene of opening the product homepage. 1: by scanning code; 2: from other sources such as chats, Favorites, or Moments.
ExtInfo extinfo, an identification parameter for calling the "Get Product QR Code" API.

# Event of Following an Official Account

The event of following an Official Account from a product homepage will be pushed to the URL provided by the merchant, including the user's basic information, the following time and scene, and the code information.

Example of pushing XML

<xml>
  <ToUserName><![CDATA[gh_fbe8a958756e]]></ToUserName>
  <FromUserName><![CDATA[otAzGjrS4AYCmeJM1GhEOcHXXTAo]]></FromUserName>
  <CreateTime>1433259128</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[subscribe]]></Event>
  <EventKey><![CDATA[scene|keystandard|keystr|extinfo]></EventKey>
</xml>

Pushed Parameters

Parameter Description
ToUserName The original ID of the merchant's Official Account
FromUserName User's openid
CreateTime Message creation time (integer)
MsgType Message type (event)
Event Event type. "subscribe" represents an event of following an Official Account.
EventKey ①"scene" represents the scene. scanbarcode: scanning code; scanimage: scanning the cover image. ②"keystandard" represents the product's coding standard. barcode: barcode. ③"keystr" represents the product's code. ④"extinfo" is an identification parameter, which is passed when calling the "Get Product QR Code" API.

# Event of Entering an Official Account

The event of entering an Official Account from a product homepage will be pushed to the URL provided by the merchant, including the user's basic information, the following time and scene, and the code information.

Example of pushing XML

<xml>
  <ToUserName><![CDATA[gh_fbe8a958756e]]></ToUserName>
  <FromUserName><![CDATA[otAzGjrS4AYCmeJM1GhEOcHXXTAo]]></FromUserName>
  <CreateTime>1433259128</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[user_scan_product_enter_session]]></Event>
  <KeyStandard><![CDATA[ena13]]></KeyStandard>
  <KeyStr><![CDATA[6954767461373]]></KeyStr>
  <ExtInfo><![CDATA[]]></ExtInfo>
</xml>

Pushed Parameters

Parameter Description
ToUserName The original ID of the merchant's Official Account
FromUserName User's openid
CreateTime Message creation time (integer)
MsgType Message type (event)
Event Event type. "user_scan_product_enter_session" represents the event of entering an Official Account.
KeyStandard Product coding standard
KeyStr Product coding content
ExtInfo extinfo, an identification parameter for calling the "Get Product QR Code" API.

# Asynchronous Push for Location Information

When a user opens a product homepage, their real-time location information will be pushed to the URL provided by the merchant as an asynchronous event. By analyzing the location data, merchants can develop differentiated operation scheme and guide their production.

The location information is accurate to province, such as Guangdong. The response speed of the asynchronous push may be slow due to the user's network speed.

Example of pushing XML

<xml>
  <ToUserName><![CDATA[gh_fbe8a958756e]]></ToUserName>
  <FromUserName><![CDATA[otAzGjrS4AYCmeJM1GhEOcHXXTAo]]></FromUserName>
  <CreateTime>1434541327</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[user_scan_product_async]]></Event>
  <KeyStandard><![CDATA[qrcode]]></KeyStandard>
  <KeyStr><![CDATA[lincolntest2]]></KeyStr>
  <ExtInfo><![CDATA[123]]></ExtInfo>
  <RegionCode><![CDATA[440105]]></RegionCode>
</xml>

Pushed Parameters

Parameter Description
ToUserName The original ID of the merchant's Official Account
FromUserName User's openid
CreateTime Message creation time (integer)
MsgType Message type (event)
Event Event type. user_scan_product_async represents an asynchronous event.
KeyStandard Product coding standard
KeyStr Product coding content
ExtInfo extinfo, an identification parameter for calling the "Get Product QR Code" API.
RegionCode User's real-time location information (currently only accurate to province). For details, see the website of the National Bureau of Statistics: http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201504/t20150415_712722.html

# Push for Product Review Results

The review result of a product will be pushed to the URL provided by the merchant as an event.

Example of pushing XML

<xml>
 <ToUserName><![CDATA[gh_404e58ec528e]]></ToUserName>
 <FromUserName><![CDATA[od_ikt8qi21-hVTtYgm8xSfTLH5w]]></FromUserName>
 <CreateTime>1450429257</CreateTime>
 <MsgType><![CDATA[event]]></MsgType>
 <Event><![CDATA[user_scan_product_verify_action]]></Event>
 <KeyStandard><![CDATA[ean13]]></KeyStandard>
 <KeyStr><![CDATA[6901481811083]]></KeyStr>
 <Result><![CDATA[verify_ok]]></Result>
 <ReasonMsg><![CDATA[]]></ReasonMsg>
</xml>

Pushed Parameters

Parameter Description
ToUserName The original ID of the merchant's Official Account
FromUserName User's openid
CreateTime Message creation time (integer)
MsgType Message type (event)
Event Event type. "user_scan_product_verify_action" represents a review result event.
KeyStandard Product coding standard
KeyStr Product coding content
Result Review result. verify_ok: approved; verify_not_pass: rejected.
ReasonMsg Rejection reason