Chat information
Returns active chats for the connected WhatsApp account, including contacts, groups, and group participants with their roles.
Request command
To retrieve chat info, send a POST request to:
https://app.whatsgate.org/api/v1/get-chats
Request body object
The request body must contain:
{
"WhatsappID": "YOUR_WHATSAPP_ID"
}
- WhatsappID - WhatsApp identifier in the system
Response object
Successful response object
{
"result": "OK",
"data": [
{ ... CHAT_CONTACT_OBJECT ... }
...
]
}
data - contains an array of chat contact objects or chat group objects
Chat contact object
{
"id" : "19991112233@c.us",
"name" : "John",
"isGroup" : false,
"isReadOnly" : false,
"unreadCount" : 0,
"timestamp" : 1662710454,
"pinned" : false,
"isMuted" : false,
"muteExpiration" : 0
}
- id - contact identifier
- name - contact name
- isGroup - whether this is a group; false for contacts
- isReadOnly - whether sending messages to this recipient is blocked; true = blocked, false = allowed
- unreadCount - number of unread messages in this chat
- timestamp - time of last activity in Unix timestamp format
- pinned - whether the chat is pinned; true = yes, false = no
- isMuted - whether notifications are muted for this chat; true = muted, false = enabled
- muteExpiration - number of seconds until notifications are enabled again (if muted)
Chat group object
{
"id" : "4239048293082@g.us",
"name" : "Test group",
"isGroup" : true,
"isReadOnly" : false,
"unreadCount" : 0,
"timestamp" : 1662616476,
"pinned" : false,
"isMuted" : false,
"muteExpiration" : 0
"groupMetadata" : {... GROUP_METADATA_OBJECT ...}
}
- id - group identifier
- name - group name
- isGroup - whether this is a group; true for groups
- isReadOnly - whether sending messages to this group is blocked; true = blocked, false = allowed
- unreadCount - number of unread messages in this group
- timestamp - time of last activity in Unix timestamp format
- pinned - whether the group is pinned; true = yes, false = no
- isMuted - whether notifications are muted for this group; true = muted, false = enabled
- muteExpiration - number of seconds until notifications are enabled again (if muted)
- groupMetadata - group metadata object
Group metadata object
{
"id" : "4239048293082@g.us",
"creation" : 1658328976,
"owner" : "19991112233@c.us",
"size" : 3,
"participants" : [
{ ... PARTICIPANT_OBJECT ...}
...
]
}
- id - group identifier
- creation - group creation date in Unix timestamp format
- owner - group owner identifier
- size - number of group participants
- participants - array of participant objects
Group participant object
{
"id" : "19156666555@c.us",
"isAdmin" : true,
"isSuperAdmin" : false
}
- id - participant contact identifier
- isAdmin - whether this contact is a group admin; true = yes, false = no
- isSuperAdmin - whether this contact is a super admin; true = yes, false = no
Full response example
{
"result":"OK",
"data" : [
{
"id" : "19999999999@c.us",
"name" : "+1 999 999-99-99",
"isGroup" : false,
"isReadOnly" : false,
"unreadCount" : 0,
"timestamp" : 1662710454,
"pinned" : false,
"isMuted" : false,
"muteExpiration" : 0
},
{
"id" : "4239048293082@g.us",
"name" : "Test group",
"isGroup" : true,
"isReadOnly" : false,
"unreadCount" : 0,
"timestamp" : 1662616476,
"pinned" : false,
"isMuted" : false,
"muteExpiration" : 0,
"groupMetadata" : {
"id" : "4239048293082@g.us",
"creation" : 1658328976,
"owner" : "19999999999@c.us",
"size" : 0,
"participants" : [
{
"id" : "19999999999@c.us",
"isAdmin" : true,
"isSuperAdmin" : false
},
{
"id" : "19991112233@c.us",
"isAdmin" : false,
"isSuperAdmin":false
}
]
}
}
]
}