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

> 当 Meta 在 Utility Direct Send 中检测到非效用类内容时触发。通过 Webhook 端点 API 进行订阅。

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

## 触发条件

当 Meta 在 Utility Direct Send 中检测到非效用类内容时触发。通过 Webhook 端点 API 进行订阅。

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

通过 Webhook 端点 API 订阅此事件。该事件用于报告 Utility Direct Send 的类别检测；使用 `whatsapp.business_account.updated` 可监控账户限制。

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "whatsapp.template.correct_category_detection",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "whatsappTemplate": {
    "officialTemplateId": "<OFFICIAL_TEMPLATE_ID>",
    "wabaId": "<WABA_ID>",
    "name": "<NAME>",
    "language": "<LANGUAGE>",
    "category": "<CATEGORY>",
    "previousCategory": "<PREVIOUS_CATEGORY>"
  }
}
```

## 参数

在处理 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.template.correct_category_detection`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，格式为 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339)。例如：`2022-06-01T12:00:00.000Z`。 |

### 事件载荷

| 参数 | 类型 | 必需 | 说明 |
| - | - | - | - |
| `whatsappTemplate` | object | 否 | 特定于事件的 `whatsappTemplate` 载荷。 |

四个通用外层字段为必填项。载荷字段取决于事件变体。在每个对象表中， **必需** 仅在其父对象存在时适用。可选字段可以省略；示例中包含字段并不意味着它是必需字段。

#### whatsappTemplate

| 参数 | 类型 | 必需 | 说明 |
| - | - | - | - |
| `officialTemplateId` | string | 否 | 由 WhatsApp 分配的官方模板 ID。此 ID 用于在 WhatsApp 系统中识别该模板。 |
| `wabaId` | string | 是 | WhatsApp 商业账户 ID。 |
| `name` | string | 是 | 模板名称。最大长度：`512`。匹配规则：`[a-z0-9]{1,512}`。 |
| `language` | string | 是 | 模板的语言代码。所有代码请参见[支持的语言](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/supported-languages)。 |
| `category` | string | 否 | WhatsApp 消息模板的类别。<ul><li>`AUTHENTICATION`：使企业能够使用一次性密码对用户进行身份验证，可能涉及登录流程中的多个步骤（例如账户验证、账户恢复、完整性验证）。</li><li>`MARKETING`：包括促销或优惠、资讯更新，或邀请客户回应/采取行动。任何不符合效用或身份验证条件的对话均属于营销对话。</li><li>`UTILITY`：便于推进特定的、经同意的请求或交易，或向客户更新正在进行的交易状态，包括购买后通知和定期账单。</li></ul> |
| `previousCategory` | string | 否 | 该字段指示模板先前的类别（对于 2023 年 4 月 1 日之后新创建的模板，为 `null`）。将此值与模板的 `category` 字段值进行比较，后者表示模板当前的类别。 |

## 示例

以下 JSON 是发送到您的接收器的请求体。ID、电话号码和其他账户数值仅供参考。

Meta 在 Utility Direct Send 消息中检测到了营销内容。通过 Webhook 端点 API 订阅此事件。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_direct_send_category_123",
  "type": "whatsapp.template.correct_category_detection",
  "apiVersion": "v2",
  "createTime": "2026-09-17T08:00:00.000Z",
  "whatsappTemplate": {
    "officialTemplateId": "official-template-id",
    "wabaId": "whatsapp-business-account-id",
    "name": "auto_generated_sample",
    "language": "en_US",
    "category": "MARKETING",
    "previousCategory": "UTILITY"
  }
}
```

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


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