# node-red-contrib-dfnotification **Repository Path**: dfskgh/node-red-contrib-dfnotification ## Basic Information - **Project Name**: node-red-contrib-dfnotification - **Description**: 东方数科消息通知节点,集成多种消息渠道,实现智能消息分发与告警。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2025-12-11 - **Last Updated**: 2025-12-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # node-red-contrib-dfnotification > 东方数科消息通知节点,集成多种消息渠道,实现智能消息分发与告警。 ## 功能特性 DFNotification 节点提供统一的消息通知解决方案,支持以下功能: - **多通道支持**:邮件、短信、微信、钉钉、Webhook 等 - **消息模板**:可配置的消息模板,支持变量替换 - **智能路由**:根据条件自动选择发送通道 - **重试机制**:发送失败自动重试,保证消息可达 - **发送记录**:完整的消息发送日志记录 ## 支持的通道 ### 即时通讯 - 企业微信机器人 - 钉钉工作通知 - Slack Webhook - 飞书机器人 ### 传统消息 - SMTP 邮件发送 - 短信网关(阿里云、腾讯云) - HTTP Webhook 回调 ### 语音通知 - 语音电话告警 - TTS 文本转语音 ## 快速开始 ### 安装 bash npm install node-red-contrib-dfnotification ### 基础配置 1. 配置消息通道参数(如 SMTP 服务器、机器人 Webhook 等) 2. 创建消息模板,定义内容和格式 3. 配置发送规则和条件 ## 使用示例 ### 邮件通知配置 json [ { "id": "email-sender", "type": "dfnotification-email", "name": "系统告警邮件", "smtpConfig": "smtp-conn", "template": "alert-template", "recipients": ["admin@company.com"], "conditions": "msg.priority === 'high'", "wires": [["log-result"]] } ] ### 多通道消息路由 json [ { "id": "smart-notifier", "type": "dfnotification-router", "name": "智能通知路由", "rules": [ {"condition": "level === 'emergency'", "channels": ["sms", "phone"]}, {"condition": "level === 'warning'", "channels": ["wechat", "email"]} ], "wires": [["channel-email", "channel-sms"]] } ] ## 消息模板 ### 基础模板语法 javascript // 邮件模板示例 const template = { subject: "系统告警 - {{alert.title}}", body: ` 告警通知 时间:{{timestamp}} 级别:{{alert.level}} 内容:{{alert.message}} 处理指南:{{alert.instruction}} ` }; ### 条件模板 支持根据不同条件使用不同模板: javascript // 多条件模板配置 templates: [ {when: "type === 'welcome'", template: "welcome-template"}, {when: "type === 'alert'", template: "alert-template"}, {when: "type === 'report'", template: "report-template"} ] ## 高级功能 ### 消息队列 支持消息队列处理,防止消息丢失: - 消息持久化存储 - 顺序保证和去重处理 - 失败消息重试机制 ### 发送限流 防止消息轰炸,支持多种限流策略: - 基于时间的频率限制 - 接收人级别的发送限制 - 优先级队列处理 ## 监控与统计 ### 发送统计 节点提供丰富的统计信息: - 发送成功率统计 - 各通道响应时间监控 - 消息分类统计报表 ### 实时监控 集成监控接口,实时查看发送状态: javascript // 获取发送统计 const stats = await node.getStats(); console.log(stats.successRate); // 成功率 console.log(stats.totalSent); // 总发送量 ## 最佳实践 ### 消息设计原则 1. **重要性分级**:不同重要程度消息使用不同通道 2. **内容简洁**:移动端消息控制在 200 字以内 3. **行动指引**:包含明确的处理建议和链接 4. **频率控制**:避免对同一用户频繁发送 ### 错误处理 - 配置备用发送通道 - 设置合理的超时时间 - 实现死信队列处理 ## 支持与帮助 - 文档中心:[消息通知指南](https://docs.east-digital.com/notification) - 示例模板:[消息模板库](https://github.com/东方数科/notification-templates) - 技术支持:notification-support@east-digital.com ## 许可证 MIT License © 2025 东方数科