Platform
Intelligence
Overview

Intelligence (PBCP Intelligence)

API Base: https://pbcp-api.pcampus.co/v1/intelligence
Recommendations: https://pbcp-api.pcampus.co/v1/recommendations

Overview

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 Valuebasket ใหญ่แต่ซื้อไม่บ่อย

Segment ใช้ RFM model (Recency · Frequency · Monetary) เป็น baseline — ปรับ weight ได้ต่อ domain

3. Campaign Intelligence

วัดผลและเปรียบเทียบ campaign:

Metricความหมาย
Response rate% ลูกค้าที่ทำ action หลังได้รับ offer
Revenue upliftรายได้ที่เพิ่มขึ้นเทียบกับ baseline
Segment fitcampaign นี้ work กับกลุ่มไหน
Coupon redemption% คูปองที่ถูกใช้จริง
Cannibalizationoffer ลดยอดขาย full-price หรือเปล่า

4. Journey Intelligence

วิเคราะห์ funnel และ path:

  • ลูกค้าหายไปตรงไหนมากที่สุด
  • path ที่นำไปสู่ purchase ที่เร็วที่สุดคืออะไร
  • session ที่ convert มีพฤติกรรมอะไรที่แตกต่าง

5. Evaluation Intelligence

วัดผลและเรียนรู้จาก action ที่เกิดขึ้นจริง — ทำให้ Intelligence ฉลาดขึ้นในทุกรอบ

AI Quality Metrics:

Signalข้อมูลที่ได้
suggestion.acceptedAI suggestion แม่นพอที่ admin ใช้ได้เลย
suggestion.edited + edit distanceแก้มากแค่ไหน → คะแนน accuracy
suggestion.dismissedAI miss ทิ้ง → ต้องปรับ Q&A corpus
chatbot.resolved vs chatbot.escalatedChatbot resolution rate per topic

Human Quality Metrics:

Metricความหมาย
First response timeadmin ตอบลูกค้าเร็วแค่ไหน
Resolution timeปิด conversation ภายในกี่นาที
CSAT scoreลูกค้า rate ความพึงพอใจ (1–5)
Suggestion usage rateใช้ AI vs. พิมพ์เอง

Outcome Attribution:

ActionOutcome วัด
ส่ง coupon ผ่าน Connectลูกค้าใช้คูปองภายใน N วัน?
ส่ง LINE Flex Messageopen → click → conversion?
ส่ง email digestopen 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 caseIntelligence ทำอะไรExecution
คนไข้ที่ใช้ยาต่อเนื่องไม่ได้กลับมาChurn risk → recommend couponPharmacy ส่ง LINE OA
คนไข้กลุ่มผู้สูงอายุSegment → recommend วิตามิน campaignPharmacy broadcast SMS
โปรโมชั่นไหนได้ผลดีสุดCampaign intelligence → ROI reportแสดงใน Pulse
ลูกค้าใหม่ซื้อครั้งแรกNew segment → onboarding rewardPharmacy ส่ง push notification

API overview

MethodEndpointDescription
GET/v1/intelligence/customers/:idCustomer intelligence profile
GET/v1/intelligence/segmentsList auto-generated segments + sizes
GET/v1/intelligence/segments/:segmentSegment intelligence detail
GET/v1/intelligence/campaigns/:idCampaign intelligence report
GET/v1/intelligence/journey/funnelFunnel analysis
GET/v1/intelligence/journey/pathsCommon paths to purchase
GET/v1/recommendations/customers/:idRecommendations for individual
POST/v1/recommendations/segmentsRecommendations for segment + goal
GET/v1/recommendations/stubStub response (dev/demo mode)
GET/metrics/business-pulseBusiness pulse summary (24h / 30d)
POST/v1/evaluation/signalsบันทึก evaluation signal (suggestion decision, outcome)
GET/v1/evaluation/ai-qualityAI suggestion quality metrics (acceptance rate, edit distance)
GET/v1/evaluation/staff/:staffIdStaff performance metrics (response time, CSAT, resolution rate)
GET/v1/evaluation/outcomesOutcome attribution — conversion rate ต่อ action type
⚠️

Intelligence API อยู่ใน PBCP Core (merged จาก G-019) — ไม่ใช่ separate service deployment

Intelligence (PBCP Intelligence)

API Base: https://pbcp-api.pcampus.co/v1/intelligence
Recommendations: https://pbcp-api.pcampus.co/v1/recommendations

Overview

PBCP Intelligence is the analytics and recommendation layer that sits on top of Business Context and transforms context into actionable insights — answering the questions business owners actually need:

  • Who is about to churn? → Send a win-back coupon
  • Which segment responds best to this campaign? → Target that group specifically
  • What should this customer receive next? → A personalized offer tailored to them

Boundary: Intelligence analyzes and recommends — it does not send LINE, email, or push messages itself. Execution lives in the customer app (e.g., Pharmacy App)

Position in PBCP stack

Intelligence reads from the Context API only — it never queries the Event Store directly.

Four intelligence pillars

1. Customer Intelligence

Analyzes individual customers:

SignalWhat it answers
Purchase frequencyHow often this customer buys
Average basket sizeAverage spend per transaction
Category affinityPreferred product category
Churn risk scoreProbability of churning (0–1)
Lifetime valueCumulative value over the customer's lifetime

2. Segment Intelligence

Automatically segments customers based on behavior:

SegmentCharacteristics
ChampionsFrequent buyers, high value, recent
LoyalConsistent buyers, but basket size is smaller
At RiskWere good customers but have stopped buying for a while
LostHave not bought for a very long time
NewMade their first purchase recently
High ValueLarge basket but infrequent buyers

Segments use the RFM model (Recency · Frequency · Monetary) as a baseline — weights are adjustable per domain

3. Campaign Intelligence

Measures and compares campaigns:

MetricMeaning
Response rate% of customers who take action after receiving an offer
Revenue upliftRevenue increase compared to baseline
Segment fitWhich segment this campaign works for
Coupon redemption% of coupons actually used
CannibalizationWhether the offer reduces full-price sales

4. Journey Intelligence

Analyzes funnels and paths:

  • Where most customers drop off
  • What path leads to the fastest purchase
  • What behavior distinguishes sessions that convert

5. Evaluation Intelligence

Measures outcomes and learns from actual actions — making Intelligence smarter with every cycle.

AI Quality Metrics:

SignalData Obtained
suggestion.acceptedAI suggestion was accurate enough for admin to use as-is
suggestion.edited + edit distanceHow much was edited → accuracy score
suggestion.dismissedAI miss — must update the Q&A corpus
chatbot.resolved vs chatbot.escalatedChatbot resolution rate per topic

Human Quality Metrics:

MetricMeaning
First response timeHow quickly admin responds to customers
Resolution timeHow many minutes to close a conversation
CSAT scoreCustomer satisfaction rating (1–5)
Suggestion usage rateUsing AI vs. typing manually

Outcome Attribution:

ActionOutcome Measured
Send coupon via ConnectDoes the customer use the coupon within N days?
Send LINE Flex Messageopen → click → conversion?
Send email digestopen rate, click rate, re-purchase?
Reduce churn risk predictionDoes the customer remain within 30 days?

Every signal combines into (context → action → outcome) tuples — stored in the Evaluation Store and fed back into Intelligence to refine scoring and recommendations.


Recommendation Engine

The core of Intelligence — takes all insights and converts them into structured recommendations that the customer app can use immediately.

Individual Recommendations

Output Example:

{
  "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 Recommendations

Output Example:

{
  "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 (Pharmacy)

Use caseWhat Intelligence DoesExecution
Patients on continuous medication who haven't returnedChurn risk → recommend couponPharmacy sends LINE OA
Elderly patient groupSegment → recommend vitamin campaignPharmacy broadcasts SMS
Which promotion performs bestCampaign intelligence → ROI reportDisplayed in Pulse
New customer makes first purchaseNew segment → onboarding rewardPharmacy sends push notification

API overview

MethodEndpointDescription
GET/v1/intelligence/customers/:idCustomer intelligence profile
GET/v1/intelligence/segmentsList auto-generated segments + sizes
GET/v1/intelligence/segments/:segmentSegment intelligence detail
GET/v1/intelligence/campaigns/:idCampaign intelligence report
GET/v1/intelligence/journey/funnelFunnel analysis
GET/v1/intelligence/journey/pathsCommon paths to purchase
GET/v1/recommendations/customers/:idRecommendations for individual
POST/v1/recommendations/segmentsRecommendations for segment + goal
GET/v1/recommendations/stubStub response (dev/demo mode)
GET/metrics/business-pulseBusiness pulse summary (24h / 30d)
POST/v1/evaluation/signalsRecord an evaluation signal (suggestion decision, outcome)
GET/v1/evaluation/ai-qualityAI suggestion quality metrics (acceptance rate, edit distance)
GET/v1/evaluation/staff/:staffIdStaff performance metrics (response time, CSAT, resolution rate)
GET/v1/evaluation/outcomesOutcome attribution — conversion rate per action type
⚠️

Intelligence API lives inside PBCP Core (merged from G-019) — it is not a separate service deployment