Email & Marketing Automation
Relevant source files
The following files were used as context for generating this wiki page:
KudosWall implements a robust email and marketing automation system designed to handle transactional messaging, user onboarding, and engagement tracking. The architecture primarily leverages Loops.so for marketing automation and Resend for core transactional templates, ensuring high deliverability and real-time synchronization of user lifecycle events.
The system is built to operate on the Cloudflare Edge, utilizing lightweight fetch-based clients to maintain performance while syncing complex user properties—such as testimonial counts and project metrics—across the marketing stack.
Sources: README.md:120-121, loops-email-collection.md:3-10
Architecture and Integration Plan
The marketing automation logic is centralized within the @my-better-t-app/email package, which provides a dedicated service for interacting with the Loops API. This integration ensures that application events—like project creation or testimonial reception—trigger immediate updates in the marketing database.
This diagram illustrates the flow of application events through the internal Loops client to external CRM synchronization and subsequent automated email delivery.
Sources: loops-email-collection.md:12-25, README.md:58-70
Component Breakdown
Loops Service Integration
The core of the marketing automation is the LoopsService, which handles four primary operations:
- Contact Creation: Initializing new users with default properties (
plan,testimonialCount, etc.). - Property Synchronization: Updating user-specific metrics as they interact with the platform.
- Event Tracking: Sending custom events (e.g.,
project_created) to trigger automated marketing loops. - Transactional Messaging: Sending one-off emails for specific actions like subscription confirmations.
| Method | Endpoint | Purpose |
|---|---|---|
createContact | /v1/contacts/create | Synchronizes signups to Loops with initial properties. |
updateContact | /v1/contacts/update | Updates counts for projects, testimonials, and widgets. |
sendEvent | /v1/events/send | Triggers marketing workflows based on real-time activity. |
sendTransactional | /v1/transactional | Sends verified transactional emails (e.g., payment success). |
Sources: loops-email-collection.md:27-35, packages/email/src/loops.ts
AI-Driven Email Responses
KudosWall utilizes an "Intelligence Engine" to enhance email interactions. Using structured AI prompts, the system can generate personalized "Thank You" email suggestions for customers who submit testimonials.
Key Logic for AI Replies:
- Contextual Reference: The AI identifies specific points made in user feedback.
- Conflict Resolution: Acknowledges problems if the user reports a negative experience.
- Growth Nudge: Automatically includes referral nudges for highly enthusiastic feedback.
Sources: apps/web/src/lib/ai/prompts.ts:165-178
Data Synchronization Flows
The system ensures that user state in the database is mirrored in the marketing CRM. This is critical for re-engagement workflows, such as "Showcase Customer Testimonials in Minutes," which targets users with low testimonial counts.
Testimonial Reception Sequence
When a new testimonial is approved, the system executes a background sync to Loops.
The sequence shows how the email-helpers.ts utility facilitates the dual-action of sending an event and updating property counts.
Sources: loops-email-collection.md:52-60, apps/web/src/lib/email-helpers.ts
Privacy and Compliance
The email system operates under strict privacy guidelines defined in the project's Data Processing Agreement (DPA) and Privacy Policy.
- Sub-processors: Resend is explicitly listed as a sub-processor for transactional email services.
- Consent: AI-generated responses and marketing loops are governed by a "Privacy-First Pledge," ensuring only minimal required data is processed.
- Security: All API interactions with Loops and Resend are encrypted via TLS and authenticated with environment-secured keys.
Sources: apps/web/src/app/(marketing)/dpa/page.tsx:100-115, apps/web/src/app/(marketing)/privacy/page.tsx:145-155
Summary
Email and marketing automation in KudosWall is a deeply integrated system that moves beyond simple messaging. By combining event-driven synchronization with Loops, transactional excellence through Resend, and AI-powered personalized content, the system converts raw application data into actionable marketing intelligence. This setup allows for automated growth loops that scale with the user's journey from a free tier builder to an agency partner.