> ## Documentation Index
> Fetch the complete documentation index at: https://help.texterchat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Labels Changed

> Fires whenever a chat's labels change, with the full diff

ubscribe to receive a notification whenever a chat's labels are updated. The payload includes the chat, the previous label set, and the diff (added and removed labels).

**Event name:** `chatLabelsUpdated`\\

**Required token scopes:**

* `Create scenarios`
* `Manage scenarios on behalf of user`

see [Authentication](/api-reference/authentication)

## Subscribe

Send the body below to [Import Subscription](/api-reference/subscribe-to-events/import-subscription-subscribe-to-an-event). You only need to change:

* **`url`** *(required)* - Located under `data.actions[0].params.url`. Replace `{{yourWebhookURL}}` with the destination URL that should receive the events.
* **`asStatus`** - Keep `"active"` to enable the subscription immediately, or `"inactive"` to save it as an inactive revision.

```json Import body [expandable]  theme={null}
{
  "data": {
    "version": "v1",
    "name": "(SUB) Chat Labels Updated",
    "description": "Sends a webhook when a chat's labels change, with the chat, previous labels, and the added/removed diff.",
    "triggerEvents": [
      "domain.chat.labels"
    ],
    "loaders": {},
    "conditions": [],
    "actions": [
      {
        "name": "request",
        "params": {
          "url": "{{yourWebhookURL}}",
          "method": "post",
          "json": true,
          "data": {
            "eventName": "chatLabelsUpdated",
            "eventData": {
              "chat": {
                "##provide": {
                  "provider": "chat",
                  "key": "chat"
                }
              },
              "oldLabels": {
                "##provide": {
                  "provider": "oldLabels",
                  "key": "labels"
                }
              },
              "addedLabels": {
                "##provide": {
                  "provider": "addedLabels",
                  "key": "labels"
                }
              },
              "removedLabels": {
                "##provide": {
                  "provider": "removedLabels",
                  "key": "labels"
                }
              }
            }
          }
        },
        "confidentialData": false
      }
    ],
    "options": {
      "unorderedActions": false
    }
  },
  "asStatus": "active"
}
```

<Note>
  A `201` response returns your new subscription - save its `_id` to manage it later. You can also add an optional `authorUid` root field (a Texter user UID) to attribute the subscription to a specific user.
</Note>

## Payload

When the event fires, your URL receives an HTTP `POST` with `eventName: "chatLabelsUpdated"` and the following `eventData`:

<ResponseField name="chat" type="Chat">
  The chat whose labels changed. `chat.labels` reflects the **new** label set. See the [Chat object](/api-reference/objects/chat) for all fields.
</ResponseField>

<ResponseField name="oldLabels" type="string[]">
  Label IDs that were on the chat **before** the change.
</ResponseField>

<ResponseField name="addedLabels" type="string[]">
  Label IDs that were just added.
</ResponseField>

<ResponseField name="removedLabels" type="string[]">
  Label IDs that were just removed.
</ResponseField>

```json Example payload  theme={null}
{
  "eventName": "chatLabelsUpdated",
  "eventData": {
    "chat": {
      "_id": "69062b15262e17ab3033f886",
      "displayName": "Tyler Joseph",
      "labels": [
        "urgent",
        "billing"
      ],
      "...": "..."
    },
    "oldLabels": [
      "urgent"
    ],
    "addedLabels": [
      "billing"
    ],
    "removedLabels": []
  }
}
```

## Manage this subscription

| Action             | Endpoint                                                                              |
| ------------------ | ------------------------------------------------------------------------------------- |
| List subscriptions | [List All Subscriptions](/api-reference/subscribe-to-events/list-all-subscriptions)   |
| Pause              | [Inactivate Subscription](/api-reference/subscribe-to-events/inactivate-subscription) |
| Resume             | [Activate Subscription](/api-reference/subscribe-to-events/activate-subscription)     |
| Delete             | [Delete Subscription](/api-reference/subscribe-to-events/delete-subscription)         |
| Debug executions   | [List Scenario Runs](/api-reference/scenarios-advanced/list-scenario-runs)            |
