Skip to content

CheckWhatsapp#

Test Postman Apidog

The method checks WhatsApp account availability on a phone number.

Request#

To check WhatsApp account availability, you have to execute request at:

POST
{{apiUrl}}/waInstance{{idInstance}}/checkWhatsapp/{{apiTokenInstance}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
phoneNumber integer Yes Recipient's phone number in international format: 11 or 12 digits; Example: 11001234567 or 380123456789

Request body example#

{
    "phoneNumber": 11001234567
}

Response#

Response parameters#

Parameter Type Description
existsWhatsapp boolean Flag of WhatsApp availability on a phone number

Response body example#

{
    "existsWhatsapp": true
}

CheckWhatsapp errors#

For a list of errors common to all methods, refer to Common errors section

HTTP code Error identifier Description
400 Bad Request
Validation failed
Validation error
400 Validation failed.
Details: 'value' must have at least 1 key
Validation failed. Details: value must have at least 1 key
400 Validation failed.
Details: Wrong format. 'phoneNumber' must contain only digits
The number must contain only numbers.
400 bad phone number, valid 11 or 12 digits Invalid phone number format, must be 11 or 12 digits
400 check phone number timeout limit exceeded The timeout for a response to check a phone number has been exceeded

Request examples#

import requests
import json

url = "{{apiUrl}}/waInstance{{idInstance}}/checkWhatsapp/{{apiTokenInstance}}"

payload = json.dumps({ "phoneNumber": 441234567890 })
headers = {
  'Content-Type': 'application/json'
}

response = requests.post(url, json=payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/checkWhatsapp/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data '{
    "phoneNumber": 441234567890
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/checkWhatsapp/")
    .append({{apiTokenInstance}});

var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

var jsonBody = "{\"phoneNumber\": 441234567890}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/checkWhatsapp/")
    .append({{apiTokenInstance}});

var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\"phoneNumber\": 441234567890}")
    .asString();

System.out.println(response);
Sub CheckWhatsapp()
    Dim url As String
    Dim RequestBody As String
    Dim http As Object
    Dim response As String

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/CheckWhatsapp/{{apiTokenInstance}}"

    ' chatId - is the number to check whatsapp
    RequestBody = "{""phoneNumber"":""71234567890""}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    Range("A1").Value = response

    Set http = Nothing
End Sub