Send messages after connecting to the Internet


Send a message after connecting to the Internet

1475897085954260.png

After a customer arrives at the store and connects to Wi-Fi, a successful event push will be triggered. After developers receive this event, they can call the "customer service interface" to send messages to connected users through official accounts, including text, coupons, etc.


This event will be sent to the URL filled in by the developer (log in to the public platform and enter the developer center settings).

If the WeChat server does not receive a response within five seconds, it will disconnect the connection and re-initiate the request. A total of three retries

About retry message re-arranging, It is recommended to use FromUserName CreateTime to eliminate duplication.

If the server cannot guarantee to process and reply within five seconds, you can directly reply with an empty string. The WeChat server will not do anything with this and will not initiate a retry.

Push XML packet example:

<xml> 
<ToUserName><![CDATA[toUser]]></ToUserName> 
<FromUserName><![CDATA[FromUser]]></FromUserName> 
<CreateTime>123456789</CreateTime> 
<MsgType><![CDATA[event]]></MsgType> 
<Event><![CDATA[WifiConnected]]></Event> 
<ConnectTime>0</ConnectTime>
<ExpireTime>0</ExpireTime>
<VendorId>![CDATA[3001224419]]</VendorId>
<ShopId>![CDATA[PlaceId]]</ShopId>
<DeviceNo>![CDATA[DeviceNo]]</DeviceNo>
</xml>


Parameter description:

ParameterDescription
ToUserNameDeveloperWeChat ID
FromUserNameConnected user account (an OpenID)
CreateTimeMessage creation time (integer)
MsgTypeMessage type, event
EventEvent type, WifiConnected (Wi-Fi connection successful)
ConnectTimeConnection time (integer)
ExpireTimeSystem reserved field, fixed value
VendorIdSystem reserved field, fixed value
ShopIdStore ID, that is, shop_id
DeviceNoThe wireless mac address of the connected device, corresponding to bssid