> For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt.

# sendSms

拉起系统短信发送面板。

## 扫码预览

![扫码预览 sendSms](https://api.qrserver.com/v1/create-qr-code/?size=200x200\&data=doubao%3A%2F%2Fdoubao_apps%3Fapp_id%3Ddb_1McM5Ni%26path%3D%252Fpages%252Fapi%252Fdevice%252Fsend-sms%252Findex)

## 使用限制

> \[!WARNING]
> **Android、iOS**：Android 通过 Intent 打开短信应用即成功，iOS 通过 MFMessageComposeViewController 呈现并在用户完成/取消后回调，成功时机不同；相同调用在双端"成功"代表的实际状态不同。

## 支持版本

前端库版本不低于 `0.0.25`。

## 支持平台

<table>
<thead>
<tr><th>平台</th><th>支持情况</th></tr>
</thead>
<tbody>
<tr><td>Android</td><td>支持</td></tr>
<tr><td>iOS</td><td>支持</td></tr>
<tr><td>PC</td><td>不支持</td></tr>
<tr><td>HarmonyOS</td><td>不支持</td></tr>
</tbody>
</table>

## 支持场景

<table>
<thead>
<tr><th>场景</th><th>支持情况</th></tr>
</thead>
<tbody>
<tr><td>页面</td><td>支持</td></tr>
<tr><td>卡片</td><td>支持</td></tr>
</tbody>
</table>

## 使用说明

- 该接口仅拉起系统短信面板，是否实际发送由用户在系统界面确认

## 调用方式

### 异步 API

```typescript
sendSms(params?: SendSmsParams): Promise<object>
```

## 入参

<table>
<thead>
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
</thead>
<tbody>
<tr><td><code>message</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>预填到发送短信面板的内容。</td></tr>
<tr><td><code>phoneNumber</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>预填到发送短信面板的手机号。</td></tr>
</tbody>
</table>

## 调用示例

```typescript
import { sendSms } from '@doubao-dev/framework/api';

await sendSms({
  phoneNumber: '10086',
  message: '查询话费'
});
```

## 成功返回

无返回字段。

### 返回示例

```json
{}
```

## 错误处理

错误对象和通用错误码见 [通用错误处理](/apps-plugin/docs/js-api/common-errors.md#错误返回)。

### 失败示例

```json
{
  "errNo": 114,
  "errMsg": "operation cancelled"
}
```

### 错误码

<table>
<thead>
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
</thead>
<tbody>
<tr><td><code>103</code></td><td><code>feature not support</code></td><td>iOS</td><td>当前设备不支持发送短信</td><td>在支持短信的设备上调用，或提前提示用户设备不支持短信。</td></tr>
<tr><td><code>114</code></td><td><code>operation cancelled</code></td><td>iOS</td><td>用户在系统短信面板中取消了发送</td><td>用户需要时可再次调用 `sendSms` 重新拉起短信面板。</td></tr>
</tbody>
</table>

#### 通用错误码

<table>
<thead>
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
</thead>
<tbody>
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
</tbody>
</table>

## 平台差异

- **iOS**：拉起短信面板后用户取消返回 114、发送失败返回 102、设备不支持短信返回 103；Android 无法拉起短信应用时返回 102。
