Skip to content

GetContactInfo#

Test Postman Apidog

The method is aimed for getting information on a contact.

Request#

To get contact information, you have to execute a request at:

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

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

Request parameters#

Parameter Type Mandatory Description
chatId string Yes Correspondent id

Request body example#

{
    "chatId": "71234567890@c.us"
}

Response#

Response parameters#

Parameter Type Description
avatar string Avatar url
name string Contact name
1) If there is incoming correspondence/reactions from the account, then we get the name from the WhatsApp profile
2) If there is no incoming correspondence/reactions from the account, then we get an empty line
contactName string Contact name from the phone book
1) If the number is saved in contacts, then we get the name from the contact book;
2) If the number is not saved in contact book or is deleted from it, then we get an empty line.
email string Contact e-mail
category string Business contact category
description string Business contact description
products object Contact products cards
chatId string Correspondent ID
lastSeen string Time of last online status
isArchive boolean Chat archiving status, accepts true/false values
isDisappearing boolean Disappearing chat status, true/false
isMute boolean Chat notification status, true/false
messageexpiration integer Time to live for chat messages, in seconds
muteexpiration integer Time after which chat notifications will be enabled
isBusiness boolean The flag that indicates whether the contact uses WhatsApp Business, accepts true/false values

products object parameters

Parameter Type Description
id string Prodict id
imageUrls object Product images urls
availability string Product availability
reviewStatus object Product review status
name string Product name
description string Product description
price string Product price
isHidden boolean Product condition

imageUrls object parameters

Parameter Type Description
requested string Link to the product image with a low resolution (preview)
original string Link to the product image with high resolution (original)

reviewStatus object parameters

Parameter Type Description
whatsapp string The product has been approved by WhatsApp

Response body example#

{
    "avatar": "https://pps.whatsapp.net/v/t61.24694-24/24_1349471992200940_2091838963901201896_n.jpg?ccb=11-4&oh=01_AVzZilQn10nj9M9cfQV4PW5dgdXOkiOuD_jCqP2MCXIpyA",
    "name": "Dealer",
    "contactName": "Dealer",
    "email": "24service@tt.tt",
    "category": "Automotive Dealership",
    "description": "Official service",
    "products": [
        {
            "id": "42079728159",
            "imageUrls": {
                "requested": "https://mmg.whatsapp.net/v/t45.5328-4/263329037_6625110154227932_2879714823340281709_n.jpg?stp=dst-jpg_p100x100&ccb=1-7&_nc_sid=c48759&_nc_ohc=NKICbZlqfPMAX9077mo&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVwYzx7CckCFf8F8xIIZ5m2AGdeC8YTnLyd29",
                "original": "https://mmg.whatsapp.net/v/t45.5328-4/263329037_6625110154227932_2879714823340281709_n.jpg?ccb=1-7&_nc_sid=c48759&_nc_ohc=NKICbZlqfPMAX9077mo&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVzn_O9azpKNRs1iPId0TQkGYk4D7HZFSQMeobvRiR"
            },
            "reviewStatus": {
                "whatsapp": "APPROVED"
            },
            "availability": "in stock",
            "name": "Replacement",
            "description": "From 1000 RUB",
            "price": null,
            "isHidden": false
        },
        {
            "id": "3545870328871389",
            "imageUrls": {
                "requested": "https://mmg.whatsapp.net/v/t45.5328-4/261250418_4513761695371199_1710541959703469822_n.jpg?stp=dst-jpg_p100x100&ccb=1-7&_nc_sid=c48759&_nc_ohc=eps8lAw2_3MAX_mWW8K&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVxT3HnbR04qKZJSOeK4d8p-noZokqly9QbpYFK-c_8kSA&oe",
                "original": "https://mmg.whatsapp.net/v/t45.5328-4/261250418_4513761695371199_1710541959703469822_n.jpg?ccb=1-7&_nc_sid=c48759&_nc_ohc=eps8lAw2_3MAX_mWW8K&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVx2wTCmzof0BoZDmIUpD328CtpJmlvEXGdVzew&o"
            },
            "reviewStatus": {
                "whatsapp": "APPROVED"
            },
            "availability": "in stock",
            "name": "Technical maintenance",
            "price": null,
            "isHidden": false
        }
    ],
    "chatId": "71234567890@c.us",
    "lastSeen": null,
    "isArchive": false,
    "isDisappearing": false,
    "isMute": false,
    "messageExpiration": 0,
    "muteExpiration": null,
    "isBusiness": true
}

GetContactInfo 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 Bad Request1
Validation failed.
Details: The method GetContactInfo does not support group chats, to work with groups, use the GetGroupData method
Empty request body

or incorrect chatId

or the method was used with the groupId
500 Internal Server Error
interface conversion: interface {} is bool, not string
Invalid data type specified for field chatId

Request examples#

import requests

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

payload = {"chatId": "71234567890@c.us"}
headers = {
  'Content-Type': 'application/json'
}


response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getContactInfo/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "71234567890@c.us"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getContactInfo/")
    .append({{apiTokenInstance}});

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

var jsonBody = "{\"chatId\": \"71234567890@c.us\"}";

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

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

var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\"chatId\": \"71234567890@c.us\"}")
    .asString();

System.out.println(response);
Sub GetContactInfo()
    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}}/GetContactInfo/{{apiTokenInstance}}"

    ' chatId - is the number to send the message to (@c.us for private chats, @g.us for group chats)
    RequestBody = "{""chatId"":""71234567890@c.us""}"

    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