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

# whatsapp.business_account.deleted

> 在 WhatsApp 商业账户被删除时触发。

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

## 触发条件

在 WhatsApp 商业账户被删除时触发。

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

使用 `whatsappBusinessAccount.id` 识别已移除的账户。移除相关字段为可选。请保留未知的 `removedReason` 和 `removedInitiatedBy` 值。`removedTime` 记录接收到删除事件的时间，而非确切的删除时间。

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "whatsapp.business_account.deleted",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "whatsappBusinessAccount": {
    "id": "<ID>",
    "name": "<NAME>",
    "removedReason": "<REMOVED_REASON>",
    "removedInitiatedBy": "<REMOVED_INITIATED_BY>",
    "removedTime": "<REMOVED_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 | 是 | 固定为 `whatsapp.business_account.deleted`。 |
| `apiVersion` | string | 是 | 用于渲染此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，按 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式化。例如：`2022-06-01T12:00:00.000Z`。 |

### 事件有效负载

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

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

#### whatsappBusinessAccount

| 参数 | 类型 | 必需 | 说明 |
| - | - | - | - |
| `id` | string | 否 | WhatsApp 商业账户 ID。 |
| `name` | string | 否 | 用于区分各 WhatsApp 商业账户的人性化名称。 |
| `removedReason` | string | 否 | 来自 WhatsApp 商业账户删除事件的原始原因。已知取值包括：<ul><li>`ACCOUNT_DISCONNECTED`：因违规执行措施或 WhatsApp 账户被明确删除而断开连接。</li><li>`BUSINESS_DOWNGRADE`：电话号码已注册到 WhatsApp 个人版应用。</li><li>`CHANGE_NUMBER`：WhatsApp 电话号码已变更。</li><li>`COMPANION_INACTIVITY`：配套设备已处于不活跃状态约 30 天。</li><li>`PRIMARY_INACTIVITY`：主设备已处于不活跃状态约 30 天。</li><li>`USER_RE_REGISTERED`：WhatsApp 已在新设备上重新注册。</li></ul>未知值将按原样返回。 |
| `removedInitiatedBy` | string | 否 | 来自 WhatsApp 商业账户删除事件的原始发起方。已知取值包括：<ul><li>`USER`：由 WhatsApp 用户发起移除。</li><li>`SYSTEM`：由 Meta 系统发起移除。</li></ul>未知值将按原样返回。 |
| `removedTime` | string (date-time) | 否 | 接收到 WhatsApp 商业账户删除事件的时间，按 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式化。例如：`2026-05-19T12:00:00.000Z`。 |

## 示例

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

读取 whatsappBusinessAccount.id 以识别该账户。存在时，removedReason、removedInitiatedBy 和 removedTime 会描述移除详情。请保留未知的 reason 和 initiator 值。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_business_account_deleted_123",
  "type": "whatsapp.business_account.deleted",
  "apiVersion": "v2",
  "createTime": "2026-05-26T12:00:00.000Z",
  "whatsappBusinessAccount": {
    "id": "whatsapp-business-account-id",
    "name": "Example business",
    "removedReason": "ACCOUNT_DISCONNECTED",
    "removedInitiatedBy": "USER",
    "removedTime": "2026-05-26T12: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/whatsapp-business-account-updated-webhook-examples)。


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