Skip to main content

CRM Service Event Catalog

Version: 1.0 Date: December 2025


Overview

This document catalogs all events consumed and produced by the CRM service. Events are the primary mechanism for keeping the CRM in sync with source services (SCL, TeeTime, Messaging).


DocumentDescription
SCL EventsMember, tier, and payment events
TeeTime EventsPlayer, booking, and competition events
Messaging EventsContact, consent, and message events
CRM EventsEvents produced by CRM service
ProcessingQueue config, idempotency, monitoring

Event Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│ EVENT FLOW DIAGRAM │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────────────────────────────────────────────────────────┐ │
│ │ SOURCE SERVICES │ │
│ ├───────────────┬───────────────────┬───────────────────────────────┤ │
│ │ │ │ │ │
│ │ SCL Service │ TeeTime Service │ Messaging Service │ │
│ │ │ │ │ │
│ │ DomainOutbox │ DomainOutbox │ EventEmitter │ │
│ │ │ │ │ │
│ └───────┬───────┴─────────┬─────────┴───────────────┬───────────────┘ │
│ │ │ │ │
│ │ member.* │ player.* │ contact.* │
│ │ tier.* │ teetime.* │ message.* │
│ │ payment.* │ handicap.* │ consent.* │
│ │ │ competition.* │ campaign.* │
│ │ │ │ │
│ └─────────────────┼─────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────┐ │
│ │ REDIS / BULLMQ │ │
│ │ Queue: crm-events │ │
│ └─────────────────┬───────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────┐ │
│ │ CRM SERVICE │ │
│ ├─────────────────────────────────────┤ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ Event Processor │ │ │
│ │ │ ───────────────────── │ │ │
│ │ │ 1. Parse event │ │ │
│ │ │ 2. Resolve identity │ │ │
│ │ │ 3. Update profile │ │ │
│ │ │ 4. Create activity │ │ │
│ │ │ 5. Trigger scoring │ │ │
│ │ │ 6. Update segments │ │ │
│ │ └─────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ CRM Database │ │ │
│ │ └─────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ Outbound Events │ │ │
│ │ │ (crm.profile.*) │ │ │
│ │ └─────────────────────────────┘ │ │
│ └─────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

Event Envelope

All events follow a standard envelope format:

interface CrmEvent {
// Envelope metadata
id: string; // Unique event ID (UUID)
type: string; // Event type (e.g., "scl.member.created")
version: string; // Schema version (e.g., "1.0")
timestamp: string; // ISO 8601 timestamp
correlationId?: string; // For tracing related events

// Routing
tenantId: string; // Tenant identifier
source: string; // Source service name

// Identity hints for resolution
identity: {
authUserId?: string; // IDP user ID
email?: string; // Email address
phoneNumber?: string; // E.164 phone
sclMemberId?: number; // SCL Member ID
teetimePlayerId?: string; // TeeTime Player ID
messagingContactId?: string; // Messaging Contact ID
externalIds?: Record<string, string>;
};

// Event-specific payload
payload: Record<string, unknown>;

// Optional metadata
metadata?: {
userId?: string; // User who triggered the event
ipAddress?: string;
userAgent?: string;
};
}

Event Summary

Consumed Events

SourceEvent CountHigh Priority
SCL8 eventspayment.failed, member.status.changed
TeeTime10 eventsbooking.noshow
Messaging11 eventscontactPreference.updated, message.bounced

Produced Events

TypeDescription
crm.profile.*Profile lifecycle events
crm.segment.*Segment membership changes
crm.churn.*Churn risk alerts

See CRM Events for full details.


Event Processing

  • Transport: Redis/BullMQ
  • Queue: crm-events
  • Retry Policy: Exponential backoff (1s, 2s, 4s)
  • Dead Letter Queue: Failed events after 3 retries
  • Idempotency: SyncLog deduplication by event ID

See Processing for configuration details.