Skip to main content

Get chat metada

Method#

/chat/{phone}#

GET https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/chats/{phone}

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

This method is responsible for returning the metadata of a chat.


Attributes#

Required#

AttributesTypeDescription
phonestringTelephone number in the format DDI DDD NUMERS Ex: 551199999999. IMPORTANT only send numbers without formatting or a mask

Optionals#

AttributesTypeDescription

Request Params#

URL example#

Method

GET https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/chat/5511999999999


Response#

200#

AttributesTypeDescription
phonestringContact’s phone
unreadstringIndicates the number of messages that haven’t been read in a chat
lastMessageTimestringTimestamp with date and time of your last interaction with that chat
isMutedstring0 or 1 indicates if you have silenced or not a certain chat
isMarkedSpambooleanTrue or false indicates if you have marked a chat as spam
profileThumbnailstringChat photo URL that Whatsapp deletes after 48h
messagesUnreadintegerdiscontinued
aboutstringProfile about

Example

{
"phone": "5511999999999",
"unread": "0",
"lastMessageTime": "1619461666",
"isMuted": "0",
"isMarkedSpam": "false",
"profileThumbnail": "https://pps.whatsapp.net/v/t61.24694-24/170931400_212202650511993_3423338295209291992_n.jpg?ccb=11-4&oh=4b96b3bf7114122667f80d021b194f2c&oe=60C179E2",
"messagesUnread": 0,
"about": "Profile about"
}

405#

In this case certify that you are sending the correct specification of the method. This means, verify if you sent a POST or GET as specified at the beginning of this topic.

415#

In case you receive 415 error, make sure to add the “Content-Type” of the object you are sending in the request headers, mostly “application/json”


Code#