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

# contact.attributes_changed

> Occurs when a contact's attributes are changed.

Use `contact.attributes_changed` to handle this event at your webhook endpoint.

## Triggers

Occurs when a contact's attributes are changed.

Subscribe to `contact.attributes_changed` when you [configure your webhook endpoint](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

## Syntax

YCloud sends an HTTP `POST` request to your configured webhook URL. The following shape shows one payload variant. Angle-bracket values are placeholders; their types are listed under **Parameters**. Optional fields and other variants are described below.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "contact.attributes_changed",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "contactAttributesChanged": {
    "id": "<ID>",
    "updateTime": "<UPDATE_TIME>",
    "changedAttributes": {
      "remark_name": {
        "oldValue": "<OLD_VALUE>",
        "newValue": "<NEW_VALUE>"
      },
      "email": {
        "oldValue": "<OLD_VALUE>",
        "newValue": "<NEW_VALUE>"
      },
      "tags": {
        "oldValue": [
          "<OLD_VALUE>"
        ],
        "newValue": [
          "<NEW_VALUE>"
        ],
        "extra": [
          {
            "action": "<ACTION>",
            "id": "<ID>",
            "value": "<VALUE>"
          }
        ]
      }
    }
  }
}
```

## Parameters

Validate the `YCloud-Signature` HTTP header before you process the JSON body. See [signature validation](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

### Event envelope

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Unique ID for the event. Minimum length: `6`. Maximum length: `128`. |
| `type` | string | Yes | Always `contact.attributes_changed`. |
| `apiVersion` | string | Yes | The API version used to render this event. |
| `createTime` | string (date-time) | Yes | The time at which this event was created, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |

### Event payload

| Parameter | Type | Required | Description |
| - | - | - | - |
| `contactAttributesChanged` | object | No | Event-specific `contactAttributesChanged` payload. |

The four common envelope fields are required. Payload fields depend on the event variant. In each object table, **Required** applies when its parent object is present. Optional fields can be omitted; a sample does not make a field required.

#### contactAttributesChanged

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | The ID of the contact whose attributes were changed. |
| `updateTime` | string (date-time) | Yes | The time at which the contact attributes were updated, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |
| `changedAttributes` | object | Yes | An object containing the changed attributes. Each key represents the name of the changed attribute, and the value contains the old value, new value, and change actions. Keys use the Contact attribute catalog names, including system keys such as `remark_name`, `country_code`, and `meta_username`. |

## Example

The following JSON is the body delivered to your receiver. IDs, phone numbers, and other account values are illustrative.

> [accordion] Contact attributes changed event
>
> Example payload when contact attributes are changed
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_1234567890",
>   "type": "contact.attributes_changed",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactAttributesChanged": {
>     "id": "1824266594102064128",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "changedAttributes": {
>       "remark_name": {
>         "oldValue": "Standard customer",
>         "newValue": "Priority customer"
>       },
>       "email": {
>         "oldValue": "john.doe@example.com",
>         "newValue": "johnny.doe@example.com"
>       },
>       "tags": {
>         "oldValue": [
>           "premium",
>           "newsletter"
>         ],
>         "newValue": [
>           "premium",
>           "newsletter",
>           "vip"
>         ],
>         "extra": [
>           {
>             "action": "ADDED",
>             "id": "686dd294334be8606a5bf312",
>             "value": "vip"
>           }
>         ]
>       }
>     }
>   }
> }
> ```

> [accordion] Tags Change Example (Add Tags)
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_1234567892",
>   "type": "contact.attributes_changed",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactAttributesChanged": {
>     "id": "1824266594102064128",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "changedAttributes": {
>       "tags": {
>         "oldValue": [
>           "premium",
>           "newsletter"
>         ],
>         "newValue": [
>           "premium",
>           "newsletter",
>           "vip"
>         ],
>         "extra": [
>           {
>             "action": "ADDED",
>             "id": "686dd294334be8606a5bf312",
>             "value": "vip"
>           }
>         ]
>       }
>     }
>   }
> }
> ```

> [accordion] Tags Change Example (Remove Tags)
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_1234567893",
>   "type": "contact.attributes_changed",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactAttributesChanged": {
>     "id": "1824266594102064128",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "changedAttributes": {
>       "tags": {
>         "oldValue": [
>           "premium",
>           "newsletter",
>           "vip"
>         ],
>         "newValue": [
>           "premium",
>           "newsletter"
>         ],
>         "extra": [
>           {
>             "action": "REMOVED",
>             "id": "686dd294334be8606a5bf312",
>             "value": "vip"
>           }
>         ]
>       }
>     }
>   }
> }
> ```

> [accordion] Change Example
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_1234567900",
>   "type": "contact.attributes_changed",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactAttributesChanged": {
>     "id": "1824266594102064128",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "changedAttributes": {
>       "waba_id": {
>         "oldValue": "waba_old_123456",
>         "newValue": "waba_new_789012",
>         "extra": [
>           {
>             "action": "CHANGED"
>           }
>         ]
>       }
>     }
>   }
> }
> ```

After verifying the signature and durably accepting the event, return a `2xx` response. Process slow work asynchronously.

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
```

For scenario walkthroughs, see [annotated examples](https://docs.ycloud.com/en/api-reference/guides/examples/webhook-examples/contact-attributes-changed-webhook-examples).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.