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's own UUID
tenantId: string; // Multi-tenant isolation

// Identity Keys
authUserId?: string; // IDP user ID (strongest link)
email?: string; // Normalized email
phoneNumber?: string; // E.164 phone

// Cross-Service Links
sclMemberId?: number; // 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
PROSPECTEngaged with content
CUSTOMERHas transacted
MEMBERActive member
ADVOCATERefers others
CHURNEDLapsed customer

Identity Resolution

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

  1. authUserId - Exact match (100% confidence)
  2. email - Normalized exact match (95% confidence)
  3. phone - E.164 exact match (85% confidence)
  4. email + phone - Combined 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