Notification API#

API thông báo realtime qua SSE (Server-Sent Events).

Base URL: https://app.socialking.vn/api/v1


1. SSE - Nhận thông báo Realtime#

GET /notification/stream #

Auth: JWT Token trong query string

Protocol: Server-Sent Events

Query Parameters:

ParamTypeMô tả
tokenstringJWT token cho SSE authentication

Response: SSE Stream

event: notification
data: {"id":"uuid","type":"system","message":"Automation completed","createdAt":"2026-03-30T10:30:00Z"}

2. Danh sách Thông báo#

GET /notification/list #

Auth: Bearer Token (JWT)

Rate Limit: 30 req/sec

Query Parameters:

ParamTypeDefaultMô tả
_pagenumber1Trang
_limitnumber20Items/trang
_orderstringdescasc | desc

Response (200):

{
  "success": true,
  "data": {
    "notifications": [
      {
        "id": "uuid-string",
        "type": "system",
        "message": "Automation XYZ completed",
        "read": false,
        "createdAt": "2026-03-30T10:30:00Z"
      }
    ],
    "total": 15
  }
}

3. Đánh dấu đã đọc#

PATCH /notification/:id/read #

Auth: Bearer Token (JWT)

URL Params: id (UUID)

Response (200):

{
  "success": true,
  "message": "Notification marked as read"
}

4. Đánh dấu tất cả đã đọc#

PATCH /notification/read-all #

Auth: Bearer Token (JWT)

Rate Limit: 5 req/sec

Response (200):

{
  "success": true,
  "message": "All notifications marked as read"
}