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

# sms.inbound.received

> 在收到 SMS 入站消息时触发，这意味着用户回复了您的消息。

在您的 Webhook 端点使用 `sms.inbound.received` 处理此事件。

## 触发条件

在收到 SMS 入站消息时触发，这意味着用户回复了您的消息。

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

## 语法

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "sms.inbound.received",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "smsInbound": {
    "id": "<ID>",
    "from": "<FROM>",
    "to": "<TO>",
    "text": "<TEXT>",
    "sendTime": "<SEND_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 | 是 | 固定为 `sms.inbound.received`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 创建此事件的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如 `2022-06-01T12:00:00.000Z`。 |

### 事件有效载荷

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `smsInbound` | object | 否 | 特定于事件的 `smsInbound` 有效载荷。 |

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

#### smsInbound

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `id` | string | 否 | 消息的唯一 ID。 |
| `from` | string | 否 | 向您已注册的 Sender ID 发送消息的用户电话号码，采用 [E.164](https://en.wikipedia.org/wiki/E.164) 格式。 |
| `to` | string | 否 | 接收者的电话号码，即您已注册的 Sender ID 之一。 |
| `text` | string | 否 | 此消息的文本内容。 |
| `sendTime` | string (date-time) | 否 | 发送此消息的时间，采用 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) 格式。例如 `2022-06-01T12:00:00.000Z`。 |

## 示例

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_example_sms_inbound_received",
  "type": "sms.inbound.received",
  "apiVersion": "v2",
  "createTime": "2026-05-26T12:00:00.000Z",
  "smsInbound": {
    "id": "sms_inbound_12345678",
    "from": "+12025550124",
    "to": "+12025550123",
    "text": "Please send the order details.",
    "sendTime": "2026-05-26T11:59: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-inbound-message-webhook-examples)。


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