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

> 当联系人恢复订阅消息时触发。

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

## 触发条件

当联系人恢复订阅消息时触发。

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

## 语法

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

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

### 事件有效负载

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

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

#### unsubscriberChanged

| 参数 | 类型 | 是否必填 | 说明 |
| - | - | - | - |
| `id` | string | 否 | 订阅变更时提供的标识符（若有）。 |
| `phoneNumber` | string | 否 | E.164 格式的客户电话号码。 |
| `source` | string | 否 | 订阅变更的来源。已知值包括 `Whatsapp`、`Inbox`、`Chatbot`、`API`、`Manual` 和 `Unknown`。保留未识别的值。 |
| `updateTime` | string (date-time) | 否 | 订阅变更的时间，格式为 RFC 3339。 |

## 示例

以下 JSON 是发送给接收端的主体。ID、电话号码和其他账户值仅用于说明。

> [accordion] 客户恢复订阅
>
> 客户恢复订阅时的示例有效负载
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_3456789012",
>   "type": "contact.unsubscribe.deleted",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "unsubscriberChanged": {
>     "phoneNumber": "+12025550124",
>     "source": "Whatsapp",
>     "updateTime": "2024-01-01T12:00:00.000Z"
>   }
> }
> ```

> [accordion] 联系人退订删除示例
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_68f8886903683f3481f9707b",
>   "type": "contact.unsubscribe.deleted",
>   "apiVersion": "v2",
>   "createTime": "2025-10-22T07:31:53.872Z",
>   "unsubscriberChanged": {
>     "id": "68f888692abba5779b565928",
>     "phoneNumber": "+12025550124",
>     "source": "API",
>     "updateTime": "2025-10-22T07:31:53.864Z"
>   }
> }
> ```

在验证签名并持久接收该事件后，返回 `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-unsubscribe-deleted-webhook-examples)。


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