Send messages after connecting to the Internet
Send a message after connecting to the Internet
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:
Parameter | Description |
---|---|
ToUserName | DeveloperWeChat ID |
FromUserName | Connected user account (an OpenID) |
CreateTime | Message creation time (integer) |
MsgType | Message type, event |
Event | Event type, WifiConnected (Wi-Fi connection successful) |
ConnectTime | Connection time (integer) |
ExpireTime | System reserved field, fixed value |
VendorId | System reserved field, fixed value |
ShopId | Store ID, that is, shop_id |
DeviceNo | The wireless mac address of the connected device, corresponding to bssid |