# @alicloud/mns

> > 该 SDK 并未完全实现所有文档所提及的功能，如果您想使用的功能并未实现，请提[issue](https://github.com/aliyun/aliyun-mns-nodejs-sdk/issues/new)以增加优先级。

Latest version **1.2.0** (published 2026-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alicloud/mns
pnpm add @alicloud/mns
yarn add @alicloud/mns
bun add @alicloud/mns
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-02-05 |
| First published | 2017-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 50.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Jackson Tian |
| Maintainers | jacksontian, fengmk2, pagecao, aliyunsdkteam, console-fe |
| Keywords | MNS, Message, Service, Aliyun, Alicloud |

## Links

- npm: https://www.npmjs.com/package/@alicloud/mns
- Repository: https://github.com/aliyun/mns-nodejs-sdk
- Homepage: https://github.com/aliyun/mns-nodejs-sdk#readme
- Issues: https://github.com/aliyun/mns-nodejs-sdk/issues
- npm.io page: https://npm.io/package/@alicloud/mns

## Dependencies (4)

- [kitx](https://npm.io/package/kitx.md) ^1.2.0
- [debug](https://npm.io/package/debug.md) ^2.6.3
- [httpx](https://npm.io/package/httpx.md) ^2.1.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.17

## Recent versions

- 1.2.0 (latest) — 2026-02-05
- 1.1.0 — 2025-11-27
- 1.0.0 — 2018-11-03
- 1.0.0-beta8 — 2018-04-20
- 1.0.0-beta7 — 2018-03-07
- 1.0.0-beta6 — 2018-01-31
- 1.0.0-beta5 — 2017-08-01
- 1.0.0-beta4 — 2017-07-17
- 1.0.0-beta3 — 2017-07-12
- 1.0.0-beta2 — 2017-05-11
- 1.0.0-beta — 2017-04-11

## README

# mns-nodejs-sdk

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![coverage][cov-image]][cov-url]

[npm-image]: https://img.shields.io/npm/v/@alicloud/mns.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@alicloud/mns
[travis-image]: https://img.shields.io/travis/aliyun/mns-nodejs-sdk/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/aliyun/mns-nodejs-sdk.svg?branch=master
[cov-image]: https://coveralls.io/repos/aliyun/mns-nodejs-sdk/badge.svg?branch=master&service=github
[cov-url]: https://coveralls.io/github/aliyun/mns-nodejs-sdk?branch=master

Documents: http://doxmate.cool/aliyun/mns-nodejs-sdk/api.html


> 该 SDK 并未完全实现所有文档所提及的功能，如果您想使用的功能并未实现，请提[issue](https://github.com/aliyun/mns-nodejs-sdk/issues/new)以增加优先级。

## Installation

```bash
npm install @alicloud/mns --save
```

## API Spec

See: https://help.aliyun.com/document_detail/27475.html

## Test

```sh
ACCOUNT_ID=<ACCOUNT_ID> ACCESS_KEY_ID=<ACCESS_KEY_ID> ACCESS_KEY_SECRET=<ACCESS_KEY_SECRET> make test
```

## Installation

You can install it via npm/cnpm/yarn.

```sh
$ npm install @alicloud/mns --save
```

## Usage

```js
const MNSClient = require('@alicloud/mns');

const accountid = '<account id>';
var client = new MNSClient(accountid, {
  region: '<region>',
  accessKeyId: '<access key id>',
  accessKeySecret: '<access key secret>',
  // optional & default
  secure: false, // use https or http
  internal: false, // use internal endpoint
  vpc: false // use vpc endpoint
});

(async function () {
  let res;
  // create queue
  res = await client.createQueue('test-queue2');
  console.log(res);
  // list queue
  res = await client.listQueue();
  console.log(JSON.stringify(res, null, 2));
  // create topic
  res = await client.createTopic('test-topic');
  console.log(res);
  // get topic attributes
  res = await client.getTopicAttributes('test-topic');
  console.log(res);
  // publish message
  res = await client.publishMessage('<topic name>', {
    MessageBody: 'content',
    MessageAttributes: {
      DirectSMS: JSON.stringify({
        FreeSignName: '',
        TemplateCode: '<template code>',
        Type: '<type>',
        Receiver: '<phone number>',
        SmsParams: JSON.stringify({
          code: '<code>',
          product: '<product>'
        })
      })
    }
  });
  console.log(res);
})().then((data) => {
  console.log(data);
}, (err) => {
  console.log(err.stack);
});
```

## License

The [MIT](LICENSE) License

---
_Source: https://npm.io/package/@alicloud/mns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
