📡 Broadcast Dashboard API

Gửi thông báo đến Discord & Telegram thông qua REST API.

🔑 Authentication

Tất cả API requests cần kèm API Key qua một trong 2 cách:

Authorization: Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b
hoặc
X-Api-Key: 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b

API Key của bạn:

745075b3be7052654e3f74320e8d176ca2d45b11c07e871b

⚠ Giữ bí mật API Key. Có thể tạo lại trong tab Cài đặt.

📮 Endpoints

POST /api/send

Gửi thông báo đến các kênh đã cài đặt.

Tham sốKiểuMô tả
contentstringNội dung thông báo (bắt buộc nếu không có image)
botIdsstring[]Danh sách ID bot. Bỏ trống = dùng tất cả bot
channelIdsstring[]Danh sách ID kênh. Bỏ trống = gửi tất cả kênh
imageBase64stringẢnh dạng data:image/png;base64,... (tùy chọn)
# Gửi tất cả kênh
curl -X POST http://localhost:3001/api/send \
  -H "Authorization: Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b" \
  -H "Content-Type: application/json" \
  -d '{"content":"🔥 Thông báo từ API!"}'

# Gửi kênh cụ thể
curl -X POST http://localhost:3001/api/send \
  -H "Authorization: Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Chỉ gửi kênh này",
    "channelIds": ["ch_id_1", "ch_id_2"]
  }'

Response

{
  "ok": true,
  "total": 3,
  "success": 3,
  "failed": 0,
  "results": [
    { "channel": "YATAKI", "bot": "Discord Bot", "platform": "discord", "ok": true },
    { "channel": "Nhóm Tele", "bot": "Tele Bot", "platform": "telegram", "ok": true }
  ]
}

GET /api/channels

Lấy danh sách tất cả kênh và mục đã cài đặt.

curl http://localhost:3001/api/channels \
  -H "Authorization: Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b"
{
  "categories": [
    {
      "id": "cat_xxx",
      "name": "Thông Báo Discord",
      "icon": "📢",
      "channels": [
        { "id": "ch_xxx", "name": "YATAKI", "platform": "discord" }
      ]
    }
  ]
}

GET /api/bots

Lấy danh sách bot (token được ẩn).

curl http://localhost:3001/api/bots \
  -H "Authorization: Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b"

💡 Ví dụ thực tế

Python

import requests

API_URL = "http://localhost:3001/api/send"
API_KEY = "745075b3be7052654e3f74320e8d176ca2d45b11c07e871b"

requests.post(API_URL,
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"content": "🚀 Deploy thành công!"}
)

Node.js

const res = await fetch("http://localhost:3001/api/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer 745075b3be7052654e3f74320e8d176ca2d45b11c07e871b",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ content: "Hello từ Node.js!" })
});
const data = await res.json();
console.log(data);

← Quay lại Dashboard