Documentation

CRM overview

Contacts, leads, marketing, audiences, events, communications, and the rest of the CRM module.

The CRM module is where AppEngine tracks the people you sell to and the work that happens around them. Every endpoint lives under /crm/*. The module is event-heavy — most writes emit events that the Automation module can react to (lead created, email opened, appointment booked, contact tagged).

Scope

CRM is large because it spans the full customer-journey loop:

  • Contacts — the master record. Email, phone, address, tags, properties, segments. Created from forms, imports, sign-ups, or directly via the data API.
  • Leads — pre-customer pipeline records. Statuses, stages, scoring, qualification, conversion to contact + opportunity.
  • Audiences — saved segments built on the dynamic-query engine, used to target campaigns and ads.
  • Marketing — campaign records, multi-channel send (paired with Broadcast), social-account connections, dashboard metrics.
  • Ads — ad-platform integrations (Facebook, Google, TikTok). Creative + targeting + spend.
  • Events / Reservations / Tickets — the appointment side: bookable resources, time-slot reservations, ticketed events. Pairs with Storefront for paid tickets.
  • Communications — call logs, SMS history, recordings; an aggregator over Twilio/Vonage and the Phone module.
  • Inbox — unified chat + email threads with status workflow (open / pending / closed).
  • Activities & tasks — todo items, calls scheduled, notes attached to records.
  • Promotions — staff-managed promotional offers (distinct from Storefront discounts).
  • Merchant customer — B2B-style merchant-of-record relationships layered on contacts.
  • Auto-campaign — rule-driven evergreen campaigns (welcome series, win-back).
  • AI assistant — auto-response config for the inbox.

Concepts

ConceptOwns
ContactIdentity record (email, phone, address, tags, properties)
LeadPre-customer record with pipeline stage and score
PipelineOrdered set of stages with routing rules
Audience / SegmentA saved query over contacts/leads
CampaignMarketing program with channel, audience, schedule, metrics
AdA live ad-platform record with budget and creative
ReservationTime-slot booking against a bookable resource
TicketIssued to an attendee for an event
ConversationInbox thread (chat or email)
ActivityNote, call, email, or task attached to a record
OpportunityOpen deal tied to a lead/contact
PromotionStaff-issued offer, distinct from storefront discounts

What goes where

  • Storing inbound form data → Contacts.
  • Sales pipeline + scoring → Leads and scoring.
  • Talking to customers → Inbox and communications.
  • Campaigns + audience targeting → see the marketing endpoints under /crm/marketing/* and /crm/marketing/audiences/*.
  • Bookings and tickets → reservation and ticket controllers under /crm/reservations/* and /crm/tickets/*. The yugo reference site at src/modules/reservation-system/ is the canonical integration.

Public surface

Most CRM endpoints are JWT-gated. Two public surfaces matter for front-end integration:

  • POST /crm/contact-form/post/:app/:name — public form submission with mapped fields.
  • POST /crm/contact-form/json/:app/:name — same, but with a free-form JSON body.

These let an unauthenticated marketing page or static site write into CRM without exposing JWTs.

Cross-module wiring

CRM doesn't run in isolation — it's the connective tissue:

  • Repository — every CRM entity is stored as a typed collection; the data API works against contacts, leads, audiences, etc.
  • Data Enrichment — leads pipe through LeadProspectorService and LeadEnrichmentService to fill in firmographics.
  • Chat — inbox messages share storage with the chat module; the inbox is a CRM-side view onto chat conversations.
  • Sync — social activity sync (FB / TikTok / LinkedIn) populates marketing-side metrics.
  • Automation — almost every CRM write fires an event the automation engine can hook (contact.created, email.opened, appointment.booked, tag.added).

Events are ambient — you don't subscribe via REST. Configure flows in the Automation module pointing at CRM event names, and they run on every matching write.