{"id":14957571,"url":"https://github.com/silencehvk/wechatbynode","last_synced_at":"2025-04-04T19:11:08.332Z","repository":{"id":91849932,"uuid":"92355147","full_name":"SilenceHVK/wechatByNode","owner":"SilenceHVK","description":"Use the Node.js development WeChat（使用Node.js 开发微信公众号）【 博客地址：https://cnodejs.org/user/SilenceHVK 】","archived":false,"fork":false,"pushed_at":"2021-12-08T01:56:33.000Z","size":672,"stargazers_count":671,"open_issues_count":0,"forks_count":139,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T18:12:22.203Z","etag":null,"topics":["express-js","node-js","wechat","xml2js"],"latest_commit_sha":null,"homepage":"https://cnodejs.org/user/SilenceHVK","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SilenceHVK.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-25T02:11:11.000Z","updated_at":"2025-03-23T02:48:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f0f8276-d1c1-44e1-b562-c2f8006b0c9a","html_url":"https://github.com/SilenceHVK/wechatByNode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilenceHVK%2FwechatByNode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilenceHVK%2FwechatByNode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilenceHVK%2FwechatByNode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilenceHVK%2FwechatByNode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SilenceHVK","download_url":"https://codeload.github.com/SilenceHVK/wechatByNode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express-js","node-js","wechat","xml2js"],"created_at":"2024-09-24T13:15:10.286Z","updated_at":"2025-04-04T19:11:08.312Z","avatar_url":"https://github.com/SilenceHVK.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js 微信公众号开发 ![git start](https://img.shields.io/github/stars/silencehvk/wechatbynode.svg?style=social\u0026label=Star) ![git fork](https://img.shields.io/github/forks/silencehvk/wechatbynode.svg?style=social\u0026label=Fork) [![](https://img.shields.io/github/issues/silencehvk/wechatbynode.svg?style=social\u0026label=Issues)](https://github.com/silencehvk/wechatbynode/issues) [![](https://img.shields.io/github/release/silencehvk/wechatbynode.svg?style=social\u0026label=Releases)](https://github.com/silencehvk/wechatbynode/releases)\n\n![node version](https://img.shields.io/badge/node-7.5.0-brightgreen.svg)\n![npm version](https://img.shields.io/badge/npm-4.1.2-brightgreen.svg)\n![express version](https://img.shields.io/badge/express-4.15.3-blue.svg)\n![xml2js](https://img.shields.io/badge/xml2js-0.4.17-orange.svg)\n\n# 项目结构\n\u003cpre\u003e\n.\n├── README.md           \n├── package.json               // 构建项目与工具包依赖\n├── config.json               // 项目配置文件\n├── app.js                   // 项目启动入口\n├── wechat                 // 微信模块文件夹\n│   ├── access_token.json // accessToken存储文件\n│   ├── menus.json       // 菜单配置文件\n│   ├── msg.js          // 消息模块\n│   └── wechat.js      // 微信模块\n\u003c/pre\u003e\n\n# 目标功能\n- [x] 微信接入功能\n- [x] access_token的获取、存储及更新\n- [x] 自定义微信菜单\n- [x] 消息被动回复\n- [x] 消息加解密\n\n# 构建项目\n 1. 将项目 clone 到本地\n    ```\n    git clone git@github.com:SilenceHVK/wechatByNode.git\n    ```\n\n 2. 打开项目配置文件 config.json\n \n    ![config.json](http://img.blog.csdn.net/20170609144432242?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    修改文件的 token、appID 以及 appScrect 配置参数。其中 token、appID 与 appScrect 两个参数位于 [微信公众平台](https://mp.weixin.qq.com/) 左侧菜单的基本配置中\n    ![基本配置](http://img.blog.csdn.net/20170527134810969?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    ![开发这ID 与秘钥](http://img.blog.csdn.net/20170601095037229?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n 3. 进入 wechatByNode 文件并运行 app.js\n    ```\n    cd wechatByNode \u0026\u0026 node app.js  // Server runs at localhost:3000\n    ```\n\n 4. 将服务地址映射外网，或部署到服务器。这里我使用内网穿透演示。\n\n    - 打开花生壳的软件，点击内网穿透\n    ![内网穿透](http://img.blog.csdn.net/20170527132325667?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n     - 点击添加映射\n    ![点击添加映射](http://img.blog.csdn.net/20170527132602551?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    - 配置映射\n    ![配置映射](http://img.blog.csdn.net/20170527132805752?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n    由于微信只接受80端口。 映射类型必须选择80端口，内网主机就是部署Node.js项目的电脑 IP 地址\n\n5. 接入认证\n\n    ![接入认证](http://img.blog.csdn.net/20170527141026200?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    点击提交。提示提交成功，接入认证完成\n    ![接入认证提交](http://img.blog.csdn.net/20170527141056778?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n6. 扫描微信二维码，关注公众号，就可以开始玩了\n\n    ![微信公众号](http://img.blog.csdn.net/20170608184008076?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    ![微信自定义菜单](http://img.blog.csdn.net/20170606161743505?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    ![微信接收普通消息](http://img.blog.csdn.net/20170608183907918?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    ![微信接收普通消息](http://img.blog.csdn.net/20170608183936497?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n    ![微信接收事件消息](http://img.blog.csdn.net/20170608160434723?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHZrQ29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilencehvk%2Fwechatbynode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilencehvk%2Fwechatbynode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilencehvk%2Fwechatbynode/lists"}