约定
哮天犬发送webhook通知,约定请求方式为 POST,请求Header中 User-Agent 包含 dog/
,例如 User-Agent: dog/1.0
,请求参数使用body部分传输 json,即请求header中包含 Content-Type: application/json
,json的内容格式约定如下:
{
"event": "{EVENT}",
"type": "{TYPE}",
"data": {
// 提交的data数据
},
"extra": {
// 其他附加字段
}
}
约定webhook响应状态码为 200
即为成功,无论响应的数据是什么。
调用webhook的超时时间为200毫秒
,请注意优化webhook性能,避免超时。
格式
以上body部分的取值请参考:
| event (String) | type (String) | body (Object) | extra (Object) | 说明 | | —- | —- | —- | —- | —- |
|
PING
| ping
| 无
|
| 用于测试该webhook是否可用
|
|
ALARM
| not_save_db
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
msg | Object | 消息体
msg.uuid | String | 该告警唯一ID
msg.leve | Number | 告警级别
msg.ctn | Object | 告警内容
msg.notice_time | Number | 告警通知时间,时间戳秒
|
| 未入库告警通知
|
| |
compressed
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.batch | Number | 收敛批次ID
history.metric | String | 收敛指标
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳
|
| 收敛告警通知
|
| |
compress_not_match
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
|
| 未收敛告警通知
|
| |
compress_disable
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
|
| 未开启收敛功能告警通知
|
|
UPGRADE
| upgrade
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
|
| 告警升级通知
|
|
RECOVERY
| not_save_db
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
msg | Object | 消息体
msg.uuid | String | 该告警唯一ID
msg.leve | Number | 告警级别
msg.ctn | Object | 告警内容
msg.notice_time | Number | 告警通知时间,时间戳秒
|
| 告警恢复通知(不入库类型)
|
| |
recovery
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
|
| 告警恢复通知(入库类型)
|
|
WORKFLOW
| remind_pending
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
|
| 待认领工作流提醒通知
|
| |
remind_processing
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
|
| 待处理完成工作流提醒通知
|
| |
generated
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
|
| 工作流创建提醒
|
| |
claim
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
pipeline | Object | 工作流流程信息
pipeline.remark | String | 备注
pipeline.user | Object | 操作工作流的用户信息
pipeline.user.uid | Number | 用户工号,去零整数
pipeline.user.username | String | 用户姓名
pipeline.user.user | String | 邮箱前缀
|
| 工作流认领通知
|
| |
assign
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
pipeline | Object | 工作流流程信息
pipeline.remark | String | 备注
pipeline.user | Object | 操作工作流的用户信息
pipeline.user.uid | Number | 用户工号,去零整数
pipeline.user.username | String | 用户姓名
pipeline.user.user | String | 邮箱前缀
pipeline.assignto | Array | 被指派人信息
pipeline.assignto..uid | Number | 工号
pipeline.assignto..username | Number | 姓名
pipeline.assignto.*.user | Number | 邮箱前缀
|
| 工作流指派通知
|
| |
processed
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
pipeline | Object | 工作流流程信息
pipeline.remark | String | 备注
pipeline.user | Object | 操作工作流的用户信息
pipeline.user.uid | Number | 用户工号,去零整数
pipeline.user.username | String | 用户姓名
pipeline.user.user | String | 邮箱前缀
|
| 工作流处理完成通知
|
| |
reactive
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
pipeline | Object | 工作流流程信息
pipeline.remark | String | 备注
pipeline.user | Object | 操作工作流的用户信息
pipeline.user.uid | Number | 用户工号,去零整数
pipeline.user.username | String | 用户姓名
pipeline.user.user | String | 邮箱前缀
|
| 工作流被重新激活通知
|
| |
close
|
task | Object | 告警任务信息
task.id | Number | 告警任务ID
task.name | String | 告警任务名称
history | Object | 消息体
history.id | Number | 消息自增ID
history.uuid | String | 该告警唯一ID
history.leve | Number | 告警级别
history.ctn | Object | 告警内容
history.notice_time | Number | 告警通知时间,时间戳秒
workflow | Object | 工作流信息
workflow.id | Number | 工作流ID
pipeline | Object | 工作流流程信息
pipeline.remark | String | 备注
pipeline.user | Object | 操作工作流的用户信息
pipeline.user.uid | Number | 用户工号,去零整数
pipeline.user.username | String | 用户姓名
pipeline.user.user | String | 邮箱前缀
|
| 工作流关闭通知
|
说明:上表中 task.id、task.name 表示的是JSON中的Object:
{
"task": {
"id": 123,
"name": "哮天犬测试"
}
}
上表中 pipeline.assignto..uid、pipeline.assignto..username 表示的是JSON中的Array:
{
"pipeline": {
"assignto": [
{
"uid": 123,
"username": "张三"
},
{
"uid": 456,
"username": "李四"
}
]
}
}
示例请求
POST /admin HTTP/1.1
Content-Length: 467
User-Agent: dog/1.0
Content-Type: application/json
Host: localhost:9501
{"event":"WORKFLOW","type":"close","data":{"workflow":{"id":1,"task_id":102,"history_id":3,"created_at":"1970-01-06 08:07:12","status":"\u5904\u7406\u4e2d"},"task":{"id":102,"name":"\u7530\u7247\u6d4b\u8bd5"},"history":{"id":3,"uuid":"e3c25704-a54b-40ab-ab08-0e2009d9673e","level":"\u9519\u8bef"},"pipeline":{"remark":"423","created_at":"2020-05-02 23:27:51","user":{"uid":1,"username":"ethananony","email":"ethananony@aliyun.com","user":"ethananony"}}},"extra":{}}