kx-wechat

0.0.12 • Public • Published

WeChat for node

Table of contents:

Introduction

Support APIs

# Introduction WeChat for nodejs

Installation

npm install kx-wechat

Usage

var WeChat = require('Kx-WeChat');

var wx = new WeChat(
{
  "openid":"Your WeChat Openid",
  "appsecret":"Your WeChat appsecret",
  "token":"Your WeChat token",
  "encodingaeskey":"Your WeChat encodingaeskey",
  "debug":true
});

function _default(data){
  return "The result of your processing";
}

function _replayUserTextMessage(data){
  return "The result of your processing";
}

wx.AddEvent("default",_default);
wx.AddEvent("text",_replayUserTextMessage);
# APIs

Supports the following APIs:

#### AddEvent
方法说明: 注册微信消息的对应处理事件
eventName: 微信消息的 MsgType 详情点击[WeChat Doc](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140453&token=&lang=zh_CN)
callback: 对应的 MsgType 会调用的function #### MD5
方法说明: 对字符串进行MD5加密
source: 需要进行MD5的原始字符串 #### BuildReplyMsg
方法说明: 构建文本类的加密回复信息
toUser: 构建文本类的加密回复信息中的用户ID
message: 构建文本类的加密回复信息中的消息内容 #### GET
方法说明: 验证消息的确来自微信服务器
signature: 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
timestamp: 时间戳
nonce: 随机数
echostr: 随机字符串
详细的文档说明请点击 [WeChat Doc](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN) #### POST
方法说明:
signature: 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
timestamp: 时间戳
nonce: 随机数
encryptStr: 安全模式下,第三方平台方收到的带密文消息体中Encrypt的字段内容
详细的文档说明请点击 [WeChat Doc](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419318479&token=&lang=zh_CN)

Readme

Keywords

Package Sidebar

Install

npm i kx-wechat

Weekly Downloads

5

Version

0.0.12

License

Apache-2.0

Last publish

Collaborators

  • kxvz