# @bandwidth/messaging 中文文档

规范地址：https://npmcn.com/package/%40bandwidth/messaging/

版本：4\.1\.7
npm 元数据更新时间：2024-09-18T17:43:18.229Z
中文译文更新时间：2026-11-07T16:18:26.286Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40bandwidth/messaging
原文对照：https://npmcn.com/package/%40bandwidth/messaging/?lang=original

弃用说明：Package no longer supported\. Contact Support at https://www\.npmjs\.com/support for more info\.

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：561 kB，90 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=10
- 运行依赖：7 个
- 首次发布：2019-12-12T19:23:09.973Z
- 最新版本发布：2024-08-27T19:06:13.403Z
- 近 30 天下载量：119541（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：24（近 12 个月 0 个）

## 中文简介

Bandwidth 的 HTTP 通讯平台

## 安装

```sh
npm install @bandwidth/messaging
```

也可以使用：`pnpm add @bandwidth/messaging`、`yarn add @bandwidth/messaging`、`bun add @bandwidth/messaging`

## README

# 带宽节点发送 SDK

[![Test](https://github.com/Bandwidth/node-messaging/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/node-messaging/actions/workflows/test.yml)

| **监督办** | **节点** |
| :-: | :-: |
| 视窗 2016 | 第12、14、16条 |
| Windows 2019 (英语) | 第12、14、16条 |
| 乌邦图 20.04 | 第12、14、16条 |
| 乌邦图22.04 | 第12、14、16条 |

注:截至3.0.0版本,此软件包已升级为TypeScript

## 开始

### 安装

```
npm install @bandwidth/messaging
```

### 初始化

```js
import { Client, ApiController, MessageRequest } from '@bandwidth/messaging';
const client = new Client({
    basicAuthUserName: "username",
    basicAuthPassword: "password"
});

const controller = new ApiController(client);
const accountId = "12345";
```

### 发送文本消息

```js
const applicationId = "3-a-b-c";
const toPhoneNumber = "+15554443333";
const fromPhoneNumber = "+15553334444";
const text = "Hello world";
const body = {
    applicationId: applicationId,
    to: [toPhoneNumber],
    from: fromPhoneNumber,
    text: text 
};

const createMessageResponse = await controller.createMessage(accountId, body);
console.log(createMessageResponse.result.id);
```

## 支持的节点版本

此软件包可用节点 QQ 10

## 文档

此软件包的文档可见于 [https://dev.bandwidth.com/sdks/node.html (中文(简体) )](https://dev.bandwidth.com/sdks/node.html)

## 全权证书

此套件的全权证书资料可在 [https://dev.bandwidth.com/guides/accountCrediences.html (中文(简体) )](https://dev.bandwidth.com/guides/accountCredentials.html)

## 常见问题

### @bandwidth/messaging 是什么？

Bandwidth 的 HTTP 通讯平台注意：该包已被作者标记为弃用——Package no longer supported\. Contact Support at https://www\.npmjs\.com/support for more info\.

### 如何安装 @bandwidth/messaging？

在项目目录运行 npm install @bandwidth/messaging，或使用 pnpm add / yarn add / bun add。

### @bandwidth/messaging 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @bandwidth/messaging 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @bandwidth/messaging 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=10。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @bandwidth/messaging 可以商用吗？

@bandwidth/messaging 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @bandwidth/messaging 的下载量有多少？

根据 npm 官方下载统计，@bandwidth/messaging 在 2026/10/08 – 2026/11/06 这 30 天内被下载 119,541 次，日均约 3,985 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @bandwidth/messaging 还在维护吗？

最新版本 4\.1\.7 发布于 2024/08/28（2 年前）；至今共发布 24 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/12/13。作者已将其标记为弃用，新项目建议寻找替代方案。

