chengfeng-egg-webhook

1.0.0 • Public • Published

egg-webhook

给webhook搭建的node服务

QuickStart

see egg docs for more detail.

Development

$ npm i
$ npm run dev
$ open http://localhost:7001/

Deploy

$ npm start
$ npm stop

npm scripts

  • Use npm run lint to check code style.
  • Use npm test to run unit test.
  • Use npm run autod to auto detect dependencies upgrade, see autod for more detail.

添加新的webhook示例

extend/helper.js文件中 新增aicc组webhook,主要就是加一个全局可以使用的变量

const consts = {
  // SCRM前端群机器人webhook地址
  ...
  // AICC前端群机器人webhook地址
  AICC_FRONT_GROUP_ROBOT_WEBHOOK_URL: 'https://open.feishu.cn/open-apis/bot/v2/hook/1867b7c2-64f5-4d89-82cd-47269aa8fb15',
  // 掘金文章地址
  ...
};

...
module.exports = {
  ...
  webhookUrlEnum: {
    ...新增aicc变量枚举
    fsAiccFrontGroup: consts.AICC_FRONT_GROUP_ROBOT_WEBHOOK_URL
  },
  ...
};

在通过 url 上的参数去调取不同的webhook地址 在 app/controller/git 中

...xxx...
const url = ctx.request.url

await ctx.service.callThirdParty.fsGroup({
  groupType: url.includes('aicc') ? 'fsAiccFrontGroup' :  "fsFrontGroup",
  msgtype: "post",
  contentList,
});

这样就配置好了node服务上的东西

git push

示例 ai-call-playform-web 项目配置

在项目代码的 settings 的 integrations 中 在 URL 中 添加该服务的地址即可 http://192.168.120.71:10020/apiWebhook/git/merge?base=aicc 这样在git push后就会自动推送消息到群

bamboo打包消息推送

示例 CRM Bamboo配置 在代码项目的配置下,选择 triggers 触发器 配置180s自动打包 在项目配置下,选择stages下的default job添加一个webhook通知任务

curl -X POST -H "Content-Type: application/json" -d '{"env": "什么环境", "project":"你的工程", "result":"打包成功"}' http://47.99.84.2:10020/apiWebhook/bamboo/build?base=aicc

同理,bamboo.js也需要上面 app/controller/git 中同样配置

服务器地址

服务器:daily-acp 代码地址: /home/admin/ai-call-front/egg-webhook 更新指令:执行下 start.sh 即可

Dependents (0)

Package Sidebar

Install

npm i chengfeng-egg-webhook

Weekly Downloads

8

Version

1.0.0

License

MIT

Unpacked Size

15.8 kB

Total Files

22

Last publish

Collaborators

  • sjp199792