webhook.json•16.3 kB
{
"type": "page",
"body": [
{
"type": "crud",
"id": "webhookCRUD",
"name": "webhookCRUD",
"autoFillHeight": true,
"autoGenerateFilter": {
"columnsNum": 4,
"showBtnToolbar": false
},
"headerToolbar": [
{
"type": "button",
"icon": "fas fa-plus text-primary",
"actionType": "drawer",
"label": "新建Webhook",
"drawer": {
"closeOnEsc": true,
"closeOnOutside": true,
"size": "md",
"title": "新建Webhook (ESC 关闭)",
"body": {
"type": "tabs",
"tabs": [
{
"title": "飞书群",
"key": "feishu-group",
"body": [
{
"type": "form",
"api": "post:/admin/inspection/webhook/save",
"wrapWithPanel": false,
"body": [
{
"type": "hidden",
"name": "id"
},
{
"type": "hidden",
"name": "platform",
"value": "feishu"
},
{
"type": "input-text",
"name": "name",
"label": "名称",
"required": true,
"placeholder": "如飞书群"
},
{
"type": "input-url",
"name": "target_url",
"label": "群机器人URL",
"required": true
},
{
"type": "input-text",
"name": "sign_secret",
"label": "群机器人签名密钥",
"required": true
}
],
"submitText": "保存",
"resetText": "重置",
"messages": {
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"onEvent": {
"submitSucc": {
"actions": [
{
"actionType": "reload",
"componentId": "webhookCRUD"
},
{
"actionType": "closeDrawer"
}
]
}
}
}
]
},
{
"title": "钉钉群",
"key": "dingtalk-group",
"body": [
{
"type": "form",
"api": "post:/admin/inspection/webhook/save",
"wrapWithPanel": false,
"body": [
{
"type": "alert",
"level": "info",
"body": "本接口支持自定义机器人在企业<span style='color: red; font-weight: bold;'>内部群</span>中发送消息,调用本接口前需要创建webhook自定义机器人。"
},
{
"type": "hidden",
"name": "id"
},
{
"type": "hidden",
"name": "platform",
"value": "dingtalk"
},
{
"type": "input-text",
"name": "name",
"label": "名称",
"required": true,
"placeholder": "如钉钉群"
},
{
"type": "input-url",
"name": "target_url",
"label": "群机器人URL",
"required": true
},
{
"type": "input-text",
"name": "sign_secret",
"label": "群机器人签名密钥",
"required": true
}
],
"submitText": "保存",
"resetText": "重置",
"messages": {
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"onEvent": {
"submitSucc": {
"actions": [
{
"actionType": "reload",
"componentId": "webhookCRUD"
},
{
"actionType": "closeDrawer"
}
]
}
}
}
]
},
{
"title": "企业微信",
"key": "wechat",
"body": [
{
"type": "form",
"api": "post:/admin/inspection/webhook/save",
"wrapWithPanel": false,
"body": [
{
"type": "hidden",
"name": "id"
},
{
"type": "hidden",
"name": "platform",
"value": "wechat"
},
{
"type": "input-text",
"name": "name",
"label": "名称",
"required": true,
"placeholder": "如企业微信群"
},
{
"type": "input-url",
"name": "target_url",
"label": "群机器人URL",
"required": true
}
],
"submitText": "保存",
"resetText": "重置",
"messages": {
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"onEvent": {
"submitSucc": {
"actions": [
{
"actionType": "reload",
"componentId": "webhookCRUD"
},
{
"actionType": "closeDrawer"
}
]
}
}
}
]
},
{
"title": "其他",
"key": "other",
"body": [
{
"type": "form",
"api": "post:/admin/inspection/webhook/save",
"wrapWithPanel": false,
"body": [
{
"type": "alert",
"level": "info",
"body": "程序默认会以POST方式发送JSON Body体到指定的URL"
},
{
"type": "hidden",
"name": "id"
},
{
"type": "hidden",
"name": "platform",
"value": "default"
},
{
"type": "input-text",
"name": "name",
"label": "名称",
"required": true,
"placeholder": "如自定义Webhook"
},
{
"type": "input-url",
"name": "target_url",
"label": "目标URL",
"required": true,
"placeholder": "请输入Webhook地址"
},
{
"type": "alert",
"level": "info",
"body": "JSON模板中的 {{msg}} 会被替换为汇总消息(统计信息或者AI总结信息)。 {{raw}} 会被替换为原始JSON巡检结果。"
},
{
"type": "editor",
"name": "body_template",
"label": "JSON模板",
"language": "json",
"value": "{\n \"msgtype\": \"markdown\",\n \"markdown\": {\n \"content\": \"{{msg}}\"\n }\n}"
}
],
"submitText": "保存",
"resetText": "重置",
"messages": {
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"onEvent": {
"submitSucc": {
"actions": [
{
"actionType": "reload",
"componentId": "webhookCRUD"
},
{
"actionType": "closeDrawer"
}
]
}
}
}
]
}
]
}
}
},
"reload",
"bulkActions"
],
"loadDataOnce": false,
"syncLocation": false,
"initFetch": true,
"perPage": 10,
"bulkActions": [
{
"label": "批量删除",
"actionType": "ajax",
"confirmText": "确定要批量删除?",
"api": "post:/admin/inspection/webhook/delete/${ids}"
}
],
"footerToolbar": [
{
"type": "pagination",
"align": "right"
},
{
"type": "statistics",
"align": "right"
},
{
"type": "switch-per-page",
"align": "right"
}
],
"api": "get:/admin/inspection/webhook/list",
"columns": [
{
"type": "operation",
"label": "操作",
"width": 120,
"buttons": [
{
"type": "button",
"icon": "fas fa-edit text-primary",
"actionType": "drawer",
"tooltip": "编辑Webhook",
"drawer": {
"closeOnEsc": true,
"closeOnOutside": true,
"size": "md",
"title": "编辑Webhook (ESC 关闭)",
"body": {
"type": "form",
"api": "post:/admin/inspection/webhook/save",
"body": [
{
"type": "hidden",
"name": "id"
},
{
"type": "input-text",
"name": "name",
"label": "名称",
"placeholder": "飞书群",
"required": true
},
{
"type": "select",
"name": "platform",
"label": "平台",
"options": [
{
"label": "飞书",
"value": "feishu"
},
{
"label": "钉钉",
"value": "dingtalk"
},
{
"label": "企业微信",
"value": "wechat"
},
{
"label": "自定义",
"value": "default"
}
],
"placeholder": "请选择平台"
},
{
"type": "input-url",
"name": "target_url",
"label": "目标URL",
"required": true,
"placeholder": "请输入Webhook地址"
},
{
"type": "input-text",
"name": "sign_secret",
"label": "签名密钥",
"placeholder": "如有签名需求请填写",
"visibleOn": "platform === 'feishu' || platform === 'dingtalk'"
},
{
"type": "alert",
"level": "info",
"body": "JSON模板中的 {{msg}} 会被替换为汇总消息(统计信息或者AI总结信息)。 {{raw}} 会被替换为原始JSON巡检结果。",
"visibleOn": "platform === 'default'"
},
{
"type": "editor",
"name": "body_template",
"label": "JSON模板",
"language": "json",
"visibleOn": "platform === 'default'"
}
],
"submitText": "保存",
"resetText": "重置",
"messages": {
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"onEvent": {
"submitSucc": {
"actions": [
{
"actionType": "reload",
"componentId": "webhookCRUD"
},
{
"actionType": "closeDrawer"
}
]
}
}
}
}
},
{
"type": "button",
"tooltip": "测试",
"icon": "fas fa-play text-success",
"actionType": "ajax",
"api": "post:/admin/inspection/webhook/id/${id}/test"
}
]
},
{
"name": "name",
"label": "名称",
"type": "text",
"width": "100px"
},
{
"name": "platform",
"label": "平台",
"type": "mapping",
"map": {
"feishu": "<span class='label label-info'>飞书</span>",
"dingtalk": "<span class='label label-warning'>钉钉</span>",
"wechat": "<span class='label label-success'>企业微信</span>",
"default": "<span class='label label-primary'>自定义Webhook</span>",
"*": "<span class='label label-success'>未知</span>"
}
},
{
"name": "created_at",
"label": "创建时间",
"type": "datetime"
}
]
}
]
}