Skip to main content

Request

Webhook authentication: Add authentication headers to the request. See Authentication.

Delivery result: To acknowledge successful delivery, your application server must respond with HTTP status code 200.

Delivery mechanism: Message delivery is attempted up to three times at 100 ms intervals. If all three attempts fail, the delivery is considered unsuccessful. Delivery uses Google's adaptive circuit breaker. If too many requests fail within a sliding time window, the circuit breaker is triggered and delivery to your application server is temporarily suspended.

Parameters

ParameterData TypeRequiredDescription
event_typestringYesEvent type. For online and offline status subscriptions, this value is online.
timestampint64YesEvent timestamp in milliseconds.
payloadarrayYesList of online and offline status events.
payload[].typeintYesOnline status. 1: online; 0: offline.
payload[].user_idstringYesUser ID.
payload[].device_idstringYesDevice ID.
payload[].platformstringYesValid values: iOS, Android, iPad, and web.
payload[].client_ipstringYesClient IP address.
payload[].session_idstringYesUnique identifier for the current persistent connection.
payload[].timestampint64YesOnline or offline event timestamp in milliseconds.
payload[].connection_extstringYesCustom data included when the connection was established.
payload[].instance_idstringNoInstance identifier used when multiple Web or PC instances are open. Mobile clients do not support multiple instances, so this field is empty for mobile connections.

Request Example

POST /onlinestatus/notification HTTP/1.1;
appkey: appkey;
signature: 2e639ae3600a4sdff61fb88b76f485b;
nonce: nonce;
timestamp: 1672568121910;
Content-Type: application/json;

{
"event_type": "online", //event type: message or online
"timestamp": 1713456000000, //timestamp in milliseconds
"payload": [
{
"type": 0, //1online; 0: offline
"user_id": "userid1", //user UID
"device_id": "1fsdf1", // device identifier
"platform": "web", //iOS,Android,iPad,web
"client_ip": "192.116.1.1",
"session_id": "123",//unique identifier for this persistent connection
"timestamp": 1713456000000,
"connection_ext":"ext",//custom extension supplied when connecting
"instance_id":"instance_id" //identifies an instance when multiple Web/PC instances are open. Mobile clients do not support multiple instances, so this field is empty
}
]
}