> ## 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.call.recording.updated

> 当源自 API 的 WhatsApp 通话录音变为可用或发生永久失败时触发。

在您的 Webhook 端点中使用 `whatsapp.call.recording.updated` 来处理此事件。

## 触发条件

当源自 API 的 WhatsApp 通话录音变为可用或发生永久失败时触发。

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

此事件报告源自 API 的通话媒体资产的终态。当 `status` 为 `AVAILABLE` 时，在通话媒体下载 API 中使用 `mediaAssetId`。当 `status` 为 `FAILED` 时，检查 `error`。

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "whatsapp.call.recording.updated",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "callingRecording": {
    "wacid": "<WACID>",
    "phoneId": "<PHONE_ID>",
    "mediaAssetId": "<MEDIA_ASSET_ID>",
    "status": "<STATUS>"
  }
}
```

## 参数

在处理 JSON 请求体之前验证 `YCloud-Signature` HTTP 请求头。参见[签名验证](https://docs.ycloud.com/zh/api-reference/guides/api-fundamentals/configure-webhooks.md)。

### 事件外层结构 (Envelope)

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `id` | string | 是 | 事件的唯一 ID。最小长度：`6`。最大长度：`128`。 |
| `type` | string | 是 | 始终为 `whatsapp.call.recording.updated`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如，`2022-06-01T12:00:00.000Z`。 |

### 事件载荷

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `callingRecording` | object | 否 | 事件专属的 `callingRecording` 载荷。 |

外层结构的四个通用字段是必填的。载荷字段取决于事件变体。在每个对象表格中， **必填** 适用于其父对象存在的情况。可选字段可以省略；示例不会使字段变为必填。

#### callingRecording

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `wacid` | string | 是 | WhatsApp 通话 ID。 |
| `phoneId` | string | 是 | 用于授权资产交付的 WhatsApp 商业电话号码 ID。 |
| `mediaAssetId` | string | 是 | 与通话媒体下载 API 配合使用的 YCloud 媒体资产 ID。 |
| `status` | string | 是 | 可选值：`AVAILABLE`、`FAILED`。 |
| `error` | object | 否 | 仅当 `status` 为 `FAILED` 时存在。 |

> [accordion] callingRecording.error
>
> | 参数 | 类型 | 必填 | 说明 |
> | - | - | - | - |
> | `code` | string | 是 | 固定错误码。 |
> | `retryable` | boolean | 是 | 重试上游媒体操作是否可能成功。 |

## 示例

以下 JSON 是发送至您接收端的消息体。ID、电话号码和其他账户数值仅供参考。

源自 API 的通话录音变为可用时的示例载荷

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_call_recording_01JZ8K4V7H3P6Q9R2T5W8X1Y4Z",
  "type": "whatsapp.call.recording.updated",
  "apiVersion": "v2",
  "createTime": "2026-08-04T08:00:00.000Z",
  "callingRecording": {
    "wacid": "wacid.HBgNNjI4MTM2MTkwNTEzMxUCABE",
    "phoneId": "461269257068832",
    "mediaAssetId": "66b1f0c2e4b05c2d8f1a3b47",
    "status": "AVAILABLE"
  }
}
```

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


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