CheckWhatsapp#
The method checks WhatsApp account availability on a phone number.
Request#
To check WhatsApp account availability, you have to execute request at:
POST https://api.green-api.com/waInstance{{idInstance}}/checkWhatsapp/{{apiTokenInstance}}
For 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 Id | Description |
---|---|---|
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 |
Python request example#
import requests
import json
url = "https://api.green-api.com/waInstance{{idInstance}}/checkWhatsapp/{{apiTokenInstance}}"
payload = json.dumps({ "phoneNumber": 79876716790 })
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))