Skip to content

Business Flow — End-to-End Journeys

This page describes Prism from the product/business perspective. Each flow has a matching technical counterpart in the module docs and in ../02-Architecture/Request-LifeCycle.md.

There are two "customers" to keep straight: - Client lifecycle — the restaurant brand signing up for Prism. - Guest lifecycle — the diner whose data flows through Prism once a client is live.


1. Client Lifecycle (restaurant onboarding → renewal)

From the Onboarding & Operations sheet:

flowchart LR
    A[Lead Generation<br/>Marketing] --> B[Product Demo<br/>Sales]
    B --> C[Pricing Discussion<br/>BD]
    C --> D[Onboarding<br/>Ops]
    D --> E[DLT + WhatsApp<br/>Integration]
    E --> F[Wallet Recharge]
    F --> G[Auto Campaigns Setup]
    G --> H[Training / Demo<br/>AM]
    H --> I[Daily Reports<br/>System]
    I --> J[Account Management]
    J --> K[Renewal + Recharge]

Go-Live Checklist (23 steps, owner = Account Management unless noted)

  1. Setup — Create Parent ID → Create Child ID(s) → verify POS name.
  2. Integration — Complete POS integration → test data flowing to uEngage. Supported POS: PetPooja, Urban Piper, Posist, LS Central, Rista.
  3. SMS setup — DLT header (client) → DLT templates (client) → map templates in uEngage.
  4. WhatsApp setup — WABA (client) → WA templates (client) → map templates in uEngage.
  5. Digital Bills — setup → test.
  6. Feedback — setup SMS+WA → test.
  7. Automation — configure all 8 automated journeys.
  8. Campaigns — test & launch Push, SMS, WA campaigns.
  9. Loyalty & Referral — setup loyalty engine (tiers/points/earn/burn) → setup Refer-&-Earn → test both.

Technical mapping: Parent/Child = parent_business_id / child_business_id throughout the code; POS integration = the ingestion controllers + prism-services Lambdas; template mapping = campaign template config. See ../03-Modules/Admin-Business/README.md.


2. Order Lifecycle (the data heartbeat)

Every order from every channel follows this path. This is the most important flow in the system.

sequenceDiagram
    participant SRC as Source (POS/App/Aggregator)
    participant ING as Ingestion API
    participant Q as crm_queue (MongoDB)
    participant PROC as Processor cron/consumer
    participant C360 as Customer 360 / Order data
    participant PTS as Points Allocation Queue
    participant NOTI as Notifications (Digital Bill / Journey)

    SRC->>ING: Order payload (POST /crm_api/injestion/{pos})
    ING->>Q: Insert {data, source, status:0, insertedAt}
    Note over Q: Order parked in queue with source id
    PROC->>Q: Poll status:0 documents
    PROC->>C360: Upsert customer + append order, recompute LTV/LTO/AOV
    PROC->>PTS: Enqueue loyalty points (earn)
    PROC->>NOTI: Trigger digital bill + eligible journeys
    PROC->>Q: Mark status = processed

Business rules layered on top: - Cancelled/refunded orders are excluded from revenue, AOV, most-selling-item. - Points from cancelled orders are clawed back (Dashboard 3.12 note). - Order type split: Delivery / Pick-Up / Dine-In — each can have its own loyalty earn/burn %. - Customer identity is unified across channels by phone (dedup is critical — Dashboard 3.3 note).

Technical mapping: ../03-Modules/Order-Ingestion/README.md, ../06-Queues/README.md, prism-services map.


3. Guest (Customer) Lifecycle — the retention loop

stateDiagram-v2
    [*] --> New: first order (R=4-5, FM=1)
    New --> Promising: repeat but low freq
    Promising --> PotentialLoyalist: building habit
    PotentialLoyalist --> Loyal: consistent
    Loyal --> Champions: recent+frequent+high spend
    Champions --> NeedsAttention: slipping
    Loyal --> NeedsAttention: slipping
    NeedsAttention --> AboutToSleep: declining
    AboutToSleep --> AtRisk: fading
    AtRisk --> CantLose: was top, going silent
    AboutToSleep --> Hibernating: dormant, low value
    Hibernating --> Lost: gone
    CantLose --> Lost: gone
    Champions --> Champions: retained
    Lost --> [*]

Each RFM segment has a prescribed marketing action (Excel Customer Intelligence 2.x). Prism's whole job is to move guests up this ladder and win back those sliding down:

Segment Prescribed action
Champions Exclusive offers, VIP, referral program
Loyal Upsell, cross-sell, loyalty rewards
New Welcome offer, encourage 2nd visit
At Risk / Can't Lose High-priority win-back, personal outreach
Lost Hail-mary offer OR clean from lists

Technical mapping: RFM computed nightly by crons/rfmSegments.js; segment→action via Campaigns/Journeys. See ../03-Modules/Customer-Intelligence-RFM/README.md.


4. Automated Journey Flow (EVENT → CONDITION → ACTION)

The 8 journeys are one-time setup, then run automatically. On activation, up to 10,000 eligible past customers are backtracked.

flowchart TD
    E1[Sign-up] --> W[Welcome Message]
    E2[Birthday approaching] --> B[Birthday Campaign]
    E3[Anniversary] --> AN[Anniversary Campaign]
    E4[Wallet points near expiry] --> WE[Wallet Expiry Campaign]
    E5[No order for X days] --> LC[Lost Customers Campaign]
    E6[Cart abandoned X min] --> AC[Abandoned Cart]
    E7[Low rating submitted] --> LR[Low Rating Rewards]
    E8[Order count threshold] --> RB[Referral Boost]
    W & B & AN & WE & LC & AC & LR & RB --> CH{{WhatsApp / SMS}}
    CH --> M[Metrics: delivery, open, conversion, revenue]

Technical mapping: crons/processAutomatedCampaigns.jscommonFunctions/automatedCampaignQueueNew.js → channel queues. See ../03-Modules/Automated-Journeys/README.md.


5. Campaign Flow (manual outreach)

flowchart LR
    A[Select Channel<br/>WA/SMS/Push] --> B[Audience Selection<br/>preset segment / upload / cohort]
    B --> C[Template Selection]
    C --> D[Sender ID + ROI window]
    D --> E[Schedule date/time]
    E --> F[Send → channel queue]
    F --> G[Delivery/Read/Click tracking]
    G --> H[ROI attribution<br/>revenue in X-hour window]
    H --> I[Campaign Analytics / MIS]

Business wallet is debited per message; sends are blocked if balance is insufficient.

Technical mapping: ../03-Modules/Campaigns/README.md, models/campaign_mis.js, processLibrary/campaignMis.js.


6. Loyalty & Membership Flow

Loyalty (free): order → earn points (per-order-type %) → points ledger → redeem at POS/cart → tier upgrade/downgrade → expiry. KYC gates welcome points.

Membership (paid):

flowchart LR
    A[Admin creates plan<br/>8-tab builder] --> B[Customer buys<br/>App/Web/POS]
    B --> C[Benefits activate<br/>optional delay]
    C --> D[Auto-apply at POS checkout]
    D --> E[CRM notifications:<br/>purchase, redemption, expiry]
    E --> F[Analytics: redemption rate, renewal rate]

Plan states: Draft → Active → Paused → Expired. Once Active, price/benefits/validity are locked (must pause→duplicate→edit). One active membership per customer.

Technical mapping: ../03-Modules/Loyalty/README.md, ../03-Modules/Membership/README.md, commonFunctions/handleWalletPointsFlow.js, handleMilestoneUpgrade.js.


7. Feedback & Digital Bill Flow

flowchart LR
    O[Order completed] --> DB[Digital Bill sent<br/>WA/SMS, immediate or delayed 15-240min]
    DB --> V[Customer views branded bill<br/>itemized + points earned + upsell]
    V --> FB[Feedback form link]
    FB --> R{Rating}
    R -->|High| GMB[Route to Google/Zomato reviews]
    R -->|Low| REC[Low-rating recovery journey + promo]
    FB --> NPS[NPS scoring: Promoter/Passive/Detractor]

Technical mapping: ../03-Modules/Digital-Bills/README.md, ../03-Modules/Feedback-NPS/README.md.


Edge Cases & Gotchas (business-level)

  • Channel integration inactive → dashboard shows 0, never omit the channel (Dashboard 3.5 note).
  • Never-ordered customers → automatically R=1 in RFM.
  • Clustered data → some RFM quintiles (F=2/F=4) may not appear at all.
  • Tier downgradeall unredeemed points immediately forfeited (Loyalty 2.3 — strict rule).
  • Membership renewal: same plan extends from expiry; a different plan is blocked while one is active.
  • Timezone: hourly/"when do they buy" analytics use the outlet's local timezone.

Assessment

Level-2 scenario questions in ../15-Assessments/01-Business-Assessment.md.