Skip to content

feat: 自动作业多渠道通知 — 企业微信/自定义Webhook/EventBus #104

@lailoo

Description

@lailoo

背景

当前通知仅支持飞书,缺少企业微信 Webhook、自定义 Webhook、邮件等渠道。事件触发机制不完善,通知模板不可自定义。

目标

构建统一 NotificationService + EventBus,支持多渠道通知分发和用户自定义通知规则。

方案概要(详见 116.00.自动作业并通知方案.md)

核心架构

  • NotificationService:统一通知服务,根据规则分发到对应渠道
  • EventBus:事件总线,解耦事件产生与消费
  • NotificationChannel 抽象
    • FeishuChannel(重构自现有 feishu_routes.py)
    • WecomChannel(企业微信群机器人 Webhook)
    • CustomWebhookChannel(通用 HTTP 回调 + 签名验证)
    • EmailChannel(SMTP,可选)
  • NotificationRule:用户配置 事件→渠道→模板 映射

事件类型

task_started / task_completed / task_failed / task_timeout / cron_triggered / workflow_completed / asset_generated

前端

扩展 CronManager.vue,新增通知配置 Tab(渠道管理 + 规则配置 + 连通性测试)

API

GET/POST/PUT/DELETE  /api/notifications/channels
POST  /api/notifications/channels/<id>/test
GET/POST/PUT/DELETE  /api/notifications/rules
GET   /api/notifications/history

实现路径

阶段 内容 工作量
P1 NotificationService + EventBus + Channel 抽象 2d
P2 重构飞书 + 新增 WecomChannel 2d
P3 CustomWebhookChannel + 签名验证 1d
P4 Rule 模型 + SQLite + API 2d
P5 前端通知配置 UI 3d
P6 EventBus 接入 TaskQueueManager + CronScheduler 1d

可行性

。飞书通知已完整实现,企业微信 Webhook 协议简单,核心是抽象 NotificationService + EventBus。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions