Notification Center
Notification Center là hệ thống thông báo tập trung, tích hợp nhiều kênh giao tiếp và hỗ trợ quy tắc tự động với chuỗi leo thang (escalation).
Kênh giao tiếp
| Kênh | Mô tả |
|---|---|
| Web | Thông báo trong giao diện VieLang IoT |
| Gửi qua SMTP | |
| SMS | Tin nhắn điện thoại (Twilio, AWS SNS) |
| Slack | Gửi vào channel Slack |
| Microsoft Teams | Gửi vào channel Teams |
| Webhook | HTTP POST đến URL tùy chọn |
| Mobile Push | FCM push notification (app mobile) |
Gửi thông báo thủ công
Notification Center > Send notification:
Template: [chọn template]
Recipients: [chọn người nhận]
Method: Web, Email, SMS, ...
Notification Templates
Template định nghĩa nội dung thông báo, tái sử dụng cho nhiều quy tắc.
Ví dụ template:
Name: High Temperature Alert
Type: ALARM
Subject: Cảnh báo nhiệt độ cao — ${deviceName}
Body: Thiết bị ${deviceName} tại ${location} báo nhiệt độ
${temperature}°C (ngưỡng: ${threshold}°C)
Xem thiết bị: ${deviceUrl}
Action buttons:
[Xem Dashboard] → /dashboard/${dashboardId}
[Xem thiết bị] → /device/${deviceId}
Biến có sẵn: ${deviceName}, ${deviceId}, ${alarmType}, ${alarmSeverity}, ${tenantName}, ${timestamp}, và bất kỳ metadata nào trong message.
Notification Rules (Tự động)
Quy tắc tự động gửi thông báo khi có sự kiện.
Trigger Types:
| Trigger | Khi nào |
|---|---|
Alarm Created | Alarm mới được tạo |
Alarm Severity Changed | Severity alarm thay đổi |
Alarm Acknowledged | Alarm được xác nhận |
Alarm Cleared | Alarm được clear |
Alarm Comment Added | Có comment mới |
Device Activity | Thiết bị connect/disconnect |
Entity Action | Entity được tạo/sửa/xóa |
API Usage Limit | Vượt giới hạn API |
Rule Engine Lifecycle | Rule chain khởi động/dừng |
Ví dụ: Rule cảnh báo alarm
Name: Critical Alarm Notification
Trigger: Alarm Created
Filter:
- Alarm severity: CRITICAL, MAJOR
- Alarm type: (bỏ trống = tất cả)
Escalation chain:
Step 1 (delay: 0s): → Web, Email (tenant admins)
Step 2 (delay: 5m): → SMS (on-call engineer)
Step 3 (delay: 15m): → Phone call (manager)
Ví dụ: Rule thiết bị offline
Name: Device Disconnected Alert
Trigger: Device Activity
Filter:
- Event type: INACTIVE (offline)
- Device list: [Gateway-01, Gateway-02]
Recipients: On-call team
Method: Slack (#alerts channel)
Recipients (Người nhận)
Platform Users
All tenant admins
All tenant users
User list: [admin@company.com, ops@company.com]
Slack
Workspace: company-workspace
Channel: #iot-alerts
Bot token: xoxb-...
Microsoft Teams
Webhook URL: https://company.webhook.office.com/webhookb2/...
Webhook
URL: https://api.pagerduty.com/v2/enqueue
Method: POST
Headers:
Authorization: Token token=...
Content-Type: application/json
Escalation Chain
Chuỗi leo thang: nếu không ai xác nhận → gửi tiếp lên cấp cao hơn.
Delay 0: Web + Email → L1 support
Delay 5m: SMS → L2 on-call
Delay 15m: Slack #management + Email manager
Delay 30m: Phone call CTO
Notification Inbox
Tất cả thông báo Web lưu tại Notification Center > Inbox:
- Đánh dấu đã đọc / chưa đọc
- Bộ lọc theo loại, ngày
- Xem chi tiết + action buttons
- Mark all as read
API
POST /api/notification
GET /api/notifications?pageSize=20&page=0
GET /api/notifications/unread/count
PUT /api/notifications/read
DELETE /api/notifications/{id}
POST /api/notificationRule
GET /api/notificationRules
GET /api/notificationTemplates