0.2.10 • Published 7 years ago

wx-mp-api v0.2.10

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

wx-mp-api

npm License

wx-mp-api is an interface for node.js to access WeChat MP platform service. wx-mp-api utilize Bluebird to support promise.

##Install

npm install wx-mp-api

##Usage

Create instance:

An example for Express:

##Methods ###buildWXPageAPIConfig(url) While JavaScript in page try to call WeChat/Wexin bridge, WeChat should verify the page privilege, this method build an object to pass to the front, then wx.config can accept it. return: { "noncestr": "1QNBVBx2u02AGQ0HO1lOeEuggQeYID2e", "timestamp": "1476328755", "signature": "03a4...", "appId": "**...", "jsApiList": "checkJsApi", "openAddress" }

###verifySite(signature,timestamp,nonce); While binding the Web application to your WeChat MP account, WeChat will send a verfification request to the application, the application should verrify the request and response an echo str. This function is a simple encapsulation.

Usage in Express:

###buildWXAuthURL(url,method) method could be 'sns_base' or 'sns_userinfo'

###requreUserInfo() Retrieve the user information.

###requreOpenId(code) WeChat only pass "code" as a query param to web app, app should retrieve the user infomation from WeChat through WeChat service reqeust.

###requestQRTicket This method is used by requestQR.

###requestQR Sometime, app want to generate QR code, WeChat provice a service to help it. Call this function to generate QR through WeChat service.

###createMenu WeChat MP support customized menu, you can create menu through this function in your route function.

Todo:

  1. to support more interfaces

If you need more interface, please let me know.

0.2.10

7 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago