Platform
Connect
Connect

Connect

Connect คือ omnichannel inbox + chat widget ที่สร้างขึ้นบน PBCP — ทำให้ทีม admin คุยกับลูกค้าได้จากทุก channel ในที่เดียว พร้อม Customer Story เต็มรูปแบบข้างๆ หน้าจอ และส่ง coupon หรือ reward ได้โดยไม่ต้องออกจาก inbox

ปัญหาที่ Connect แก้

ธุรกิจส่วนใหญ่คุยกับลูกค้าอยู่ใน 3–4 ที่พร้อมกัน — Facebook Page, LINE OA, Email, และ chat หน้าเว็บ admin ต้องสลับ tab, ไม่รู้ว่าลูกค้าที่ถามใน LINE คือคนเดียวกับที่ complain ใน Facebook หรือเปล่า และไม่มีข้อมูลพื้นหลังของลูกค้าตอนตอบ

Connect แก้ทั้งสามอย่างพร้อมกัน


ภาพรวม Architecture

ลูกค้า

  ├── LINE OA ─────────────┐
  ├── Facebook Messenger ──┤
  ├── Web Chat Widget ─────┤──► Channel Adapters ──► Unified Inbox
  └── Email ───────────────┘                              │

                                               ┌──────────────────────┐
                                               │   Admin workspace     │
                                               │                      │
                                               │  [Conversation]      │
                                               │  [Customer Story] ◄──┼── PBCP Core
                                               │  [AI Suggestion] ◄───┼── Content OS
                                               │  [Send Reward] ◄─────┼── Intelligence
                                               └──────────────────────┘

                                               conversation.* events


                                                     PBCP Core
                                               (Q&A corpus + Customer Story)

Unified Inbox

Admin เห็น conversation จากทุก channel ในหน้าเดียว แต่ละ thread แสดง:

  • Channel badge — LINE / Facebook / Email / Web
  • Customer name — resolve จาก PIP ข้าม channel อัตโนมัติ
  • Last message + timestamp
  • Status — open / pending / resolved
  • Assigned to — staff คนไหนรับไว้

เมื่อเปิด conversation ขึ้นมา panel ด้านขวาแสดง Customer Story จาก PBCP ทันที:

┌──────────────────────────────┬──────────────────────────────┐
│  Conversation                │  Customer Story              │
│                              │                              │
│  [LINE]  คุณสมชาย            │  ลูกค้า: สมชาย จันทร์ดี     │
│  "ยา Amlodipine หมดแล้ว     │  Segment: loyal              │
│   สั่งซื้อได้มั้ยครับ"       │  Last visit: 3 วันที่แล้ว   │
│                              │  ยาประจำ: Amlodipine 5mg    │
│  [Reply box]                 │  ซื้อซ้ำทุก: ~28 วัน        │
│                              │  Churn risk: low ✅          │
│  💊 Suggest: "ได้เลยครับ     │                              │
│  Amlodipine 5mg 30 เม็ด     │  [ดู full story →]           │
│  ราคา ฿180 จัดส่งได้วันนี้   │                              │
│  ต้องการสั่งเลยไหมครับ?"     │                              │
│                              │                              │
│  [✓ Send]  [Edit]  [Reward]  │                              │
└──────────────────────────────┴──────────────────────────────┘

AI-Suggested Replies

ทุก conversation ที่เข้ามา Connect ดึงข้อมูล 3 ชั้นมา generate คำตอบให้ admin:

ชั้น 1 — Customer Story (PBCP): ลูกค้าคนนี้เป็นใคร ซื้ออะไร มีปัญหาอะไรค้างอยู่

ชั้น 2 — Q&A Corpus (Connect): คำถามแบบนี้เคยถูกตอบไปอย่างไร ตอบแล้ว customer พอใจไหม

ชั้น 3 — Brand DNA (Content OS): ร้านนี้ใช้ tone อะไร formal หรือ friendly คำศัพท์ที่ใช้ประจำคืออะไร

admin กด ✓ Send ส่งได้เลย หรือแก้ก่อนส่ง — ไม่ต้องพิมพ์เองทั้งหมด


Chatbot Mode

เมื่อไม่มี admin online หรือคำถามตรงกับ Q&A corpus ชัดเจน Chatbot ตอบอัตโนมัติได้

Routing logic:

ลูกค้าส่งข้อความ

  Chatbot ดู Q&A corpus

  confidence ≥ 80% → ตอบอัตโนมัติ
  confidence < 80% → ส่งให้ admin + notify
  นอก business hours → auto-reply + queue

Chatbot ทุกตัวอ่าน Brand DNA ก่อน — ไม่มีการตอบ off-brand และรู้ domain ของธุรกิจ เช่น pharmacy chatbot รู้เรื่องยา, hotel chatbot รู้เรื่อง reservation


Send Rewards & Coupons

Intelligence detect signal แล้ว → admin ส่ง reward ได้จากใน conversation thread เลย ไม่ต้องออกไปทำที่อื่น

ตัวอย่างสถานการณ์:

สถานการณ์Intelligence signalAdmin ทำได้
ลูกค้า complain ล่าช้าcomplaint.raisedกด Send Coupon → ส่วนลด 10% order ถัดไป
ลูกค้า loyal ถามซื้อซ้ำsegment: loyalกด Send Reward → แต้มพิเศษ 2x
ลูกค้า at-risk ถามขอยกเลิกchurn_risk: highกด Send Offer → ดีลพิเศษรักษาไว้
วันเกิดลูกค้าbirthday.offer_sentMessage + coupon ส่งในช่อง LINE ที่เขาใช้อยู่

ลูกค้าได้รับ reward ในช่องทางที่เขากำลังคุยอยู่ — ไม่ต้องไปรับที่อื่น ทำให้ประสบการณ์ต่อเนื่องและน่าประทับใจ


Web Chat Widget

สำหรับธุรกิจที่มีเว็บหรือ app ติดตั้ง Connect Widget ได้ด้วย script 1 บรรทัด:

<script
  src="https://connect.pcampus.app/widget.js"
  data-tenant="your-tenant-id"
  data-position="bottom-right"
  data-color="#2563eb"
></script>

Widget รู้ว่าใครกำลัง login อยู่ ทำให้ Chatbot ทักทายด้วยชื่อได้และดึง context จาก PBCP ได้ทันที ไม่ต้องถามข้อมูลพื้นฐานซ้ำ

Identity: ใช้ auth provider ที่มีอยู่ได้เลย

Connect ไม่บังคับให้เปลี่ยนมาใช้ PIP — รองรับ External Identity Provider ผ่าน token exchange ทำให้ธุรกิจที่ใช้ Firebase Auth, Auth0, Supabase, Clerk หรือ custom JWT อยู่แล้วไม่ต้อง migrate อะไรเลย

กรณี Firebase Auth (พบบ่อยที่สุด):

import { getAuth } from 'firebase/auth'
 
const auth = getAuth()
const token = await auth.currentUser.getIdToken()
 
ConnectWidget.init({
  tenant: 'your-tenant-id',
  identityProvider: 'firebase',
  identityToken: token,        // ← Firebase ID Token
  position: 'bottom-right',
  color: '#2563eb'
})

กรณี provider อื่น:

ConnectWidget.init({
  tenant: 'your-tenant-id',
  identityProvider: 'custom',
  jwksUri: 'https://your-auth-server/.well-known/jwks.json',
  identityToken: yourJwtToken
})

External IdP Flow

ลูกค้า login ด้วย Firebase / Auth0 / etc.

app เรียก getIdToken()

ส่ง token เข้า ConnectWidget.init()

Connect backend verify token
(ใช้ Firebase public JWKS — ไม่ต้องการ service account key)

ดึง email / phone จาก token claims

Match กับ PBCP customer record
  ├─ เจอ → bind external_uid → customer ทันที
  └─ ไม่เจอ → สร้าง customer ใหม่ + bind อัตโนมัติ

ออก Connect session token (short-lived)

Widget รู้จักลูกค้า → ดึง Customer Story ได้เลย

การ bind เกิดขึ้น ครั้งเดียวอัตโนมัติ — ลูกค้าไม่รู้สึกถึงขั้นตอนนี้เลย ครั้งต่อไปที่ login ระบบ resolve identity ทันที

ตั้งค่าใน Console (ทำครั้งเดียว)

ก่อนใช้ External IdP ต้อง register provider ใน PBCP Console:

Providerข้อมูลที่ต้องใส่
FirebaseFirebase Project ID
Auth0Domain + Audience
SupabaseProject URL + JWT Secret
Custom JWTJWKS URI หรือ Public Key (RS256/ES256)

Connect ใช้ public key / JWKS endpoint verify token โดยไม่ต้องขอ service account key — ปลอดภัยกว่าการแชร์ credentials

Claims ที่ Connect ใช้ resolve identity

PriorityClaimหมายเหตุ
1emailตรงกับ PBCP customer email
2phone_numberตรงกับ PBCP customer phone
3sub (UID)fallback — สร้าง customer ใหม่ถ้าไม่เจอ

Widget ที่ปรับได้ตาม domain:

// Pharmacy — แสดงปุ่มลัด
{
  quickActions: ["ประวัติยา", "สั่งยาซ้ำ", "ปรึกษาเภสัชกร"]
}
 
// Hotel — แสดง reservation ปัจจุบัน
{
  quickActions: ["ดูการจอง", "ขอ late checkout", "room service"]
}
 
// Restaurant — แสดง membership tier
{
  quickActions: ["ยอด points", "จองโต๊ะ", "โปรโมชั่นวันนี้"]
}

Q&A Corpus → Intelligence Feedback Loop

ทุก conversation ที่ resolved กลายเป็น training data ของ Intelligence:

conversation.resolved

  Q&A pair บันทึกลง corpus
  (คำถาม + คำตอบ + customer profile + outcome)

  Intelligence เรียนรู้ pattern:
  "ลูกค้า segment นี้ มักถามเรื่องนี้ ในช่วงนี้"

  Proactive message: ส่งคำตอบก่อนที่เขาจะถาม

ยิ่งใช้ Connect นาน ระบบยิ่ง proactive มากขึ้น


Events ที่ Connect ส่งกลับ PBCP

Eventเกิดเมื่อ
conversation.startedลูกค้าส่งข้อความครั้งแรก
message.receivedได้รับข้อความจากลูกค้า
message.sentadmin หรือ chatbot ตอบ
suggestion.acceptedadmin กด Send ตาม AI suggestion
suggestion.editedadmin แก้ suggestion แล้วส่ง
reward.sent_via_chatส่ง coupon / reward ใน conversation
conversation.escalatedchatbot ส่งต่อให้ admin
conversation.resolvedปิด conversation
feedback.givenลูกค้า rate conversation

ข้อมูลเหล่านี้เข้า Customer Story — ทำให้ Pulse เห็น timeline การสนทนาควบคู่กับ transaction history


Evaluation Signals — วัดผล AI และ Human

Connect เป็นจุดที่ข้อมูลประเมินผลเกิดขึ้น — ทุก interaction ที่เกิดขึ้นใน inbox คือ signal ที่ Intelligence ใช้เรียนรู้

AI Quality Signals

EventความหมายIntelligence เรียนรู้อะไร
suggestion.acceptedadmin ส่ง reply ตาม AI เลยsuggestion นี้ถูกต้อง context นี้
suggestion.editedadmin แก้ก่อนส่งแก้ตรงไหน → ปรับ Q&A corpus
suggestion.dismissedadmin ไม่ใช้AI miss — ต้องเรียนรู้ pattern นี้ใหม่
chatbot.answeredchatbot ตอบอัตโนมัติ
chatbot.escalatedchatbot ตอบไม่ได้ → ส่งต่อ admintopic นี้ต้องเพิ่มใน Q&A

Human Quality Signals

Signalเก็บจากใช้วัด
First response timetimestamp ระหว่าง message.receivedmessage.sent แรกความเร็วของ admin แต่ละคน
Resolution timetimestamp ระหว่าง conversation.startedconversation.resolvedประสิทธิภาพ overall
CSAT scorefeedback.given event (ลูกค้า rate 1–5 หลัง resolved)customer satisfaction
Edit distanceเปรียบ suggestion กับ message จริงที่ส่งว่า AI แม่นแค่ไหน

Outcome Attribution Signals

Connect บันทึก context ของ conversation ไว้กับ Customer Story — เมื่อ business event เกิดขึ้นหลังจากนั้น Intelligence สามารถ attribute ว่า action ใดนำไปสู่ผล:

conversation.resolved (ส่ง coupon WINBACK10)
    ↓ 5 วันต่อมา
order.placed (ใช้ WINBACK10)

Intelligence บันทึก: "win-back coupon after at_risk conversation → conversion = true"

recommendation confidence สำหรับ at_risk segment เพิ่มขึ้น

Evaluation Dashboard (Console — MVP2)

Console → Connect → Analytics:

หน้าข้อมูลที่แสดง
AI PerformanceSuggestion acceptance rate, edit distance avg, chatbot resolution rate per topic
Staff PerformanceResponse time, resolution time, CSAT per staff — ไม่ใช่ ranking แต่เป็น coaching insight
OutcomeConversion rate ต่อ action type (coupon, reminder, recommendation)
Trendเปรียบ AI quality สัปดาห์นี้ vs. สัปดาห์ก่อน — ระบบดีขึ้นไหม

ความต่างจาก Intercom / Zendesk

ฟีเจอร์ConnectIntercom / Zendesk
Unified inbox
Chat widget
AI reply suggestion✅ (generic)
Customer Story จาก transactional data✅ (PBCP)
Domain-aware context (pharmacy, hotel, etc.)
ส่ง coupon / reward จากใน chat
Q&A → Intelligence proactive loop
Brand DNA-driven tone per tenant✅ (Content OS)

MVP Channels

PhaseChannels
MVPLINE OA, Facebook Messenger, Web Widget
Phase 2Email (inbound), Instagram DM
FutureWhatsApp Business, TikTok DM

Intelligence API → · Notification → · Content OS →

Connect

Connect is an omnichannel inbox + chat widget built on PBCP — enabling the admin team to talk to customers from every channel in one place, with a full Customer Story panel alongside the screen, and the ability to send coupons or rewards without leaving the inbox.

The Problem Connect Solves

Most businesses are juggling 3–4 places to talk to customers at once — Facebook Page, LINE OA, Email, and web chat. Admins have to switch tabs constantly, never knowing whether the customer asking on LINE is the same one who complained on Facebook, and they have no customer background when replying.

Connect solves all three at once.


Architecture Overview

ลูกค้า

  ├── LINE OA ─────────────┐
  ├── Facebook Messenger ──┤
  ├── Web Chat Widget ─────┤──► Channel Adapters ──► Unified Inbox
  └── Email ───────────────┘                              │

                                               ┌──────────────────────┐
                                               │   Admin workspace     │
                                               │                      │
                                               │  [Conversation]      │
                                               │  [Customer Story] ◄──┼── PBCP Core
                                               │  [AI Suggestion] ◄───┼── Content OS
                                               │  [Send Reward] ◄─────┼── Intelligence
                                               └──────────────────────┘

                                               conversation.* events


                                                     PBCP Core
                                               (Q&A corpus + Customer Story)

Unified Inbox

Admins see conversations from every channel on one page. Each thread shows:

  • Channel badge — LINE / Facebook / Email / Web
  • Customer name — resolved from PIP across channels automatically
  • Last message + timestamp
  • Status — open / pending / resolved
  • Assigned to — which staff member picked it up

When a conversation is opened, the right panel immediately displays the Customer Story from PBCP:

┌──────────────────────────────┬──────────────────────────────┐
│  Conversation                │  Customer Story              │
│                              │                              │
│  [LINE]  คุณสมชาย            │  ลูกค้า: สมชาย จันทร์ดี     │
│  "ยา Amlodipine หมดแล้ว     │  Segment: loyal              │
│   สั่งซื้อได้มั้ยครับ"       │  Last visit: 3 วันที่แล้ว   │
│                              │  ยาประจำ: Amlodipine 5mg    │
│  [Reply box]                 │  ซื้อซ้ำทุก: ~28 วัน        │
│                              │  Churn risk: low ✅          │
│  💊 Suggest: "ได้เลยครับ     │                              │
│  Amlodipine 5mg 30 เม็ด     │  [ดู full story →]           │
│  ราคา ฿180 จัดส่งได้วันนี้   │                              │
│  ต้องการสั่งเลยไหมครับ?"     │                              │
│                              │                              │
│  [✓ Send]  [Edit]  [Reward]  │                              │
└──────────────────────────────┴──────────────────────────────┘

AI-Suggested Replies

For every incoming conversation, Connect pulls from 3 layers to generate a reply for the admin:

Layer 1 — Customer Story (PBCP): Who this customer is, what they've bought, and any outstanding issues

Layer 2 — Q&A Corpus (Connect): How questions like this have been answered before, and whether the customer was satisfied

Layer 3 — Brand DNA (Content OS): What tone this store uses — formal or friendly — and what vocabulary is regularly used

The admin can press ✓ Send to send as-is, or edit before sending — no need to type everything from scratch.


Chatbot Mode

When no admin is online, or when the question clearly matches the Q&A corpus, the Chatbot can respond automatically.

Routing logic:

ลูกค้าส่งข้อความ

  Chatbot ดู Q&A corpus

  confidence ≥ 80% → ตอบอัตโนมัติ
  confidence < 80% → ส่งให้ admin + notify
  นอก business hours → auto-reply + queue

Every Chatbot reads Brand DNA first — responses are never off-brand, and the chatbot understands the business domain — for example, a pharmacy chatbot knows about medications, and a hotel chatbot knows about reservations.


Send Rewards & Coupons

Once Intelligence detects a signal → the admin can send a reward directly from inside the conversation thread without going anywhere else.

Example scenarios:

SituationIntelligence signalWhat Admin Can Do
Customer complains about delaycomplaint.raisedPress Send Coupon → 10% off next order
Loyal customer asks to repurchasesegment: loyalPress Send Reward → bonus 2x points
At-risk customer asks to cancelchurn_risk: highPress Send Offer → special retention deal
Customer birthdaybirthday.offer_sentMessage + coupon sent in the LINE channel they're using

Customers receive the reward in the channel they are currently using — no need to go elsewhere — creating a seamless and memorable experience.


Web Chat Widget

For businesses with a website or app, the Connect Widget can be installed with a single script line:

<script
  src="https://connect.pcampus.app/widget.js"
  data-tenant="your-tenant-id"
  data-position="bottom-right"
  data-color="#2563eb"
></script>

The Widget knows who is currently logged in, enabling the Chatbot to greet them by name and immediately pull context from PBCP — without asking for basic information again.

Identity: Use Your Existing Auth Provider

Connect does not require switching to PIP — it supports External Identity Providers via token exchange, so businesses already using Firebase Auth, Auth0, Supabase, Clerk, or custom JWT do not need to migrate anything.

Firebase Auth (most common):

import { getAuth } from 'firebase/auth'
 
const auth = getAuth()
const token = await auth.currentUser.getIdToken()
 
ConnectWidget.init({
  tenant: 'your-tenant-id',
  identityProvider: 'firebase',
  identityToken: token,        // ← Firebase ID Token
  position: 'bottom-right',
  color: '#2563eb'
})

Other providers:

ConnectWidget.init({
  tenant: 'your-tenant-id',
  identityProvider: 'custom',
  jwksUri: 'https://your-auth-server/.well-known/jwks.json',
  identityToken: yourJwtToken
})

External IdP Flow

ลูกค้า login ด้วย Firebase / Auth0 / etc.

app เรียก getIdToken()

ส่ง token เข้า ConnectWidget.init()

Connect backend verify token
(ใช้ Firebase public JWKS — ไม่ต้องการ service account key)

ดึง email / phone จาก token claims

Match กับ PBCP customer record
  ├─ เจอ → bind external_uid → customer ทันที
  └─ ไม่เจอ → สร้าง customer ใหม่ + bind อัตโนมัติ

ออก Connect session token (short-lived)

Widget รู้จักลูกค้า → ดึง Customer Story ได้เลย

The bind happens once, automatically — customers never notice this step. The next time they log in, the system resolves their identity instantly.

Console Setup (One-Time)

Before using an External IdP, register the provider in PBCP Console:

ProviderRequired Information
FirebaseFirebase Project ID
Auth0Domain + Audience
SupabaseProject URL + JWT Secret
Custom JWTJWKS URI or Public Key (RS256/ES256)

Connect verifies tokens via public key / JWKS endpoint without requiring a service account key — safer than sharing credentials.

Claims Used by Connect to Resolve Identity

PriorityClaimNotes
1emailMatched against PBCP customer email
2phone_numberMatched against PBCP customer phone
3sub (UID)Fallback — creates a new customer if not found

Domain-Customizable Widget:

// Pharmacy — แสดงปุ่มลัด
{
  quickActions: ["ประวัติยา", "สั่งยาซ้ำ", "ปรึกษาเภสัชกร"]
}
 
// Hotel — แสดง reservation ปัจจุบัน
{
  quickActions: ["ดูการจอง", "ขอ late checkout", "room service"]
}
 
// Restaurant — แสดง membership tier
{
  quickActions: ["ยอด points", "จองโต๊ะ", "โปรโมชั่นวันนี้"]
}

Q&A Corpus → Intelligence Feedback Loop

Every resolved conversation becomes training data for Intelligence:

conversation.resolved

  Q&A pair บันทึกลง corpus
  (คำถาม + คำตอบ + customer profile + outcome)

  Intelligence เรียนรู้ pattern:
  "ลูกค้า segment นี้ มักถามเรื่องนี้ ในช่วงนี้"

  Proactive message: ส่งคำตอบก่อนที่เขาจะถาม

The longer Connect is used, the more proactive the system becomes.


Events That Connect Sends Back to PBCP

EventTriggered when
conversation.startedCustomer sends their first message
message.receivedA message is received from the customer
message.sentAdmin or chatbot replies
suggestion.acceptedAdmin presses Send following the AI suggestion
suggestion.editedAdmin edits the suggestion before sending
reward.sent_via_chatA coupon / reward is sent in the conversation
conversation.escalatedChatbot escalates to admin
conversation.resolvedConversation is closed
feedback.givenCustomer rates the conversation

This data flows into the Customer Story — allowing Pulse to display the conversation timeline alongside the transaction history.


Evaluation Signals — Measuring AI and Human Performance

Connect is the point where evaluation data is generated — every interaction in the inbox is a signal that Intelligence uses to learn.

AI Quality Signals

EventMeaningWhat Intelligence Learns
suggestion.acceptedAdmin sends the AI reply as-isThis suggestion was correct in this context
suggestion.editedAdmin edits before sendingWhat was edited → adjust the Q&A corpus
suggestion.dismissedAdmin does not use itAI miss — must relearn this pattern
chatbot.answeredChatbot responds automatically
chatbot.escalatedChatbot cannot answer → escalates to adminThis topic needs to be added to the Q&A

Human Quality Signals

SignalCollected fromUsed to measure
First response timeTimestamp between message.received → first message.sentSpeed of each admin
Resolution timeTimestamp between conversation.startedconversation.resolvedOverall efficiency
CSAT scorefeedback.given event (customer rates 1–5 after resolved)Customer satisfaction
Edit distanceCompare suggestion against the actual message sentHow accurate the AI is

Outcome Attribution Signals

Connect records the conversation context in the Customer Story — when a business event occurs afterward, Intelligence can attribute which action led to the outcome:

conversation.resolved (ส่ง coupon WINBACK10)
    ↓ 5 วันต่อมา
order.placed (ใช้ WINBACK10)

Intelligence บันทึก: "win-back coupon after at_risk conversation → conversion = true"

recommendation confidence สำหรับ at_risk segment เพิ่มขึ้น

Evaluation Dashboard (Console — MVP2)

Console → Connect → Analytics:

PageData Displayed
AI PerformanceSuggestion acceptance rate, edit distance avg, chatbot resolution rate per topic
Staff PerformanceResponse time, resolution time, CSAT per staff — not a ranking, but a coaching insight
OutcomeConversion rate per action type (coupon, reminder, recommendation)
TrendCompare AI quality this week vs. last week — is the system improving?

How Connect Differs from Intercom / Zendesk

FeatureConnectIntercom / Zendesk
Unified inbox
Chat widget
AI reply suggestion✅ (generic)
Customer Story from transactional data✅ (PBCP)
Domain-aware context (pharmacy, hotel, etc.)
Send coupon / reward from within chat
Q&A → Intelligence proactive loop
Brand DNA-driven tone per tenant✅ (Content OS)

MVP Channels

PhaseChannels
MVPLINE OA, Facebook Messenger, Web Widget
Phase 2Email (inbound), Instagram DM
FutureWhatsApp Business, TikTok DM

Intelligence API → · Notification → · Content OS →