> ## 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.note.deleted

> 当联系人备注被单独删除时触发。删除联系人不会针对级联删除的备注触发此事件。

使用 `contact.note.deleted` 在您的 Webhook 端点处理此事件。

## 触发条件

当联系人备注被单独删除时触发。删除联系人不会针对级联删除的备注触发此事件。

在您[配置 Webhook 端点](https://docs.ycloud.com/zh/api-reference/guides/api-fundamentals/configure-webhooks.md)时订阅 `contact.note.deleted`。

删除联系人不会针对其级联删除的备注触发此事件。请将备注 `id` 与 `contactId` 分开处理。

## 语法

YCloud 会向您配置的 Webhook URL 发送一个 HTTP `POST` 请求。以下结构展示了一种载荷变体。尖括号中的值为占位符；其类型列在 **参数**下方。可选字段和其他变体详见下文。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "contact.note.deleted",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "contactNote": {
    "id": "<ID>",
    "contactId": "<CONTACT_ID>",
    "username": "<USERNAME>",
    "phoneNumber": "<PHONE_NUMBER>",
    "content": "<CONTENT>",
    "createTime": "<CREATE_TIME>",
    "updateTime": "<UPDATE_TIME>"
  }
}
```

## 参数

在处理 JSON 请求体之前，请先验证 `YCloud-Signature` HTTP 请求头。参见[签名验证](https://docs.ycloud.com/zh/api-reference/guides/api-fundamentals/configure-webhooks.md)。

### 事件外层封装

| 参数 | 类型 | 必填 | 描述 |
| - | - | - | - |
| `id` | string | 是 | 事件的唯一 ID。最小长度：`6`。最大长度：`128`。 |
| `type` | string | 是 | 固定为 `contact.note.deleted`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如 `2022-06-01T12:00:00.000Z`。 |

### 事件载荷

| 参数 | 类型 | 必填 | 描述 |
| - | - | - | - |
| `contactNote` | object | 否 | 特定于事件的 `contactNote` 载荷。 |

四个通用外层封装字段为必填项。载荷字段取决于事件变体。在每个对象表中， **必填** 在其父对象存在时适用。可选字段可以省略；示例中包含某个字段并不代表该字段为必填。

#### contactNote

| 参数 | 类型 | 必填 | 描述 |
| - | - | - | - |
| `id` | string | 是 | 备注的 ID。最小长度：`24`。最大长度：`24`。格式模式：`^[0-9a-fA-F]{24}$`。 |
| `contactId` | string | 是 | 拥有该备注的联系人的 ID。 |
| `username` | string or null | 是 | 拥有该备注的联系人的用户名，不含前导 `@`。 |
| `phoneNumber` | string or null | 是 | 拥有该备注的联系人的电话号码，采用 E.164 格式。 |
| `content` | string | 是 | 备注的文本内容。最大长度：`500`。 |
| `createTime` | string (date-time) | 否 | 备注创建的时间，采用 RFC 3339 格式。 |
| `updateTime` | string (date-time) | 否 | 备注最后更新的时间，采用 RFC 3339 格式。 |

## 示例

以下 JSON 为传送到接收方的请求体。ID、电话号码及其他账户取值仅供示意。

仅在单独删除备注时触发，联系人级联删除时不触发。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_3234567890abcdef12345678",
  "type": "contact.note.deleted",
  "apiVersion": "v2",
  "createTime": "2024-01-03T12:00:00.000Z",
  "contactNote": {
    "id": "6a3de646e18f344f743aaa4d",
    "contactId": "1824266594102064128",
    "username": "alice_01",
    "phoneNumber": "+12025550124",
    "content": "Customer now prefers afternoon follow-up.",
    "createTime": "2024-01-01T12:00:00.000Z",
    "updateTime": "2024-01-02T12:00:00.000Z"
  }
}
```

在验证签名并持久接收事件后，返回 `2xx` 响应。耗时任务请以异步方式处理。

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

有关场景演练，请参阅[带注释的示例](https://docs.ycloud.com/zh/api-reference/guides/examples/webhook-examples/contact-deleted-webhook-examples)。


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