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

> 在创建联系人备注时发生。

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

## 触发条件

在创建联系人备注时发生。

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

请将备注 `id` 与 `contactId` 区分开。`username` 和 `phoneNumber` 可以为 null。

## 语法

YCloud 会向您配置的 Webhook URL 发送 HTTP `POST` 请求。以下结构显示了一个有效负载变体。尖括号中的值为占位符；其类型列在 **参数**下。可选字段和其他变体如下所述。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "contact.note.created",
  "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)。

### 事件外层结构 (Event envelope)

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

### 事件有效负载 (Event payload)

| 参数 | 类型 | 是否必填 | 说明 |
| - | - | - | - |
| `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_1234567890abcdef12345678",
  "type": "contact.note.created",
  "apiVersion": "v2",
  "createTime": "2024-01-01T12:00:00.000Z",
  "contactNote": {
    "id": "6a3de646e18f344f743aaa4d",
    "contactId": "1824266594102064128",
    "username": "alice_01",
    "phoneNumber": "+12025550124",
    "content": "Customer prefers follow-up in the morning.",
    "createTime": "2024-01-01T12:00:00.000Z",
    "updateTime": "2024-01-01T12: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-created-webhook-examples)。


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