# wechat-mini-app

> 小程序客服消息node api

Latest version **1.0.0** (published 2019-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install wechat-mini-app
pnpm add wechat-mini-app
yarn add wechat-mini-app
bun add wechat-mini-app
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-18 |
| First published | 2019-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 85.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yangzhang |
| Maintainers | zhangjuntracy |
| Keywords | 小程序, 客服消息, 模板消息 |

## Links

- npm: https://www.npmjs.com/package/wechat-mini-app
- Repository: https://github.com/ZjBlog/wxapp-api
- Homepage: https://github.com/ZjBlog/wxapp-api#readme
- Issues: https://github.com/ZjBlog/wxapp-api/issues
- npm.io page: https://npm.io/package/wechat-mini-app

## Dependencies (4)

- [chai](https://npm.io/package/chai.md) ^4.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.5
- [urllib](https://npm.io/package/urllib.md) ^2.25.4
- [querystring](https://npm.io/package/querystring.md) ^0.2.0

## Recent versions

- 1.0.0 (latest) — 2019-01-18

## README

# wxapp-api
微信小程序node库


### quick start
```
npm install wxapp-api
var API = require('wxapp-api')
var api = new API(appid, secret)
api.sendMessage(openId, msgType, content, function(err, result){
  if(err) 
    console.log(err)
  doSomething...
})
```

如采用多节点分布式部署务必提供存取token的方法, token可以统一存在redis中
```
var API = require('wxapp-api')
var api = new API(appid, secret, getToken, saveToken)
var getToken = function(callback) {
    redis.get('APPID_KEY', function(err, reply){
    callback(reply)
  })
}
var saveToken = function(token, callback) {
  redis.set('APPID_KEY', token)
  callback(null)
}

api.sendText(openId, 'hello_world', function(err, result){

})
```

接口文档暂时没有来得及更新，接口调用方式比较简单，各位暂时先参考代码注释。

token维护部分代码参考自[wechat-api](https://github.com/node-webot/wechat-api)代码

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