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

> 在 WhatsApp flow 状态更新时触发。

使用 `whatsapp.flow.status_change` 在您的 webhook 终端节点处理此事件。

## 触发条件

在 WhatsApp flow 状态更新时触发。

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

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "type": "whatsapp.flow.status_change",
  "id": "<ID>",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "flowChanges": {
    "flowId": "<FLOW_ID>",
    "wabaId": "<WABA_ID>",
    "message": "<MESSAGE>",
    "oldStatus": "<OLD_STATUS>",
    "newStatus": "<NEW_STATUS>"
  }
}
```

## 参数

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

### 事件有效载荷

| 参数 | 类型 | 必需 | 描述 |
| - | - | - | - |
| `flowChanges` | object | 否 | 事件专用的 `flowChanges` 有效载荷。 |

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

#### flowChanges

| 参数 | 类型 | 必需 | 描述 |
| - | - | - | - |
| `flowId` | string | 是 | Flow 的唯一 ID。 |
| `wabaId` | string | 是 | WhatsApp 商业账户 ID。 |
| `message` | string | 否 | flow 状态变更的消息 ID。 |
| `oldStatus` | string | 否 | flow 的旧状态。 |
| `newStatus` | string | 是 | flow 的新状态。 |

## 示例

以下 JSON 是传递给您的接收端的主体。ID、电话号码和其他账户值仅作说明用途。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "type": "whatsapp.flow.status_change",
  "id": "evt_1234567890abcdef",
  "apiVersion": "v2",
  "createTime": "2025-09-11T07:24:52.000Z",
  "flowChanges": {
    "flowId": "1097420589034000",
    "wabaId": "123456789012345",
    "message": "Flow Webhook 3 changed status from DRAFT to PUBLISHED",
    "oldStatus": "DRAFT",
    "newStatus": "PUBLISHED"
  }
}
```

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


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