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

> 在 WhatsApp 消息模板质量评级更新时触发。

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

## 触发条件

在 WhatsApp 消息模板质量评级更新时触发。

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

## 语法

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

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

## 参数

在处理 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.quality_updated`。 |
| `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)。 |
| `qualityRating` | string | 否 | WhatsApp 模板的质量评级。取值为 `GREEN`、`YELLOW`、`RED` 或 `UNKNOWN` 之一。另请参见[模板质量评级](https://developers.facebook.com/docs/whatsapp/message-templates/guidelines/#quality-rating)。<ul><li>`GREEN`：高质量。</li><li>`YELLOW`：中等质量。</li><li>`RED`：低质量。</li><li>`UNKNOWN`：质量未知。</li></ul> |

## 示例

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_example_whatsapp_template_quality_updated",
  "type": "whatsapp.template.quality_updated",
  "apiVersion": "v2",
  "createTime": "2026-05-26T12:00:00.000Z",
  "whatsappTemplate": {
    "officialTemplateId": "official-template-id",
    "wabaId": "whatsapp-business-account-id",
    "name": "order_update",
    "language": "en_US",
    "qualityRating": "GREEN"
  }
}
```

在验证签名并成功持久化接收事件后，返回 `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.