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

# 联系人已删除 Webhook 示例

> 处理联系人删除事件。

<Note>有关基于 schema 生成的完整目录，请参阅[所有示例](/zh/api-reference/guides/examples/webhook-examples/webhook-payload-examples)。</Note>

## 功能简介

处理联系人删除事件。

## 准备工作

* 在您的应用程序中创建一个公开的 HTTPS 端点。
* 为您所需的事件类型配置 YCloud Webhook 端点。
* 安全存储端点签名密钥。
* 确保事件处理具备幂等性。

## 工作原理

事件发生时，YCloud 会发送 HTTP `POST` 请求。请验证签名、持久化记录该事件、返回 `2xx` 响应，并异步处理耗时任务。

## 请求

以下场景展示了发送到您的 Webhook URL 的请求。将事件 `id` 作为交付标识符，并使用 `type` 来路由载荷。

## 响应

接收事件后返回 `2xx` 状态。

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

<Note>有关端点设置、签名验证和重试机制，请参阅[配置 Webhook](/zh/api-reference/guides/api-fundamentals/configure-webhooks)。</Note>

前提条件

* Webhook 端点 URL 应由您的服务器提供，而非 YCloud。 **请务必将该 URL 替换为您实际的 Webhook 端点 URL。**
* **请确保您的 Webhook 端点正在监听相应的事件类型。** 另请参阅 [配置 Webhook](/zh/api-reference/guides/api-fundamentals/configure-webhooks)、[获取 Webhook 端点 API](/api-reference/webhook-endpoints/retrieve-a-webhook-endpoint)。

在删除联系人时触发。Webhook 载荷包含被删除联系人的最简信息。

## 联系人已删除基础示例

### 请求

```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": "+16315551111",
    "updateTime": "2024-01-01T12:00:00.000Z"
  }
}
```

### 响应

在持久化接收事件后进行交付确认。

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

### 说明

* **最简信息**：`contactDeleted` 对象仅包含基本信息：`id`、`nickName`、`phoneNumber` 和 `updateTime`。
* **Null 值**：如果联系人未设置昵称，则 `nickName` 字段可能为 `null`。
* **更新时间**：`updateTime` 反映了联系人在删除前的最后修改时间。
* **联系人 ID**：`id` 字段包含已删除联系人的唯一标识符，以供参考。
* **电话号码**：`phoneNumber` 始终存在并采用 E.164 格式。


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