Chats
Webhooks that Whapi.Cloud will generate regarding your chats.
You can find more details about all parameters and their types in the WebHook documentation.
The chats array contains all chats that were sent to the webhook URL. We mentioned more about the events here: Mode setting
Created a new chat with an incoming message
Use the chats.post
setting to get this webhook.
{
"chats": [
{
"id": "[email protected]",
"type": "contact",
"timestamp": 1747660332,
"unread": 1,
"not_spam": true
}
],
"event": {
"type": "chats",
"event": "post"
},
"channel_id": "MANTIS-M72HC"
}
Created a new chat with an outgoing message
Use the chats.post
setting to get this webhook.
{
"chats": [
{
"id": "[email protected]",
"type": "contact",
"timestamp": 1712995377,
"not_spam": true
}
],
"event": {
"type": "chats",
"event": "post"
},
"channel_id": "MANTIS-M72HC"
}
The chat has been deleted
Use the chats.delete
setting to get this webhook.
{
"chats_removed": [
"[email protected]"
],
"event": {
"type": "chats",
"event": "delete"
},
"channel_id": "MANTIS-M72HC"
}
Chat changes: label installed/removed, chat set to mute/unmute
Use the chats.patch
setting to get this webhook. Note that chats.patch sends notifications putting in the callback information that was there before the entity was updated and after the entity was updated, showing the difference and what has changed. We have described this in more detail here: Webhook Events and Update Types (POST / PUT / PATCH / DELETE)
Pay attention to the information that has been updated in the changes
array.
{
"chats_updates": [
{
"before_update": {
"id": "[email protected]",
"type": "contact",
"timestamp": 1747059575,
"name": "Jonathan",
"mute_until": 18446744073709552000,
"not_spam": true,
"last_message": {
"id": "yqJjeEsm3q7aMd8-gIcNRJKDPQ",
............................
"from_name": "Whapi"
}
},
"after_update": {
"id": "[email protected]",
"type": "contact",
"timestamp": 1747059575,
"name": "Jonathan",
"mute": true,
"mute_until": 18446744073709552000,
"not_spam": true,
"last_message": {
"id": "yqJjeEsm3q7aMd8-gIcNRJKDPQ",
............................
"from_name": "Whapi"
}
},
"labels": [
{
"id": "3",
"name": "Pending payment",
"color": "salmon"
}
]
},
"changes": [
"last_message",
"labels",
"mute",
"mute_until"
]
}
],
"event": {
"type": "chats",
"event": "patch"
},
"channel_id": "MANTIS-M72HC"
}
Some nuances and peculiarities
To track which label is set on a chat, simply enable the chats.patch
webhook. It includes the current label in the payload whenever the chat is updated. This is the easiest way to get label info without making an HTTP API request.
To track group name or icon changes, enable the groups.patch
webhook.
The disappearing message settings in chat have been changed
Use the messages.post
setting to get this webhook.
{
"messages": [
{
"id": "PrBhEFkXhz2gFVU-gNASij1GoQ",
"from_me": false,
"type": "action",
"chat_id": "[email protected]",
"timestamp": 1747661045,
"source": "system",
"device_id": 20,
"chat_name": "Jonathan",
"action": {
"type": "ephemeral",
"
},
"from": "919984351847",
"from_name": "Jonathan"
}
],
"event": {
"type": "messages",
"event": "post"
},
"channel_id": "MANTIS-M72HC"
}
Format
id*
ChatID string
pattern: ^[\d-]{10,31}@[\w\.]{1,}$
Chat ID
name
string
example: Chat name
Chat name
type*
string
example: group
Chat type
Enum: [ group, contact, broadcast, newsletter ]
timestamp
integer
example: 1675964377
Chat timestamp
chat_pic
string
example: https://example.com/photo.jpg
Chat picture URL
chat_pic_full
string
example: https://example.com/photo.jpg
Chat full picture URL
pin
boolean
example: true
Is chat pinned
mute
boolean
example: true
Is chat muted
mute_until
integer
example: 0
Chat mute until
archive
boolean
example: true
Is chat archived
unread
integer
example: 0
Unread messages count
unread_mention
boolean
example: false
Is chat unread mention
read_only
boolean
example: false
Is chat read only
not_spam
boolean
example: true
Is chat not spam
last_message
Message{...}
labels
Last updated
Was this helpful?