Marketing Automation, ML & AI - Unified Flow
This document provides a comprehensive view of how Marketing Automation, ML Scoring, and AI capabilities integrate into a unified customer engagement system.
Executive Summary
┌─────────────────────────────────────────────────────────────────────────────────┐
│ INTELLIGENT MARKETING PLATFORM │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ LAYER 1: DATA SOURCES │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ SCL │ │ TeeTime │ │Messaging│ │ Social │ │ Web │ │
│ │ Members │ │ Booking │ │ Comms │ │ Engage │ │ Activity│ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ └───────────┬┴───────────┴┬───────────┴┬───────────┘ │
│ ▼ ▼ ▼ │
│ LAYER 2: DATA AGGREGATION │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CRM CUSTOMER PROFILE │ │
│ │ - Identity Resolution - Activity Timeline │ │
│ │ - 360° View - Engagement History │ │
│ └────────────────────────────────┬────────────────────────────────────┘ │
│ ▼ │
│ LAYER 3: INTELLIGENCE (ML) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ CHURN │ │ ENGAGEMENT │ │ LTV │ │ CUSTOMER │ │
│ │ CLASSIFIER │ │ REGRESSOR │ │ PREDICTOR │ │ CLUSTERING │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ └────────────────┼────────────────┼────────────────┘ │
│ ▼ ▼ │
│ LAYER 4: SEGMENTATION │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STATIC │ DYNAMIC │ SMART (ML) │ NL SEGMENTS (AI) │ IMPORT │ │
│ └────────────────────────────────┬────────────────────────────────────┘ │
│ ▼ │
│ LAYER 5: AI ENHANCEMENT │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ CONTENT │ │ SEND TIME │ │ JOURNEY │ │ CHURN │ │
│ │ GENERATION │ │OPTIMIZATION │ │OPTIMIZATION │ │INTERVENTION │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ └────────────────┼────────────────┼────────────────┘ │
│ ▼ │
│ LAYER 6: AUTOMATION │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ JOURNEY ENGINE │ │
│ │ TRIGGER → SEND → WAIT → CONDITION → SPLIT → UPDATE → END │ │
│ └────────────────────────────────┬────────────────────────────────────┘ │
│ ▼ │
│ LAYER 7: DELIVERY │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ EMAIL │ │ SMS │ │ PUSH │ │WHATSAPP │ │ SOCIAL │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
1. The Three Pillars
| Pillar | Technology | Purpose |
|---|---|---|
| Marketing Automation | Rule-based workflows | Orchestrate multi-step customer journeys |
| ML Scoring | Statistical ML models | Predict customer behavior (churn, LTV, engagement) |
| AI Enhancement | LLMs (Claude/GPT) | Generate content, understand intent, optimize timing |
How They Work Together
┌────────────────────────────────────────────────────────────────────────────┐
│ │
│ Customer Activity │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ ML SCORING │ "This customer has 78% churn probability" │
│ │ (Prediction) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ JOURNEY TRIGGER │ "High churn risk detected → Start retention" │
│ │ (Automation) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ AI CONTENT │ "Generate personalized win-back message" │
│ │ (Enhancement) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ AI SEND TIME │ "Optimal send time: 7:45 AM (before golf)" │
│ │ (Enhancement) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ DELIVERY │ "Email sent via Messaging Service" │
│ │ (Execution) │ │
│ └─────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────────────┘
2. Complete Data Flow
2.1 Customer Lifecycle Flow
┌─────────────────────────────────────────────────────────────────────────────────┐
│ CUSTOMER LIFECYCLE FLOW │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 1. CUSTOMER ACTION │ │
│ │ Member signs up, books tee time, opens email, visits website, etc. │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 2. EVENT CAPTURED │ │
│ │ SCL → member.created │ │
│ │ TeeTime → teetime.booked │ │
│ │ Messaging → email.opened │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 3. CRM PROFILE UPDATED │ │
│ │ - Activity recorded to timeline │ │
│ │ - Engagement metrics updated │ │
│ │ - Last activity timestamp refreshed │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 4. ML SCORING (Batch + Real-time) │ │
│ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │
│ │ │ Churn Risk: 78% │ │ Engagement: 42 │ │ Predicted LTV: │ │ │
│ │ │ Level: HIGH │ │ Trend: ↓-12% │ │ $2,450 │ │ │
│ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 5. SEGMENT EVALUATION │ │
│ │ ✓ "High Churn Risk" (SMART segment: churnRisk >= 70) │ │
│ │ ✓ "Disengaging Members" (DYNAMIC: engagement trend < 0) │ │
│ │ ✗ "Active Golfers" (DYNAMIC: bookings30d >= 2) - Not qualified │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 6. JOURNEY TRIGGERS EVALUATED │ │
│ │ Journey: "Churn Prevention" │ │
│ │ Trigger: SEGMENT_ENTRY when "High Churn Risk" │ │
│ │ Result: ✓ Customer enrolled │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 7. JOURNEY EXECUTION │ │
│ │ Step 1: SEND "We miss you" email │ │
│ │ Step 2: WAIT 3 days │ │
│ │ Step 3: CONDITION - Did they book? │ │
│ │ Step 4: SPLIT A/B test offer │ │
│ │ ... │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 8. AI ENHANCEMENT (Applied at each SEND step) │ │
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Content Generation │ │ │
│ │ │ IN: Goal="Win back", Audience="High churn", Tone="Friendly" │ │ │
│ │ │ OUT: "{{firstName}}, we've noticed it's been a while since your │ │ │
│ │ │ last round. Here's 15% off your next booking..." │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Send Time Optimization │ │ │
│ │ │ IN: Customer ID, Historical engagement │ │ │
│ │ │ OUT: Send at 7:45 AM (this customer opens emails before golf) │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Personalization │ │ │
│ │ │ IN: Customer profile, preferences, history │ │ │
│ │ │ OUT: Dynamic content blocks selected based on ML predictions │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 9. MESSAGE DELIVERY │ │
│ │ CRM → Messaging Service → Email Provider → Customer Inbox │ │
│ └───────────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ 10. FEEDBACK LOOP │ │
│ │ Customer opens email → Event captured → ML models updated │ │
│ │ Customer books tee time → Journey goal achieved → Exit journey │ │
│ │ Customer unsubscribes → Consent updated → Exit journey │ │
│ └──────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
3. ML Scoring Detail
3.1 Feature Engineering
┌─────────────────────────────────────────────────────────────────────────────────┐
│ ML FEATURE ENGINEERING │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ RAW DATA ENGINEERED FEATURES │
│ ───────────── ─────────────────── │
│ │
│ Bookings Table ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ TEMPORAL │ │
│ │ 2024-01-15 9:00 AM │────────────▶│ daysSinceLastBooking: 45 │ │
│ │ 2024-02-20 7:30 AM │ │ daysSinceLastActivity: 12 │ │
│ │ 2024-03-05 2:00 PM │ │ membershipAgeDays: 730 │ │
│ └────────────────────┘ └──────────────────────────────────────┘ │
│ │
│ Activity Timeline ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ FREQUENCY │ │
│ │ EMAIL_OPENED x 12 │────────────▶│ bookingCount30d: 0 │ │
│ │ BOOKING x 3 │ │ bookingCount90d: 2 │ │
│ │ PAGE_VIEW x 45 │ │ activityCount30d: 8 │ │
│ └────────────────────┘ │ emailOpenCount30d: 3 │ │
│ └──────────────────────────────────────┘ │
│ │
│ Transaction History ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ MONETARY │ │
│ │ $150 (green fee) │────────────▶│ totalSpendLifetime: $2,450 │ │
│ │ $45 (pro shop) │ │ totalSpend90d: $195 │ │
│ │ $1,200 (membership)│ │ avgTransactionValue: $85 │ │
│ └────────────────────┘ └──────────────────────────────────────┘ │
│ │
│ Email Interactions ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ ENGAGEMENT │ │
│ │ Sent: 20 │────────────▶│ emailOpenRate: 0.60 │ │
│ │ Opened: 12 │ │ emailClickRate: 0.15 │ │
│ │ Clicked: 3 │ │ campaignResponseRate: 0.10 │ │
│ └────────────────────┘ └──────────────────────────────────────┘ │
│ │
│ Behavioral Patterns ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ BEHAVIORAL │ │
│ │ Books Sat mornings │────────────▶│ preferredDayOfWeek: 6 (Saturday) │ │
│ │ 7-day lead time │ │ bookingLeadTimeDays: 7 │ │
│ │ 0% cancellations │ │ cancellationRate: 0.0 │ │
│ └────────────────────┘ └──────────────────────────────────────┘ │
│ │
│ Trend Analysis ┌──────────────────────────────────────┐ │
│ ┌────────────────────┐ │ TRENDS (Δ values) │ │
│ │ Last 30d vs Prev │────────────▶│ activityTrend: -0.35 (declining) │ │
│ │ 30d comparison │ │ spendTrend: -0.50 (declining) │ │
│ │ │ │ engagementTrend: -0.20 │ │
│ └────────────────────┘ └──────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
3.2 Model Training Pipeline
┌─────────────────────────────────────────────────────────────────────────────────┐
│ ML TRAINING PIPELINE │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: HISTORICAL DATA EXTRACTION │ │
│ │ │ │
│ │ Point-in-time feature snapshot (avoids data leakage) │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ SELECT features AS OF 90 days ago │ │ │
│ │ │ WHERE customer was ACTIVE at that time │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: LABEL EXTRACTION │ │
│ │ │ │
│ │ For ChurnClassifier: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ label = 1 if customer churned within 90 days of snapshot │ │ │
│ │ │ label = 0 if customer remained active │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 3: DATA PREPROCESSING │ │
│ │ │ │
│ │ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │ │
│ │ │ Handle nulls │ │ Normalize │ │ One-hot │ │ │
│ │ │ (imputation) │ │ (0-1 scale) │ │ (categoricals)│ │ │
│ │ └───────────────┘ └───────────────┘ └───────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 4: TRAIN/TEST SPLIT │ │
│ │ │ │
│ │ ┌─────────────────────────────┐ ┌─────────────────────────────────┐ │ │
│ │ │ Training Set (80%) │ │ Test Set (20%) │ │ │
│ │ │ 8,000 customers │ │ 2,000 customers │ │ │
│ │ │ Stratified by churn label │ │ Held out for validation │ │ │
│ │ └─────────────────────────────┘ └─────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 5: MODEL TRAINING │ │
│ │ │ │
│ │ Algorithm: XGBoost / LightGBM / RandomForest │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Hyperparameter tuning via cross-validation │ │ │
│ │ │ - max_depth: [3, 5, 7] │ │ │
│ │ │ - learning_rate: [0.01, 0.1] │ │ │
│ │ │ - n_estimators: [100, 500] │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 6: MODEL EVALUATION │ │
│ │ │ │
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
│ │ │ ChurnClassifier Metrics: │ │ │
│ │ │ - AUC-ROC: 0.85 (good discrimination) │ │ │
│ │ │ - Precision: 0.72 (72% of predicted churns are correct) │ │ │
│ │ │ - Recall: 0.68 (catches 68% of actual churns) │ │ │
│ │ │ - F1: 0.70 │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 7: MODEL REGISTRATION │ │
│ │ │ │
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Model: churn-classifier-v2.3.0 │ │ │
│ │ │ Status: SHADOW (A/B testing against production) │ │ │
│ │ │ Artifacts: model.pkl, features.json, metrics.json │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
3.3 Real-time Scoring
┌─────────────────────────────────────────────────────────────────────────────────┐
│ REAL-TIME ML SCORING │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Customer Activity Event │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────┐ │
│ │ FEATURE EXTRACTION (< 50ms) │ │
│ │ │ │
│ │ L1 Cache ──▶ L2 Cache ──▶ Database │ │
│ │ (Memory) (Redis) (PostgreSQL) │ │
│ │ │ │
│ │ CustomerFeatures: { │ │
│ │ daysSinceLastBooking: 45, │ │
│ │ bookingCount30d: 0, │ │
│ │ engagementTrend: -0.35, │ │
│ │ ... (30+ features) │ │
│ │ } │ │
│ └───────────────────────────────────┬───────────────────────────────────────┘ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────┐ │
│ │ ML MODEL INFERENCE (< 10ms) │ │
│ │ │ │
│ │ ┌─────────────────────┐ ┌─────────────────────┐ │ │
│ │ │ ChurnClassifier │ │ EngagementRegressor │ │ │
│ │ │ Input: Features │ │ Input: Features │ │ │
│ │ │ Output: P(churn) │ │ Output: Score 0-100 │ │ │
│ │ │ = 0.78 │ │ = 42 │ │ │
│ │ └─────────────────────┘ └─────────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────┐ ┌─────────────────────┐ │ │
│ │ │ LTVRegressor │ │ CustomerCluster │ │ │
│ │ │ Input: Features │ │ Input: Features │ │ │
│ │ │ Output: $2,450 │ │ Output: "Weekend │ │ │
│ │ │ │ │ Warrior" │ │ │
│ │ └─────────────────────┘ └─────────────────────┘ │ │
│ └───────────────────────────────────┬───────────────────────────────────────┘ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────┐ │
│ │ EXPLAINABILITY (SHAP Values) │ │
│ │ │ │
│ │ Top Risk Factors: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ #1: daysSinceLastBooking = 45 → +0.25 contribution │ │ │
│ │ │ "No bookings in 45 days significantly increases churn risk" │ │ │
│ │ │ #2: engagementTrend = -0.35 → +0.18 contribution │ │ │
│ │ │ "Engagement declining 35% month-over-month" │ │ │
│ │ │ #3: bookingCount90d = 2 → +0.12 contribution │ │ │
│ │ │ "Only 2 bookings in last quarter (was 6)" │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬───────────────────────────────────────┘ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────┐ │
│ │ PROFILE UPDATE │ │
│ │ │ │
│ │ CustomerProfile.update({ │ │
│ │ churnRiskScore: 78, │ │
│ │ engagementScore: 42, │ │
│ │ predictedLTV: 245000, // cents │ │
│ │ mlClusterName: "Weekend Warrior", │ │
│ │ mlScoredAt: new Date(), │ │
│ │ mlModelVersion: "v2.3.0" │ │
│ │ }) │ │
│ └───────────────────────────────────┬───────────────────────────────────────┘ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────┐ │
│ │ EVENT EMISSION │ │
│ │ │ │
│ │ emit('crm.customer.at_risk', { │ │
│ │ customerId, │ │
│ │ churnRiskScore: 78, │ │
│ │ riskLevel: 'HIGH', │ │
│ │ topRiskFactors: [...] │ │
│ │ }) │ │
│ │ │ │
│ │ → Triggers journey enrollment │ │
│ │ → Triggers churn intervention AI │ │
│ └───────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
4. AI Enhancement Detail
4.1 AI Enhancement Points in Journey
┌─────────────────────────────────────────────────────────────────────────────────┐
│ AI ENHANCEMENT INJECTION POINTS │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ JOURNEY: "Member Re-engagement" │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ TRIGGER: Segment Entry "Disengaged Members" │ │
│ │ │ │
│ │ [AI] Natural Language Segment Builder │ │
│ │ "Find members who haven't booked in 30 days but opened │ │
│ │ at least one email recently" │ │
│ │ ↓ │ │
│ │ { bookingCount30d: 0, lastEmailOpenAt: { gte: -14d } } │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: SEND "We miss you" Email │ │
│ │ │ │
│ │ [AI] Content Generation │ │
│ │ Generate 3 subject line variants: │ │
│ │ A: "{{firstName}}, your tee time awaits" (curiosity) │ │
│ │ B: "Ready to hit the links again?" (casual) │ │
│ │ C: "Special offer for valued members" (benefit) │ │
│ │ │ │
│ │ [AI] Send Time Optimization │ │
│ │ Customer usually opens emails at 7:30 AM │ │
│ │ → Schedule for 7:15 AM their timezone │ │
│ │ │ │
│ │ [AI] Personalization Engine │ │
│ │ Customer is "Weekend Warrior" cluster │ │
│ │ → Show Saturday morning tee time suggestions │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: WAIT 3 days │ │
│ │ │ │
│ │ [ML] Churn Intervention Check (background) │ │
│ │ If churn risk increased during wait → expedite journey │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 3: CONDITION - Opened email? │ │
│ │ │ │
│ │ [AI] Journey Optimization (learns from outcomes) │ │
│ │ "Customers who don't open within 3 days have 45% higher │ │
│ │ success rate with SMS follow-up vs. another email" │ │
│ │ → Suggest: Change NO branch from email to SMS │ │
│ └──────────────────────┬────────────────────────────┬─────────────────────┘ │
│ │ YES │ NO │
│ ▼ ▼ │
│ ┌─────────────────────────────┐ ┌─────────────────────────────────────────┐ │
│ │ STEP 4a: SEND Tips Email │ │ STEP 4b: SEND SMS Reminder │ │
│ │ │ │ │ │
│ │ [AI] Content Generation │ │ [AI] Content Generation │ │
│ │ "Now that you're back, │ │ "{{firstName}}, we've reserved your │ │
│ │ here are this week's │ │ favorite Saturday slot. Book now: │ │
│ │ featured tee times..." │ │ [link]" │ │
│ └─────────────────────────────┘ └─────────────────────────────────────────┘ │
│ │ │ │
│ └────────────┬───────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 5: SPLIT A/B Test (Offer vs. No Offer) │ │
│ │ │ │
│ │ [AI] Auto-generate A/B variants │ │
│ │ Variant A (50%): Standard messaging │ │
│ │ Variant B (50%): 10% discount offer │ │
│ │ │ │
│ │ [ML] Track conversion → learn which segments respond to offers │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 6: END │ │
│ │ │ │
│ │ [AI] Effectiveness Tracking │ │
│ │ Compare AI content vs. human-written │ │
│ │ AI variants: 24% open rate, 8% click rate │ │
│ │ Human: 18% open rate, 5% click rate │ │
│ │ → AI outperformed by 33% │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
4.2 Churn Intervention Flow
┌─────────────────────────────────────────────────────────────────────────────────┐
│ CHURN INTERVENTION AI FLOW │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ TRIGGER: ML detects high churn risk (score >= 70) │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: GATHER CONTEXT │ │
│ │ │ │
│ │ Customer Profile: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Name: John Smith │ │ │
│ │ │ Member since: 2022-03-15 (2.5 years) │ │ │
│ │ │ Tier: Gold │ │ │
│ │ │ LTV: $3,200 │ │ │
│ │ │ Churn Risk: 78% │ │ │
│ │ │ Engagement Score: 42 (was 75 six months ago) │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ Risk Factors: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ 1. No bookings in 45 days (usually books weekly) │ │ │
│ │ │ 2. Stopped opening emails 3 weeks ago │ │ │
│ │ │ 3. Membership expires in 60 days │ │ │
│ │ │ 4. Similar customers churned at 65% rate │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ History: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ - No previous retention offers │ │ │
│ │ │ - Last support ticket: 2 months ago (course conditions) │ │ │
│ │ │ - Responded well to tournament invitations in past │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: LLM INTERVENTION STRATEGY │ │
│ │ │ │
│ │ Prompt to Claude/GPT: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ "Given this customer profile and risk factors, recommend │ │ │
│ │ │ 3 ranked intervention strategies with specific messaging" │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ LLM Response: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ INTERVENTION 1: Personal Outreach (HIGH PRIORITY) │ │ │
│ │ │ Action: Phone call from pro shop │ │ │
│ │ │ Reason: High-value member, engagement dropped suddenly │ │ │
│ │ │ Script: "Hi John, we noticed you haven't been out lately. │ │ │
│ │ │ Is everything okay? We'd love to see you back..." │ │ │
│ │ │ Expected churn reduction: 35% │ │ │
│ │ │ │ │ │
│ │ │ INTERVENTION 2: Tournament Invitation │ │ │
│ │ │ Action: Email with exclusive tournament invite │ │ │
│ │ │ Reason: History shows good response to tournament comms │ │ │
│ │ │ Content: "John, we're holding spots for our Gold members │ │ │
│ │ │ in next month's Member-Guest. Interested?" │ │ │
│ │ │ Expected churn reduction: 20% │ │ │
│ │ │ │ │ │
│ │ │ INTERVENTION 3: Renewal Incentive │ │ │
│ │ │ Action: Early renewal offer │ │ │
│ │ │ Offer: 15% off if renewed within 30 days │ │ │
│ │ │ Expected churn reduction: 25% │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 3: ROI CALCULATION │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Do Nothing Outcome: │ │ │
│ │ │ P(churn) = 78% │ │ │
│ │ │ Expected LTV loss = $3,200 × 78% = $2,496 │ │ │
│ │ │ │ │ │
│ │ │ With Intervention 1 (Phone Call): │ │ │
│ │ │ P(churn) = 78% × (1 - 35%) = 51% │ │ │
│ │ │ Expected LTV retained = $3,200 × 27% = $864 │ │ │
│ │ │ Cost = $15 (staff time) │ │ │
│ │ │ ROI = ($864 - $15) / $15 = 5,660% │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 4: APPROVAL WORKFLOW (if required) │ │
│ │ │ │
│ │ Intervention 1: Phone call │ │
│ │ → Auto-approved (no cost threshold exceeded) │ │
│ │ │ │
│ │ Intervention 3: 15% discount ($480 value) │ │
│ │ → Requires manager approval (> $50 threshold) │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 5: EXECUTION │ │
│ │ │ │
│ │ Create task for pro shop staff: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Task: Call John Smith (Gold member) │ │ │
│ │ │ Priority: HIGH │ │ │
│ │ │ Script: [provided] │ │ │
│ │ │ Due: Within 24 hours │ │ │
│ │ │ Context: At-risk member, LTV $3,200, no bookings 45 days │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────┬─────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 6: EFFECTIVENESS TRACKING (30 days later) │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Outcome: Customer booked 3 times, renewed membership │ │ │
│ │ │ Churn risk now: 25% │ │ │
│ │ │ Intervention effective: YES │ │ │
│ │ │ LTV retained: $3,200 │ │ │
│ │ │ │ │ │
│ │ │ → Feed back to ML model for learning │ │ │
│ │ │ → "Phone call" intervention effectiveness updated │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
5. Segment Types Comparison
┌─────────────────────────────────────────────────────────────────────────────────┐
│ SEGMENT TYPES COMPARISON │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ STATIC SEGMENT │ │
│ │ Definition: Manual list of customer IDs │ │
│ │ Updates: Manual only │ │
│ │ Use case: VIP list, event attendees, import list │ │
│ │ Example: "2024 Golf Tournament Participants" │ │
│ │ │ │
│ │ Technology: None (just a list) │ │
│ │ Refresh: Never (manual) │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ DYNAMIC SEGMENT │ │
│ │ Definition: Rule-based criteria on profile fields │ │
│ │ Updates: Automatic when data changes │ │
│ │ Use case: Active members, tier-based, consent-based │ │
│ │ Example: membershipTier = "Gold" AND emailOptIn = true │ │
│ │ │ │
│ │ Technology: SQL WHERE clauses │ │
│ │ Refresh: Real-time / hourly │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ SMART SEGMENT (ML-Powered) │ │
│ │ Definition: Based on ML model predictions │ │
│ │ Updates: After batch scoring │ │
│ │ Use case: At-risk, high-value, predicted behaviors │ │
│ │ │ │
│ │ Examples: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ THRESHOLD: churnRiskScore >= 70 │ │ │
│ │ │ "Customers likely to churn in next 90 days" │ │ │
│ │ │ │ │ │
│ │ │ PERCENTILE: engagementScore TOP 20% │ │ │
│ │ │ "Most engaged customers" │ │ │
│ │ │ │ │ │
│ │ │ CLUSTER: mlClusterName = "Weekend Warrior" │ │ │
│ │ │ "Customers who primarily play weekend mornings" │ │ │
│ │ │ │ │ │
│ │ │ PREDICTED: predictedLTV >= $5,000 │ │ │
│ │ │ "High future value customers" │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ Technology: ML models (XGBoost, clustering) │ │
│ │ Refresh: Daily batch scoring │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ NL SEGMENT (AI-Powered) │ │
│ │ Definition: Natural language converted to rules │ │
│ │ Updates: Becomes DYNAMIC after creation │ │
│ │ Use case: Quick segment creation by non-technical staff │ │
│ │ │ │
│ │ Examples: │ │
│ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ INPUT: "Find gold members who haven't played in 30 days" │ │ │
│ │ │ OUTPUT: membershipTier = "Gold" AND daysSinceLastBooking >= 30 │ │ │
│ │ │ │ │ │
│ │ │ INPUT: "Members expiring next month who are engaged" │ │ │
│ │ │ OUTPUT: membershipExpiry BETWEEN now AND +30d │ │ │
│ │ │ AND engagementScore >= 60 │ │ │
│ │ │ │ │ │
│ │ │ INPUT: "High handicappers who respond to emails" │ │ │
│ │ │ OUTPUT: handicap >= 18 AND emailOpenRate >= 0.3 │ │ │
│ │ └─────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ Technology: LLM (Claude/GPT) │ │
│ │ Refresh: Real-time (becomes DYNAMIC) │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
6. Technology Stack
┌─────────────────────────────────────────────────────────────────────────────────┐
│ TECHNOLOGY STACK │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ MARKETING AUTOMATION │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ Component │ Technology │ │
│ │────────────────────│────────────────────────────────────────────────────│ │
│ │ Journey Engine │ NestJS services + BullMQ workers │ │
│ │ Step Execution │ BullMQ delayed jobs │ │
│ │ Wait Processing │ Cron job (every minute) │ │
│ │ Condition Eval │ Custom rule engine (9 operators) │ │
│ │ State Management │ PostgreSQL (enrollments, steps) │ │
│ │ Event Triggers │ Redis pub/sub + BullMQ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ML SCORING │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ Component │ Technology │ │
│ │────────────────────│────────────────────────────────────────────────────│ │
│ │ Feature Store │ PostgreSQL + Redis cache │ │
│ │ Model Training │ Python (scikit-learn, XGBoost) │ │
│ │ Model Serving │ ONNX runtime in Node.js OR Python microservice │ │
│ │ Batch Scoring │ BullMQ worker (nightly) │ │
│ │ Real-time Scoring │ REST API with L1/L2 cache │ │
│ │ Model Registry │ PostgreSQL + S3/GCS for artifacts │ │
│ │ Explainability │ SHAP values │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ AI ENHANCEMENT │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ Component │ Technology │ │
│ │────────────────────│────────────────────────────────────────────────────│ │
│ │ LLM Provider │ Anthropic Claude (Haiku/Sonnet) / OpenAI GPT-4 │ │
│ │ Content Gen │ Claude 3 Haiku (fast, cheap) │ │
│ │ NL Segments │ Claude 3.5 Sonnet (better reasoning) │ │
│ │ Interventions │ Claude 3.5 Sonnet │ │
│ │ STO Model │ Per-customer engagement patterns (ML) │ │
│ │ Response Cache │ Redis (15-min TTL) │ │
│ │ Circuit Breaker │ Custom implementation │ │
│ │ Cost Tracking │ AIDecisionLog table │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ DELIVERY │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ Component │ Technology │ │
│ │────────────────────│────────────────────────────────────────────────────│ │
│ │ Email │ Messaging Service → SendGrid/SES │ │
│ │ SMS │ Messaging Service → Twilio │ │
│ │ Push │ Messaging Service → Firebase │ │
│ │ WhatsApp │ Messaging Service → Twilio/Meta │ │
│ │ Social │ Social Publisher → FB/IG/Twitter APIs │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
7. Cost Summary
| Component | Monthly Cost (per tenant) | Notes |
|---|---|---|
| ML Scoring | $5-25 | Batch scoring, model training |
| AI Enhancement | $2.50 | LLM calls (Haiku + Sonnet mix) |
| Journey Engine | Included | Part of CRM infrastructure |
| Total AI/ML | ~$7.50-27.50 | Depends on usage tier |
Tier Breakdown
| Tier | Features | Est. Monthly Cost |
|---|---|---|
| Economy | Content gen, NL segments | $25 |
| Standard | + STO, journey optimization, churn intervention | $100 |
| Premium | + Full personalization, advanced ML | $500 |
8. Key Metrics to Track
| Category | Metric | Target |
|---|---|---|
| ML Accuracy | Churn prediction AUC-ROC | > 0.80 |
| ML Accuracy | Engagement score correlation | > 0.70 |
| AI Quality | Content approval rate | > 90% |
| AI Quality | AI vs human open rate lift | > 15% |
| Automation | Journey completion rate | > 60% |
| Automation | Step failure rate | < 2% |
| Business | Churn reduction (with intervention) | > 25% |
| Business | Campaign ROI | > 300% |
Related Documents
- Marketing Automation - Journey step types, lifecycle
- ML Scoring - Model architecture, feature engineering
- AI Marketing Automation - LLM integration, content generation
- Segmentation - Segment types, rules