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
| Stage | Description |
|---|---|
| SUBSCRIBER | Email contact only |
| LEAD | Showed interest |
| PROSPECT | Engaged with content |
| CUSTOMER | Has transacted |
| MEMBER | Active member |
| ADVOCATE | Refers others |
| CHURNED | Lapsed customer |
Identity Resolution
The CRM automatically links records from different services using identity resolution:
- authUserId - Exact match (100% confidence)
- email - Normalized exact match (95% confidence)
- phone - E.164 exact match (85% confidence)
- email + phone - Combined match (99% confidence)
Activity Timeline
Every customer has an activity timeline aggregating events from all services:
| Source | Events |
|---|---|
| SCL | Member created, tier changed, payments |
| TeeTime | Bookings, handicap updates, competitions |
| Messaging | Messages sent, opens, clicks |
| CRM | Notes, tags, campaign interactions |