Skip to content

Notifications API

Quick Reference

  • Base URL: https://insights.omisell.com/api/v1/notifications
  • Auth: Authorization: Omi <token>
  • Content-Type: application/json

Endpoints Overview

MethodEndpointMô tảAuth
GET/api/v1/notifications/channelsDanh sách channelsYes
POST/api/v1/notifications/channelsTạo channelYes
PATCH/api/v1/notifications/channels/{id}Cập nhật channelYes
DELETE/api/v1/notifications/channels/{id}Xoá channelYes
POST/api/v1/notifications/channels/{id}/testTest channelYes
GET/api/v1/notifications/subscriptionsDanh sách subscriptionsYes
POST/api/v1/notifications/subscriptionsTạo subscriptionYes
PATCH/api/v1/notifications/subscriptions/{id}Toggle subscriptionYes
DELETE/api/v1/notifications/subscriptions/{id}Xoá subscriptionYes
GET/api/v1/notifications/logsDelivery logsYes

Notification Channels

GET /api/v1/notifications/channels

Response (200 OK): NotificationChannel[]

FieldTypeMô tả
idstringID channel
channel_type'telegram' | 'lark' | 'email'Loại kênh
configRecord<string, string>Cấu hình kênh
is_verifiedbooleanĐã verify?
created_atstringThời gian tạo

Config theo loại:

ChannelConfig fields
telegram{ "bot_token": "...", "chat_id": "..." }
email{ "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

FieldTypeRequiredMô tả
channel_typestringYestelegram, lark, email
configRecord<string, string>YesCấ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[]

FieldTypeMô tả
idstringID subscription
insight_codestringMã insight
insight_namestringTên insight
channel_idstringID channel nhận
channel_typeChannelTypeLoại kênh
schedule'daily' | 'weekly' | 'monthly'Tần suất
granularitystringMức thời gian
countrystring?Filter quốc gia
is_activebooleanĐang hoạt động?
created_atstringThời gian tạo

Source: (api.service.ts:119-122)

POST /api/v1/notifications/subscriptions

Request Body: InsightSubscriptionCreateRequest

FieldTypeRequiredMô tả
insight_codestringYesMã insight
channel_idstringYesID channel
schedulestringYesdaily, weekly, monthly
granularitystringYesMức thời gian
countrystring?NoFilter 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[]

FieldTypeMô tả
idstringID log
subscription_idstringID subscription
insight_namestringTên insight
channel_typeChannelTypeLoại kênh
sent_atstringThời gian gửi (ISO)
status'success' | 'failed'Trạng thái
error_messagestring?Chi tiết lỗi (nếu failed)

Source: (api.service.ts:147-149)

Liên kết

Hệ thống tài liệu Boxme AI Insight — Powered by CodyMaster DocKit