> ## 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

> Se produce cuando cambian los atributos de un contacto.

Usa `contact.attributes_changed` para gestionar este evento en tu endpoint de webhook.

## Desencadenadores

Se produce cuando cambian los atributos de un contacto.

Suscríbete a `contact.attributes_changed` cuando [configures tu endpoint de webhook](https://docs.ycloud.com/es/api-reference/guides/api-fundamentals/configure-webhooks.md).

## Sintaxis

YCloud envía una solicitud HTTP `POST` a tu URL de webhook configurada. La siguiente estructura muestra una variante de carga útil. Los valores entre corchetes angulares son marcadores de posición; sus tipos se indican en **Parámetros**. Los campos opcionales y otras variantes se describen a continuación.

```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>"
          }
        ]
      }
    }
  }
}
```

## Parámetros

Valida el encabezado HTTP `YCloud-Signature` antes de procesar el cuerpo JSON. Consulta la [validación de firmas](https://docs.ycloud.com/es/api-reference/guides/api-fundamentals/configure-webhooks.md).

### Envoltorio del evento

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `id` | string | Sí | ID único del evento. Longitud mínima: `6`. Longitud máxima: `128`. |
| `type` | string | Sí | Siempre `contact.attributes_changed`. |
| `apiVersion` | string | Sí | La versión de la API utilizada para procesar este evento. |
| `createTime` | string (date-time) | Sí | Fecha y hora en que se creó este evento, con formato [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). Por ejemplo, `2022-06-01T12:00:00.000Z`. |

### Carga útil del evento

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `contactAttributesChanged` | object | No | Carga útil de `contactAttributesChanged` específica del evento. |

Los cuatro campos comunes del envoltorio son obligatorios. Los campos de la carga útil dependen de la variante del evento. En cada tabla de objetos, **Obligatorio** aplica cuando su objeto superior está presente. Los campos opcionales se pueden omitir; el hecho de que aparezcan en un ejemplo no hace que un campo sea obligatorio.

#### contactAttributesChanged

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `id` | string | Sí | El ID del contacto cuyos atributos se cambiaron. |
| `updateTime` | string (date-time) | Sí | Fecha y hora en que se actualizaron los atributos del contacto, con formato [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). Por ejemplo, `2022-06-01T12:00:00.000Z`. |
| `changedAttributes` | object | Sí | Un objeto que contiene los atributos modificados. Cada clave representa el nombre del atributo modificado y el valor contiene el valor anterior, el nuevo valor y las acciones de cambio. Las claves usan los nombres del catálogo de atributos de contactos, incluidas claves del sistema como `remark_name`, `country_code` y `meta_username`. |

## Ejemplo

El siguiente JSON es el cuerpo entregado a tu receptor. Los ID, números de teléfono y otros valores de cuenta son solo ilustrativos.

> [accordion] Evento de cambio de atributos de contacto
>
> Ejemplo de carga útil cuando cambian los atributos de un contacto
>
> ```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] Ejemplo de cambio de etiquetas (Añadir etiquetas)
>
> ```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] Ejemplo de cambio de etiquetas (Eliminar etiquetas)
>
> ```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] Ejemplo de cambio
>
> ```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"
>           }
>         ]
>       }
>     }
>   }
> }
> ```

Tras verificar la firma y aceptar el evento de forma duradera, devuelve una respuesta `2xx`. Procesa las tareas lentas de forma asíncrona.

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

Para ver guías detalladas sobre escenarios, consulta los [ejemplos comentados](https://docs.ycloud.com/es/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.