Chat information
This command returns information about all active chats for the client. The response includes the contact list (including groups) and group participants with their permissions.
Request command
To retrieve chat info, send a POST request to:
https://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" : "79991112233@c.us",
"name" : "Vasily",
"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" : "79991112233@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" : "79156666555@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" : "79999999999@c.us",
"name" : "+7 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" : "79999999999@c.us",
"size" : 0,
"participants" : [
{
"id" : "79999999999@c.us",
"isAdmin" : true,
"isSuperAdmin" : false
},
{
"id" : "79991112233@c.us",
"isAdmin" : false,
"isSuperAdmin":false
}
]
}
}
]
}