# wechat-message-client

> wechat client message send module

Latest version **0.0.1** (published 2016-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install wechat-message-client
pnpm add wechat-message-client
yarn add wechat-message-client
bun add wechat-message-client
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-02-06 |
| First published | 2016-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | mengkeys |
| Maintainers | mengkeys |
| Keywords | wechat, node-wechat, weixin, node-weixin, wechat-message, weixin-message |

## Links

- npm: https://www.npmjs.com/package/wechat-message-client
- Repository: https://github.com/mengkeys/wechat-message-client
- Homepage: https://github.com/mengkeys/wechat-message-client#readme
- Issues: https://github.com/mengkeys/wechat-message-client/issues
- npm.io page: https://npm.io/package/wechat-message-client

## Dependencies (2)

- [urllib](https://npm.io/package/urllib.md) ^2.7.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.16

## Recent versions

- 0.0.1 (latest) — 2016-02-06

## README

# wechat-message-client
wechat client message send module

#### Install

```javascript
npm i wechat-message-client --save-dev

```

#### Token Verify

```javascript

var token = "TOKEN";
var remote = {
    protocol:'http',
    slashes:true,
    hostname:'localhost',
    port:3080
};

var wmc = require('wechat-message-client');

var client = wmc(token, remote);

client.checkSignature(function(err, data, res){
    if(err) throw err;
    console.log(data.toString());
    console.log(res);
});
```

#### Send Message

```javascript
var xml = require('xml');

// text message 
var textTpl = {
    "xml":[
      {"ToUserName":{"_cdata":"aaaaaaaa"}},
      {"FromUserName":{"_cdata":"bbbbbbbbbbb"}},
      {"CreateTime":"1111111111111111"},
      {"MsgType":"text"},
      {"Content":"hello,wechat"},
      {"MsgId":"1234567890123456"}
    ]
};

client.sendMessage({
    method:"POST",
    data:xml(textTpl,{ index: true })
}, function(err, data, res){
   if(err) throw err;
   console.log(data.toString());
   console.log(res);
});
```
### so easy to access your wechat reply server

### Example

install, into example directory and install dependence.
```
cd example && npm i
```

start server
```
node server.js
```

http(get) verify token 
```
 node signature.js
```
http(post) post message 
```
 node message.js
```

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