Skip to main content

LINE Official Account (Channel)

ภาพรวม

Domain นี้มี 2 ตาราง: line_oa เก็บข้อมูลการเชื่อมต่อ LINE Official Account แต่ละ channel (credential, webhook, การตั้งค่า sync ผู้ติดตาม, GA tracking, การจัดลำดับการตอบข้อความ) และ line_oa_app เก็บการเปิด/ปิดและ config ของแอปเสริมรายองค์กร

ตาราง line_oa

ColumnTypeNullableDefaultคำอธิบาย
idINTEGERNOT NULLnextval (serial)Primary key ของ LINE OA channel
organization_idINTEGERNOT NULLองค์กรเจ้าของ channel (FK ไป organization.id)
line_oa_nameTEXTNOT NULLชื่อ LINE OA ที่ใช้แสดงใน CMS
line_oa_hashTEXTNULLhash สำหรับอ้างถึง OA แบบสาธารณะ (ใช้ใน public URL)
channel_access_tokenTEXTNOT NULLChannel access token สำหรับเรียก LINE Messaging API
channel_idTEXTNOT NULLChannel ID จาก LINE Developers
channel_secret_idTEXTNOT NULLChannel secret ใช้ตรวจลายเซ็น webhook
channel_nameTEXTNOT NULLชื่อ channel ตามที่ตั้งไว้ใน LINE Developers
bot_basic_idTEXTNOT NULLBasic ID ของบอท (รูปแบบ @xxxxxxx)
premium_idTEXTNULLPremium ID ของ OA (ถ้าซื้อ premium ID ไว้)
sync_follower_statusSyncFollowerStatus (enum)NOT NULLno_actionสถานะการ sync รายชื่อผู้ติดตาม: no_action, active, processing, completed, failed
sync_follower_logsTEXTNULLlog/ข้อความผลลัพธ์จากการ sync ผู้ติดตามครั้งล่าสุด
last_sync_followers_dateTIMESTAMPTZ(3)NULLวันเวลาที่ sync ผู้ติดตามสำเร็จครั้งล่าสุด
webhook_idTEXTNOT NULLตัวระบุ webhook ที่ระบบสร้างให้ ใช้เป็น path ของ webhook URL
forward_webhook_urlTEXTNULL''URL ปลายทางสำหรับ forward event ต่อไปยังระบบภายนอก (ว่าง = ไม่ forward)
coverTEXTNOT NULL''URL/path ของรูปหน้าปก OA
line_login_infoJSONBNULLข้อมูล LINE Login channel ที่ผูกกับ OA นี้
audience_refresh_enabledBOOLEANNOT NULLfalseเปิด/ปิดการรีเฟรชสมาชิก audience อัตโนมัติ
audience_refresh_intervalINTEGERNOT NULL60ระยะห่างของการรีเฟรช audience (นาที)
ga_tracking_enabledBOOLEANNOT NULLfalseเปิด/ปิดการแนบพารามิเตอร์ติดตามผลไปยัง Google Analytics
ga_identity_paramVARCHAR(50)NOT NULL'lid'ชื่อ query parameter ที่ใช้ส่ง identity ไปยัง GA
message_handling_configJSONBNOT NULL{"priority": "auto_response_only"}การตั้งค่าลำดับความสำคัญของการตอบข้อความขาเข้า
statusCommonStatus (enum)NOT NULLสถานะของ channel (active, inactive, delete ฯลฯ)
created_dateTIMESTAMPTZ(3)NOT NULLCURRENT_TIMESTAMPวันที่สร้าง
created_byINTEGERNOT NULL0user id ของผู้สร้าง
updated_dateTIMESTAMPTZ(3)NULLวันที่แก้ไขล่าสุด (Prisma @updatedAt)
updated_byINTEGERNULL0user id ของผู้แก้ไขล่าสุด
deleted_dateTIMESTAMPTZ(3)NULLวันที่ลบแบบ soft delete

ตาราง line_oa_app

ColumnTypeNullableDefaultคำอธิบาย
idINTEGERNOT NULLnextval (serial)Primary key
organization_idINTEGERNOT NULLองค์กรที่เปิดใช้แอปนี้
app_idVARCHAR(50)NOT NULLรหัสแอปเสริม (ตัวระบุแบบสตริง)
enabledBOOLEANNOT NULLfalseเปิดใช้งานแอปนี้หรือไม่
configJSONBNULLค่า config เฉพาะของแอปนั้นๆ
created_byINTEGERNULLuser id ของผู้สร้าง
created_dateTIMESTAMPTZ(3)NOT NULLCURRENT_TIMESTAMPวันที่สร้าง
updated_dateTIMESTAMPTZ(3)NULLวันที่แก้ไขล่าสุด

หมายเหตุ

  • Foreign key: line_oa.organization_id -> organization.id ตาราง line_oa ถูกอ้างถึงด้วย line_oa_id จากตารางจำนวนมาก เช่น line_user, campaign, rich_message, rich_menu, tracking_log, template_message, tracking_token, form_builder, menu_builder, attribute_master, content_page, content_category, content_link, friend_track_campaign
  • Index ของ line_oa: (webhook_id, status, organization_id), (line_oa_hash, status, organization_id) และ deleted_date — สองตัวแรกรองรับการค้นหา channel ตอนรับ webhook และตอนเปิด public URL
  • line_oa_app ผูกกับองค์กร ไม่ได้ผูกกับ channel — ไม่มีคอลัมน์ line_oa_id แม้ชื่อตาราง จะขึ้นต้นด้วย line_oa โดยมี unique constraint (organization_id, app_id) และ index บน organization_id
  • message_handling_config เป็น JSON object ที่มี key priority ค่า default คือ auto_response_only
  • คอลัมน์ channel_access_token และ channel_secret_id เป็นข้อมูลลับ ไม่ควร log หรือส่งออกทาง API ที่เปิดสาธารณะ
  • ไม่มีตาราง mbox แยกใน domain นี้ — placeholder เดิมของหน้านี้กล่าวถึง mbox ไว้ แต่ในสคีมาจริง มีเพียง line_oa และ line_oa_app