# 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: [#mode-setting](https://support.whapi.cloud/help-desk/receiving/detailed-webhook-settings#mode-setting "mention")

### 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: [#webhook-events-and-update-types-post-put-patch-delete](https://support.whapi.cloud/help-desk/receiving/detailed-webhook-settings#webhook-events-and-update-types-post-put-patch-delete "mention")

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="incoming-message">{...}</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.
