> For the complete documentation index, see [llms.txt](https://support.whapi.cloud/help-desk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.whapi.cloud/help-desk/receiving/webhooks/incoming-webhooks-format/chats.md).

# Chats

You can find more details about all parameters and their types in [the WebHook documentation](https://app.swaggerhub.com/apis-docs/HELLO_137/Whapi-Cloud-WhatsApp-API/1.8.5#/WebhookPayload).

The chats array contains all chats that were sent to the webhook URL. We mentioned more about the events here: [Detailed webhook settings](/help-desk/receiving/webhooks/detailed-webhook-settings.md#mode-setting)

### Created a new chat with an incoming message

Use the `chats.post` setting to get this webhook.

```
{
  "chats": [
    {
      "id": "919984351847@s.whatsapp.net",
      "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": "919984351847@s.whatsapp.net",
      "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": [
    "919984351847@s.whatsapp.net"
  ],
  "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: [Detailed webhook settings](/help-desk/receiving/webhooks/detailed-webhook-settings.md#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": "919984351847@s.whatsapp.net",
        "type": "contact",
        "timestamp": 1747059575,
        "name": "Jonathan",
        "mute_until": 18446744073709552000,
        "not_spam": true,
        "last_message": {
          "id": "yqJjeEsm3q7aMd8-gIcNRJKDPQ",
          ............................
          "from_name": "Whapi"
        }
      },
      "after_update": {
        "id": "919984351847@s.whatsapp.net",
        "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"
}
```

{% hint style="info" %}

#### 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.
{% endhint %}

### The disappearing message settings in chat have been changed

Use the `messages.post` setting to get this webhook.

<pre><code>{
  "messages": [
    {
      "id": "PrBhEFkXhz2gFVU-gNASij1GoQ",
      "from_me": false,
      "type": "action",
      "chat_id": "919984351847@s.whatsapp.net",
      "timestamp": 1747661045,
      "source": "system",
      "device_id": 20,
      "chat_name": "Jonathan",
      "action": {
        "type": "ephemeral",
        "<a data-footnote-ref href="#user-content-fn-1">ephemeral": 7776000</a>
      },
      "from": "919984351847",
      "from_name": "Jonathan"
    }
  ],
  "event": {
    "type": "messages",
    "event": "post"
  },
  "channel_id": "MANTIS-M72HC"
}
</code></pre>

***

### Format

<table data-header-hidden><thead><tr><th width="205"></th><th></th></tr></thead><tbody><tr><td>id*</td><td><p>ChatID <code>string</code><br>pattern: ^[\d-]{10,31}@[\w\.]{1,}$</p><p>Chat ID</p></td></tr><tr><td>name</td><td><p><code>string</code><br>example: Chat name</p><p>Chat name</p></td></tr><tr><td>type*</td><td><p><code>string</code><br>example: group</p><p>Chat type</p><p>Enum:<br>[ group, contact, broadcast, newsletter ]</p></td></tr><tr><td>timestamp</td><td><p><code>integer</code><br>example: 1675964377</p><p>Chat timestamp</p></td></tr><tr><td>chat_pic</td><td><p><code>string</code><br>example: https://example.com/photo.jpg</p><p>Chat picture URL</p></td></tr><tr><td>chat_pic_full</td><td><p><code>string</code><br>example: https://example.com/photo.jpg</p><p>Chat full picture URL</p></td></tr><tr><td>pin</td><td><p><code>boolean</code><br>example: true</p><p>Is chat pinned</p></td></tr><tr><td>mute</td><td><p><code>boolean</code><br>example: true</p><p>Is chat muted</p></td></tr><tr><td>mute_until</td><td><p><code>integer</code><br>example: 0</p><p>Chat mute until</p></td></tr><tr><td>archive</td><td><p><code>boolean</code><br>example: true</p><p>Is chat archived</p></td></tr><tr><td>unread</td><td><p><code>integer</code><br>example: 0</p><p>Unread messages count</p></td></tr><tr><td>unread_mention</td><td><p><code>boolean</code><br>example: false</p><p>Is chat unread mention</p></td></tr><tr><td>read_only</td><td><p><code>boolean</code><br>example: false</p><p>Is chat read only</p></td></tr><tr><td>not_spam</td><td><p><code>boolean</code><br>example: true</p><p>Is chat not spam</p></td></tr><tr><td>last_message</td><td>Message<a href="/pages/el5Wa9DJjRmvtzg8BM9H">{...}</a></td></tr><tr><td>labels</td><td></td></tr></tbody></table>

[^1]: The time specified in the settings is specified. If this option is not present, then the “disappearing messages” setting has been disabled.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://support.whapi.cloud/help-desk/receiving/webhooks/incoming-webhooks-format/chats.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
