Appearance
Notifications API
Quick Reference
- Base URL:
https://insights.omisell.com/api/v1/notifications- Auth:
Authorization: Omi <token>- Content-Type:
application/json
Endpoints Overview
| Method | Endpoint | Mô tả | Auth |
|---|---|---|---|
| GET | /api/v1/notifications/channels | Danh sách channels | Yes |
| POST | /api/v1/notifications/channels | Tạo channel | Yes |
| PATCH | /api/v1/notifications/channels/{id} | Cập nhật channel | Yes |
| DELETE | /api/v1/notifications/channels/{id} | Xoá channel | Yes |
| POST | /api/v1/notifications/channels/{id}/test | Test channel | Yes |
| GET | /api/v1/notifications/subscriptions | Danh sách subscriptions | Yes |
| POST | /api/v1/notifications/subscriptions | Tạo subscription | Yes |
| PATCH | /api/v1/notifications/subscriptions/{id} | Toggle subscription | Yes |
| DELETE | /api/v1/notifications/subscriptions/{id} | Xoá subscription | Yes |
| GET | /api/v1/notifications/logs | Delivery logs | Yes |
Notification Channels
GET /api/v1/notifications/channels
Response (200 OK): NotificationChannel[]
| Field | Type | Mô tả |
|---|---|---|
id | string | ID channel |
channel_type | 'telegram' | 'lark' | 'email' | Loại kênh |
config | Record<string, string> | Cấu hình kênh |
is_verified | boolean | Đã verify? |
created_at | string | Thời gian tạo |
Config theo loại:
| Channel | Config fields |
|---|---|
| telegram | { "bot_token": "...", "chat_id": "..." } |
{ "email": "user@company.com" } | |
| lark | { "webhook_url": "https://open.feishu.cn/..." } |
Source: (api.service.ts:96-98)
POST /api/v1/notifications/channels
Request Body: NotificationChannelCreateRequest
| Field | Type | Required | Mô tả |
|---|---|---|---|
channel_type | string | Yes | telegram, lark, email |
config | Record<string, string> | Yes | Cấu hình kênh |
Response (201 Created): NotificationChannel
Source: (api.service.ts:100-105)
PATCH /api/v1/notifications/channels/:id
Cập nhật config kênh.
Request Body:
json
{
"config": {
"bot_token": "new_token",
"chat_id": "new_chat_id"
}
}Response (200 OK): NotificationChannel (updated, is_verified reset)
Source: (api.service.ts:261-266)
DELETE /api/v1/notifications/channels/:id
Xoá channel. Subscriptions liên quan sẽ bị ảnh hưởng.
Response: 204 No Content
Source: (api.service.ts:107-109)
POST /api/v1/notifications/channels/:id/test
Gửi message test qua channel. Backend verify kết nối.
Request Body: {}
Response: 200 OK nếu thành công
Source: (api.service.ts:111-116)
Insight Subscriptions
GET /api/v1/notifications/subscriptions
Response (200 OK): InsightSubscription[]
| Field | Type | Mô tả |
|---|---|---|
id | string | ID subscription |
insight_code | string | Mã insight |
insight_name | string | Tên insight |
channel_id | string | ID channel nhận |
channel_type | ChannelType | Loại kênh |
schedule | 'daily' | 'weekly' | 'monthly' | Tần suất |
granularity | string | Mức thời gian |
country | string? | Filter quốc gia |
is_active | boolean | Đang hoạt động? |
created_at | string | Thời gian tạo |
Source: (api.service.ts:119-122)
POST /api/v1/notifications/subscriptions
Request Body: InsightSubscriptionCreateRequest
| Field | Type | Required | Mô tả |
|---|---|---|---|
insight_code | string | Yes | Mã insight |
channel_id | string | Yes | ID channel |
schedule | string | Yes | daily, weekly, monthly |
granularity | string | Yes | Mức thời gian |
country | string? | No | Filter quốc gia |
Response (201 Created): InsightSubscription
Source: (api.service.ts:125-132)
PATCH /api/v1/notifications/subscriptions/:id
Toggle subscription on/off.
Request Body: { "is_active": boolean }
Source: (api.service.ts:134-139)
DELETE /api/v1/notifications/subscriptions/:id
Response: 204 No Content
Source: (api.service.ts:141-144)
Delivery Logs
GET /api/v1/notifications/logs
Lấy lịch sử gửi thông báo.
Response (200 OK): DeliveryLog[]
| Field | Type | Mô tả |
|---|---|---|
id | string | ID log |
subscription_id | string | ID subscription |
insight_name | string | Tên insight |
channel_type | ChannelType | Loại kênh |
sent_at | string | Thời gian gửi (ISO) |
status | 'success' | 'failed' | Trạng thái |
error_message | string? | Chi tiết lỗi (nếu failed) |
Source: (api.service.ts:147-149)
Liên kết
- API Index — Tổng quan API
- Dashboards API — Dashboard subscriptions
- AI Connectors API — Cấu hình AI
- SOP: Thông báo — Hướng dẫn sử dụng