New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-weixin-menu

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-weixin-menu

menu apis for weixin

latest
Source
npmnpm
Version
0.6.0
Version published
Maintainers
1
Created
Source

node-weixin-menu NPM version Build Status Dependency Status Coverage percentage

Menu apis for weixin

微信菜单API和命令行工具

微信菜单API是(node-weixin-api 或者 node-weixin-express)的一个子项目。 它提供:

  • 菜单API共计4个(create, get, customize, remove)
  • 命令行工具(wxmenu)

交流QQ群: 39287176

注:

node-weixin-express是基于node-weixin-*的服务器端参考实现。

node-weixin-api是基于node-weixin-*的API接口SDK。

它们都是由下列子项目组合而成:

安装

$ npm install --save node-weixin-menu

使用方法

在node代码中使用

var nodeWeixinMenu = require('node-weixin-menu');

var app = {
  id: process.env.APP_ID,
  secret: process.env.APP_SECRET,
  token: process.env.APP_TOKEN
};

var auth = require("node-weixin-auth");
var config = require("node-weixin-config");
config.app.init(app);


  var menu = {
      "button": [
        {
          "type": "view",
          "name": "我要下单",
          "url": "http://www.soso.com/"
        },
        {
          "name": "菜单",
          "sub_button": [
            {
              "type": "view",
              "name": "搜索",
              "url": "http://www.soso.com/"
            },
            {
              "type": "view",
              "name": "视频",
              "url": "http://v.qq.com/"
            },
            {
              "type": "click",
              "name": "赞一下我们",
              "key": "V1001_GOOD"
            }
          ]
        }
      ]
    };

nodeWeixinMenu.create(app, menu, function (error, data) {
  //error === true
  //data.errcode === 0
  //data.errmsg === 'ok'
});

nodeWeixinMenu.get(app, function (error, data) {
  //error === true
  //typeof data.menu
  //typeof data.menu.button
});

nodeWeixinMenu.customize(app, function (error, data) {
  //error === true
  //data.is_menu_open === 1
  //data.selfmenu_info
  //data.selfmenu_info.button
});

nodeWeixinMenu.remove(app, function (error, data) {
  //error === true
  //data.errcode
  //data.errmsg
});

在node命令行里使用

$ npm install --global node-weixin-menu

$ wxmenu --help

$#获取菜单
$ wxmenu get --id WX_ID --secret WX_SECRET --token WX_TOKEN    
$#获取自定义菜单
$ wxmenu customize --id WX_ID --secret WX_SECRET --token WX_TOKEN
$#删除菜单
$ wxmenu remove --id WX_ID --secret WX_SECRET --token WX_TOKEN
$#创建菜单
$ wxmenu create --id WX_ID --secret WX_SECRET --token WX_TOKEN --menu menu.json

注:使用时需要将WX_ID, WX_SECRET, WX_TOKEN,替换成你自己的真实参数

License

Apache-2.0 © calidion

Keywords

node-weixin-menu

FAQs

Package last updated on 21 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts