Sync
This lets you look up whether a phone number is register on WhatsApp or not. This is handled asynchronously and a response of type SyncResult
is sent to your server.
Url
https://ongair.im/api/v1/search/sync
Method:
POST
Params:
Field | Type | Mandatory | Format | Meaning |
---|---|---|---|---|
phone_number | String | Yes | (country code)(phone number) e.g. 254722200200 | The contact phone number |
name | String | Yes | Utf8 only encoded strings | The contact name |
Batch:
You may also send this method in batch by providing an array of phone numbers (upto 10 per call).
Field | Type | Mandatory | Format | Meaning |
---|---|---|---|---|
phone_numbers[0] | String | Yes | (country code)(phone number) e.g. 254722200201 | The contact phone number |
phone_numbers[1] | String | Yes | (country code)(phone number) | The contact phone number |
Response:
The server responds with a JSON message:
{ "requested": true }
Error:
This occurs when the phone_number
parameteter is not included in the request
{ "error": "No phone number was provided" }
Callback:
This is a web hook posted to the client when the phone number look up returns a response. This callback is usually a second or two after the original call.
Field | Type | Value | Meaning |
---|---|---|---|
notification_type | String | SyncResult | The type of the notification |
registered | Array | ["254722123456", "254722123457"] | An array of numbers that were found to be registered on WhatsApp. |
unregistered | Array | ["254722123458", "254722123459"] | An array of numbers that were found not to be registered on WhatsApp. |