Intelligence (inside PBCP)
API Base: https://pbcp-api.pcampus.co/v1/intelligence
Recommendations: https://pbcp-api.pcampus.co/v1/recommendations
Overview
Intelligence lives inside PBCP. It is not sold separately. Enabling PBCP includes this recommendation layer.
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:
| Signal | What it answers |
|---|---|
| Purchase frequency | How often this customer buys |
| Average basket size | Average spend per transaction |
| Category affinity | Preferred product category |
| Churn risk score | Probability of churning (0–1) |
| Lifetime value | Cumulative value over the customer's lifetime |
2. Segment Intelligence
Automatically segments customers based on behavior:
| Segment | Characteristics |
|---|---|
| Champions | Frequent buyers, high value, recent |
| Loyal | Consistent buyers, but basket size is smaller |
| At Risk | Were good customers but have stopped buying for a while |
| Lost | Have not bought for a very long time |
| New | Made their first purchase recently |
| High Value | Large 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:
| Metric | Meaning |
|---|---|
| Response rate | % of customers who take action after receiving an offer |
| Revenue uplift | Revenue increase compared to baseline |
| Segment fit | Which segment this campaign works for |
| Coupon redemption | % of coupons actually used |
| Cannibalization | Whether 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:
| Signal | Data Obtained |
|---|---|
suggestion.accepted | AI suggestion was accurate enough for admin to use as-is |
suggestion.edited + edit distance | How much was edited → accuracy score |
suggestion.dismissed | AI miss — must update the Q&A corpus |
chatbot.resolved vs chatbot.escalated | Chatbot resolution rate per topic |
Human Quality Metrics:
| Metric | Meaning |
|---|---|
| First response time | How quickly admin responds to customers |
| Resolution time | How many minutes to close a conversation |
| CSAT score | Customer satisfaction rating (1–5) |
| Suggestion usage rate | Using AI vs. typing manually |
Outcome Attribution:
| Action | Outcome Measured |
|---|---|
| Send coupon via Connect | Does the customer use the coupon within N days? |
| Send LINE Flex Message | open → click → conversion? |
| Send email digest | open rate, click rate, re-purchase? |
| Reduce churn risk prediction | Does 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 case | What Intelligence Does | Execution |
|---|---|---|
| Patients on continuous medication who haven't returned | Churn risk → recommend coupon | Pharmacy sends LINE OA |
| Elderly patient group | Segment → recommend vitamin campaign | Pharmacy broadcasts SMS |
| Which promotion performs best | Campaign intelligence → ROI report | Displayed in Pulse |
| New customer makes first purchase | New segment → onboarding reward | Pharmacy sends 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 | Record an 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 per action type |
Intelligence API lives inside PBCP Core — it is not a separate service deployment