Integrations

DTAC · 3CX · Webhooks

Integrations

เชื่อมระบบโทรศัพท์ภายนอกเพื่อดึง recording เข้ามาให้อัตโนมัติ ตั้งค่าครั้งเดียวแล้วระบบ sync ให้เอง

DTAC orktrack

เชื่อม DTAC orktrack แล้วระบบจะดึง recording เข้ามาให้อัตโนมัติตามรอบที่ตั้งไว้ — credentials ถูกเก็บแบบเข้ารหัส

เริ่มใช้งาน

  1. Dashboard → Business → Settings → Providers
  2. Tab "Phone Integrations" → Add → kind = dtac
  3. กรอก baseUrl, username, password (default URL คือ onecallvoicerecord.dtac.co.th)
  4. กด Test connection เพื่อตรวจสอบว่าเชื่อมต่อได้
  5. Set as default — ระบบเริ่มดึง recording ให้อัตโนมัติ

3CX cloud

เชื่อม 3CX cloud ของคุณแล้วระบบจะดึง recording เข้ามาให้อัตโนมัติ — ถอดเสียง + สรุปด้วย AI พร้อม query ผ่าน API ได้เหมือน recording อื่น

ตั้งค่าครั้งเดียวที่ Dashboard → Business → Settings → Providers แล้วระบบจะ sync ให้เอง ไม่ต้องอัปโหลดไฟล์เอง

Webhooks

กำลังออกแบบ — server จะ POST ไป endpoint ของคุณเมื่อเกิดเหตุการณ์ เช่น recording.completed, ai.failed, billing.threshold ติดตาม changelog ได้ที่หน้า docs

Telegram & Notification gateway

นอกจากใช้ผ่านหน้า UI ของแพลตฟอร์ม ยังเชื่อม Telegram และยิงการแจ้งเตือนผ่าน public API ได้ — เหมาะกับระบบภายนอก (เช่น CRM) ที่ต้องการเป็นเจ้าของ event logic เอง แล้วใช้ CRK เป็นท่อส่ง (delivery pipe)

ออกแบบสำหรับ mapping แบบ 1 tenant ของระบบภายนอก ↔ 1 business ของ CRK: ระบบภายนอกถือ API token ที่ผูกกับ business เดียว แล้วส่ง x-business-id header (หรือใช้ business เริ่มต้นของ token) ในทุก request

สิทธิ์ (scopes)

Scopeใช้กับ
view_notificationsอ่าน status / chats / destinations / automations / preferences
manage_notificationsmint link-code, toggle/unlink chat, test, ส่งการแจ้งเตือน, สร้าง/แก้/ลบ/toggle automation, เชื่อม/ลบ Discord webhook, แก้ preferences

เชื่อม Telegram chat

แพลตฟอร์มใช้ bot Telegram กลางตัวเดียว (token ตั้งที่ฝั่ง server) — แต่ละ business เชื่อม chat ของตัวเองผ่าน flow /start <code>:

  1. เรียก POST /telegram/link-code → ได้ { code, deepLink, expiresInSec } (code อายุ 15 นาที)
  2. ระบบภายนอก render QR code หรือ deep link https://t.me/<bot>?start=<code> ให้ผู้ใช้สแกน/กด
  3. ผู้ใช้กด start ใน Telegram → chat ถูกผูกกับ business นั้น
  4. poll GET /telegram/chats จนกว่า chat ใหม่จะเข้า list (มี chatId, title, isActive)
  5. ส่งข้อความทดสอบผ่าน POST /telegram/chats/{id}/test เพื่อยืนยัน

เปิด/ปิดการส่งชั่วคราวด้วย PATCH /telegram/chats/{id} ({ isActive: false }) หรือถอด chat ออกด้วย DELETE /telegram/chats/{id} (error chat_not_found 404 ถ้า id ไม่ใช่ของ business นี้)

ยิงการแจ้งเตือน (send-now gateway)

POST /notifications/send รับ payload แล้วส่งออกทันทีตาม channel ที่เลือก — CRK เป็น pure delivery pipe, caller เป็นเจ้าของ event logic:

{
  "channel": "telegram",
  "chatId": "<id จาก /telegram/chats>",
  "title": "Lead ใหม่: คุณสมชาย",
  "body": "เบอร์ 08x-xxx-xxxx สนใจบ้านเดี่ยว โครงการ A",
  "link": "https://crm.example.com/leads/123",
  "severity": "info"
}
  • channel: "telegram" → ต้องส่ง chatId (เอาจาก GET /telegram/chats หรือ GET /notifications/destinations)
  • channel: "discord" → ต้องส่ง webhookId (เอาจาก GET /notifications/destinations; webhook URL ไม่เคยถูก return ผ่าน API)
  • channel: "in_app" → สร้าง row ใน feed ในแพลตฟอร์ม (ส่ง link ได้ใน data) แล้ว fan-out ผ่าน realtime ไปยังสมาชิกใน business

ถ้า Telegram/Discord API ล้มเหลว จะได้ { ok: false, error: "..." } กลับมาใน body (ไม่ใช่ HTTP error) เพื่อให้ caller retry ได้. Discord webhook ที่ไม่ใช่ของ business นี้แจ้ง discord_webhook_not_found (404)

⚠️ Payload ไม่มี field ของ AI model / provider / ต้นทุน — CRK ไม่เปิดเผยข้อมูลนั้นกับระบบภายนอก

จัดการ automation (กฎการแจ้งเตือน)

CRK เก็บ + ยิง automation เองตอนสายวิเคราะห์เสร็จ. ระบบภายนอกจัดการเป็น "rule" แบบแบน ได้ครบผ่าน public API (CRK compile เป็น flow graph ให้เอง — ไม่ต้องรู้จักโครงสร้าง graph):

  • GET /notifications/automations — รายการ automation + สถิติการส่ง (sent/failed/lastRunAt)
  • POST /notifications/automations — สร้างกฎใหม่จาก rule { name, conditions[], message, telegramChatIds[], discordWebhookIds[] } → คืน { id } (201)
  • GET /notifications/automations/{id} — อ่านกฎ (projected กลับเป็น rule); ถ้า graph ถูกแต่งซับซ้อนใน CRK UI เกิน shape ของ simple rule จะได้ rule: null, advanced: true (ให้แก้ใน CRK UI แทน)
  • PUT /notifications/automations/{id} — แทนที่ทั้งกฎ (recompile เป็น graph ใหม่)
  • PATCH /notifications/automations/{id} — เปิด/ปิด ({ enabled })
  • DELETE /notifications/automations/{id} — ลบ (automation_not_found 404)

rule มี trigger เดียว = สายวิเคราะห์เสร็จ. conditions เป็น call field (score/tag/sentiment/direction/...) AND/OR กัน (ว่าง = ทุกสาย); message ใส่ตัวแปร {{score}}, {{customer_phone}}, {{summary}} ฯลฯ; telegramChatIds = chat row id (จาก /telegram/chats), discordWebhookIds = webhook id (จาก /notifications/destinations).

จัดการ Discord webhook (ปลายทาง)

  • POST /notifications/discord — เชื่อม webhook ใหม่ { name, webhookUrl } (ต้องเป็น URL ของ discord(app).com มิฉะนั้นแจ้ง discord_invalid_webhook 422) → คืน { id } (201)
  • DELETE /notifications/discord/{id} — ถอด webhook (discord_webhook_not_found 404)

preferences

  • GET /notifications/preferences + PATCH /notifications/preferences — ค่าของผู้ใช้เจ้าของ token (inAppEnabled/sound/desktop/minSeverity/mutedRuleIds)
เอกสาร API