Skip to main content

Customer Profiles

The CustomerProfile is the central entity representing a single customer across all DigiWedge systems.

Profile Structure

interface CustomerProfile {
id: string; // CRM profile UUID
tenantUuid: string; // Canonical CRM tenant isolation key
tenantId?: string; // Legacy tenant slug during migration

// Identity Keys
authUserId?: string; // IDP user ID, unique inside the CRM tenant
email?: string; // Normalized email
phoneNumber?: string; // E.164 phone

// Cross-Service Links
sclMemberId?: string; // SCL.Member.id
teetimePlayerId?: string; // TeeTime.Player.id
messagingContactId?: string; // Messaging.Contact.id

// Profile Data
firstName?: string;
lastName?: string;
displayName?: string;

// CRM Data
status: CustomerStatus;
lifecycleStage: LifecycleStage;
tags: string[];

// Computed Scores
engagementScore?: number; // 0-100
churnRiskScore?: number; // 0-100
lifetimeValue?: number; // Cents

// Activity Metrics
lastActivityAt?: Date;
activityCount30d: number;
bookingCount30d: number;

// Golf Data (from TeeTime)
handicap?: number;
homeClubId?: string;

// Membership Data (from SCL)
membershipTier?: string;
membershipStatus?: string;

// Marketing Consent (from Messaging - READ ONLY)
emailOptIn: boolean;
smsOptIn: boolean;
pushOptIn: boolean;
whatsappOptIn: boolean;
}

Lifecycle Stages

StageDescription
SUBSCRIBEREmail contact only
LEADShowed interest
OPPORTUNITYQualified or engaged opportunity
CUSTOMERHas transacted
ADVOCATERefers others or has high engagement

Identity Resolution

The CRM automatically links records from different services using tenant-scoped identity resolution:

  1. authUserId - Exact match inside the CRM tenant (100% confidence)
  2. email - Normalized exact match inside the CRM tenant (95% confidence)
  3. phone - E.164 exact match inside the CRM tenant (85% confidence)
  4. email + phone - Combined tenant-scoped match (99% confidence)

Activity Timeline

Every customer has an activity timeline aggregating events from all services:

SourceEvents
SCLMember created, tier changed, payments
TeeTimeBookings, handicap updates, competitions
MessagingMessages sent, opens, clicks
CRMNotes, tags, campaign interactions