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

> 在联系人被删除时触发。

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

## 触发条件

在联系人被删除时触发。

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

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "contact.deleted",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "contactDeleted": {
    "id": "<ID>",
    "remarkName": "<REMARK_NAME>",
    "nickName": "<NICK_NAME>",
    "phoneNumber": "<PHONE_NUMBER>",
    "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.deleted`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如：`2022-06-01T12:00:00.000Z`。 |

### 事件有效负载

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `contactDeleted` | object | 否 | 特定于事件的 `contactDeleted` 有效负载。 |

四个通用信封字段为必填项。有效负载字段取决于具体的事件变体。在每个对象表中， **必填** 仅在其父对象存在时适用。可选字段可省略；示例中的字段并不代表其为必填项。

#### contactDeleted

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `id` | string | 是 | 联系人 ID |
| `remarkName` | string | 否 | 来自已删除联系人快照的企业自设备注名。 |
| `nickName` | string | 否 | 联系人的昵称。 |
| `phoneNumber` | string | 否 | 符合 [E.164](https://en.wikipedia.org/wiki/E.164) 格式的唯一电话号码。 |
| `updateTime` | string (date-time) | 否 | 联系人最后更新的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如：`2022-06-01T12:00:00.000Z`。 |

## 示例

以下 JSON 是传递给您的接收器的请求体。ID、电话号码和其他账户数值仅用于说明。

> [accordion] 联系人已删除事件
>
> 联系人被删除时的示例有效负载
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_3456789012",
>   "type": "contact.deleted",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactDeleted": {
>     "id": "1824266594102064128",
>     "remarkName": "Former customer",
>     "nickName": "John Doe",
>     "phoneNumber": "+12025550124",
>     "updateTime": "2024-01-01T12:00:00.000Z"
>   }
> }
> ```

> [accordion] 联系人已删除基础示例
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_3456789012",
>   "type": "contact.deleted",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactDeleted": {
>     "id": "1824266594102064128",
>     "nickName": "John Doe",
>     "phoneNumber": "+12025550124",
>     "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-deleted-webhook-examples)。


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