{"id":19035500,"url":"https://github.com/node-webot/wechat-corp-service-callback","last_synced_at":"2025-04-23T18:23:25.940Z","repository":{"id":25334417,"uuid":"28761619","full_name":"node-webot/wechat-corp-service-callback","owner":"node-webot","description":"微信公共平台企业号版(第三方企业套件)SDK－回调接口","archived":false,"fork":false,"pushed_at":"2015-05-04T06:42:43.000Z","size":132,"stargazers_count":13,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-15T20:01:58.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-webot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-04T02:46:07.000Z","updated_at":"2021-12-17T18:26:47.000Z","dependencies_parsed_at":"2022-08-24T00:10:48.697Z","dependency_job_id":null,"html_url":"https://github.com/node-webot/wechat-corp-service-callback","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-webot%2Fwechat-corp-service-callback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-webot%2Fwechat-corp-service-callback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-webot%2Fwechat-corp-service-callback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-webot%2Fwechat-corp-service-callback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-webot","download_url":"https://codeload.github.com/node-webot/wechat-corp-service-callback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250488264,"owners_count":21438751,"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":[],"created_at":"2024-11-08T21:51:01.833Z","updated_at":"2025-04-23T18:23:25.915Z","avatar_url":"https://github.com/node-webot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"wechat corp service callback\n=======================================\n\n微信公共平台企业号版(第三方企业套件)SDK－回调接口\n\n\n## 功能说明\n\n用来接收企业第三方应用套件发送过来的回调消息。\n\n## 安装方法\n\n```sh\n$ npm install wechat-corp-service-callback\n```\n\n## 使用方法\n\n### 前提\n\n首先，你要有一个企业号。\n然后，你要申请成为第三方企业套件的供应商。\n接下来才可以创建套件，并且设置套件应用。\n\n### 用法\n\n其中的token，encodingAESKey，suite_id可以在套件的信息配置界面获取。\n\n```js\nvar wechat_cs = require('wechat-corp-service-callback');\n\nvar app_suite = function(req, res, next) {\n    var _config = {\n        token: sc.token,\n        encodingAESKey: sc.encodingAESKey,\n        suiteid: sc.suite_id,\n    };\n    var _route = function(message, req, res, next) {\n        \n        if (message.InfoType == 'suite_ticket') { //微信服务器发过来的票，每10分钟发一次\n            //更新到数据库\n            var suite_ticket = message.SuiteTicket;\n            var suite_ticket_tm = new Date(parseInt(message.TimeStamp) * 1000);\n            //将最新的ticket放到数据库中, 调用用户自己定义的 save_ticket(callback) 方法。\n             save_ticket(function(err, ret) {\n                res.reply('success');\n            });\n        } else if (message.InfoType == 'change_auth') { //变更授权的通知\n            //更新到数据库\n            res.reply('success');\n\n        } else if (message.InfoType == 'cancel_auth') { //取消授权的通知\n            //更新到数据库\n            res.reply('success');\n        } else {\n            res.reply('success');\n        };\n    }\n    if (req.method == 'POST') {\n        wechat_cs(_config, _route)(req, res, next);\n    } else if (req.method == 'GET') {\n        res.send('这个接口不适合GET');\n    };\n}\n\napp.get(__base_path + '/app_suite_callback', app_suite);\napp.post(__base_path + '/app_suite_callback', app_suite);\n```\n\n## 相关文档\n- [微信企业号－第三方应用授权](http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A8%E6%8E%88%E6%9D%83)\n\n\n## License\nThe MIT license.\n\n## 交流群\nQQ群：157964097，使用疑问，开发，贡献代码请加群。\n\n## 感谢\n感谢以下贡献者：\n\n\n## 捐赠\n如果您觉得Wechat企业号版本对您有帮助，欢迎请作者一杯咖啡\n\n![捐赠wechat](https://cloud.githubusercontent.com/assets/327019/2941591/2b9e5e58-d9a7-11e3-9e80-c25aba0a48a1.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-webot%2Fwechat-corp-service-callback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-webot%2Fwechat-corp-service-callback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-webot%2Fwechat-corp-service-callback/lists"}