Intelligence (inside PBCP)
API Base: https://pbcp-api.pcampus.co/v1/intelligence
Recommendations: https://pbcp-api.pcampus.co/v1/recommendations
Overview
Intelligence อยู่ใน PBCP — ไม่แยกขาย ไม่มี SKU ของตัวเอง เปิด PBCP แล้วได้ชั้นแนะนำนี้ด้วย
PBCP Intelligence คือ analytics and recommendation layer ที่นั่งอยู่บน Business Context และเปลี่ยน context ให้กลายเป็น actionable insights — ตอบคำถามที่เจ้าของธุรกิจต้องการจริงๆ:
- ใครกำลังจะหายไป? → ส่งคูปองดึงกลับ
- กลุ่มไหนตอบสนอง campaign นี้ดีที่สุด? → target เฉพาะกลุ่มนั้น
- ลูกค้าคนนี้ควรได้รับอะไรต่อไป? → personalized offer รายบุคคล
Boundary: Intelligence วิเคราะห์และแนะนำ — ไม่ส่ง LINE, email, push เอง Execution อยู่ใน customer app (เช่น Pharmacy App)
Position in PBCP stack
Intelligence อ่านจาก Context API เท่านั้น — ไม่เคย query Event Store โดยตรง
Four intelligence pillars
1. Customer Intelligence
วิเคราะห์ลูกค้าระดับรายคน:
| Signal | ตอบอะไร |
|---|---|
| Purchase frequency | ลูกค้าคนนี้ซื้อทุกกี่วัน |
| Average basket size | ใช้จ่ายเฉลี่ยต่อครั้งเท่าไหร่ |
| Category affinity | ชอบสินค้าประเภทไหน |
| Churn risk score | โอกาสที่จะหายไปมากแค่ไหน (0–1) |
| Lifetime value | มูลค่าสะสมตลอดอายุลูกค้า |
2. Segment Intelligence
จัดกลุ่มลูกค้าอัตโนมัติจาก behavior:
| Segment | ลักษณะ |
|---|---|
| Champions | ซื้อบ่อย มูลค่าสูง ล่าสุดไม่นาน |
| Loyal | ซื้อสม่ำเสมอ แต่ basket ไม่ใหญ่ |
| At Risk | เคยดี แต่หยุดซื้อมาสักพัก |
| Lost | ไม่ซื้อมานานมาก |
| New | ซื้อครั้งแรกไม่นาน |
| High Value | basket ใหญ่แต่ซื้อไม่บ่อย |
Segment ใช้ RFM model (Recency · Frequency · Monetary) เป็น baseline — ปรับ weight ได้ต่อ domain
3. Campaign Intelligence
วัดผลและเปรียบเทียบ campaign:
| Metric | ความหมาย |
|---|---|
| Response rate | % ลูกค้าที่ทำ action หลังได้รับ offer |
| Revenue uplift | รายได้ที่เพิ่มขึ้นเทียบกับ baseline |
| Segment fit | campaign นี้ work กับกลุ่มไหน |
| Coupon redemption | % คูปองที่ถูกใช้จริง |
| Cannibalization | offer ลดยอดขาย full-price หรือเปล่า |
4. Journey Intelligence
วิเคราะห์ funnel และ path:
- ลูกค้าหายไปตรงไหนมากที่สุด
- path ที่นำไปสู่ purchase ที่เร็วที่สุดคืออะไร
- session ที่ convert มีพฤติกรรมอะไรที่แตกต่าง
5. Evaluation Intelligence
วัดผลและเรียนรู้จาก action ที่เกิดขึ้นจริง — ทำให้ Intelligence ฉลาดขึ้นในทุกรอบ
AI Quality Metrics:
| Signal | ข้อมูลที่ได้ |
|---|---|
suggestion.accepted | AI suggestion แม่นพอที่ admin ใช้ได้เลย |
suggestion.edited + edit distance | แก้มากแค่ไหน → คะแนน accuracy |
suggestion.dismissed | AI miss ทิ้ง → ต้องปรับ Q&A corpus |
chatbot.resolved vs chatbot.escalated | Chatbot resolution rate per topic |
Human Quality Metrics:
| Metric | ความหมาย |
|---|---|
| First response time | admin ตอบลูกค้าเร็วแค่ไหน |
| Resolution time | ปิด conversation ภายในกี่นาที |
| CSAT score | ลูกค้า rate ความพึงพอใจ (1–5) |
| Suggestion usage rate | ใช้ AI vs. พิมพ์เอง |
Outcome Attribution:
| Action | Outcome วัด |
|---|---|
| ส่ง coupon ผ่าน Connect | ลูกค้าใช้คูปองภายใน N วัน? |
| ส่ง LINE Flex Message | open → click → conversion? |
| ส่ง email digest | open rate, click rate, re-purchase? |
| ลด churn risk prediction | ลูกค้ายังอยู่ใน 30 วัน? |
ทุก signal รวมกันเป็น (context → action → outcome) tuples — เก็บใน Evaluation Store และ feed กลับเข้า Intelligence เพื่อปรับ scoring และ recommendation
Recommendation Engine
หัวใจของ Intelligence — เอา insights ทั้งหมดมาแปลงเป็น structured recommendations ที่ customer app นำไปใช้ได้ทันที
รายบุคคล (Individual)
Output ตัวอย่าง:
{
"customerId": "cust_xxx",
"segment": "at_risk",
"churnRisk": 0.78,
"recommendations": [
{
"type": "coupon",
"reason": "high_churn_risk",
"offer": "10% off next purchase",
"targetCategory": "vitamins",
"confidence": 0.82,
"validDays": 7
},
{
"type": "reward",
"reason": "loyalty_recognition",
"offer": "bonus points x2",
"confidence": 0.74
}
]
}รายกลุ่ม (Segment)
Output ตัวอย่าง:
{
"segment": "at_risk",
"audienceSize": 142,
"recommendations": [
{
"type": "campaign",
"name": "comeback_offer",
"description": "ส่งคูปอง 15% สำหรับลูกค้าที่ไม่ซื้อ 45+ วัน",
"expectedResponseRate": 0.24,
"expectedRevenueLift": 18500,
"suggestedChannels": ["line_oa", "sms"]
}
]
}Full data flow
Pilot — ร้านยา (Pharmacy)
| Use case | Intelligence ทำอะไร | Execution |
|---|---|---|
| คนไข้ที่ใช้ยาต่อเนื่องไม่ได้กลับมา | Churn risk → recommend coupon | Pharmacy ส่ง LINE OA |
| คนไข้กลุ่มผู้สูงอายุ | Segment → recommend วิตามิน campaign | Pharmacy broadcast SMS |
| โปรโมชั่นไหนได้ผลดีสุด | Campaign intelligence → ROI report | แสดงใน Pulse |
| ลูกค้าใหม่ซื้อครั้งแรก | New segment → onboarding reward | Pharmacy ส่ง push notification |
API overview
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/intelligence/customers/:id | Customer intelligence profile |
GET | /v1/intelligence/segments | List auto-generated segments + sizes |
GET | /v1/intelligence/segments/:segment | Segment intelligence detail |
GET | /v1/intelligence/campaigns/:id | Campaign intelligence report |
GET | /v1/intelligence/journey/funnel | Funnel analysis |
GET | /v1/intelligence/journey/paths | Common paths to purchase |
GET | /v1/recommendations/customers/:id | Recommendations for individual |
POST | /v1/recommendations/segments | Recommendations for segment + goal |
GET | /v1/recommendations/stub | Stub response (dev/demo mode) |
GET | /metrics/business-pulse | Business pulse summary (24h / 30d) |
POST | /v1/evaluation/signals | บันทึก evaluation signal (suggestion decision, outcome) |
GET | /v1/evaluation/ai-quality | AI suggestion quality metrics (acceptance rate, edit distance) |
GET | /v1/evaluation/staff/:staffId | Staff performance metrics (response time, CSAT, resolution rate) |
GET | /v1/evaluation/outcomes | Outcome attribution — conversion rate ต่อ action type |
Intelligence API อยู่ใน PBCP Core — ไม่ใช่ separate service deployment