API Description

When the user enters the Shake interface and shakes under the "Nearby" tab, Weixin will push the event to the URL entered by the developer (log in to the Official Accounts Platform and set in the Developer Center). The push content includes the device information corresponding to the page displayed by the "Nearby" tab when shaking, and the information of up to five devices belonging to the Official Account nearby. This event is not pushed when a list is displayed after shaking.

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.

Example of pushing an XML data packet

<xml> 
  <ToUserName><![CDATA[toUser]]></ToUserName>  
  <FromUserName><![CDATA[fromUser]]></FromUserName>  
  <CreateTime>1433332012</CreateTime>  
  <MsgType><![CDATA[event]]></MsgType>  
  <Event><![CDATA[ShakearoundUserShake]]></Event>  
  <ChosenBeacon> 
    <Uuid><![CDATA[uuid]]></Uuid>  
    <Major>major</Major>  
    <Minor>minor</Minor>  
    <Distance>0.057</Distance> 
  </ChosenBeacon>  
  <AroundBeacons> 
    <AroundBeacon> 
      <Uuid><![CDATA[uuid]]></Uuid>  
      <Major>major</Major>  
      <Minor>minor</Minor>  
      <Distance>166.816</Distance> 
    </AroundBeacon>  
    <AroundBeacon> 
      <Uuid><![CDATA[uuid]]></Uuid>  
      <Major>major</Major>  
      <Minor>minor</Minor>  
      <Distance>15.013</Distance> 
    </AroundBeacon> 
  </AroundBeacons> 
</xml>

Parameters

Parameter Description
ToUserName Developer's Weixin ID
FromUserName Users of Shake (an OpenID)
CreateTime Message creation time (integer)
MsgType Message type: event
Event Event type. ShakearoundUserShake
UUID, major, minor UUID, major, minor
Distance Distance between device and user (floating-point number, in meters)