Marketing Platform Implementation
Unified marketing platform combining contact management, data enrichment, campaign execution, and omnichannel communication
Key Features
CSV upload, enrichment queue, manual updates via chat interface, opt-out tracking
Multi-agent architecture with Firecrawl scraping, OpenAI analysis, source citation, human review
SMS via Sent.dm, Email via Postmark, targeting filters, smart send rules, rate limiting
Chatwoot integration for SMS, Email, Facebook, Instagram, WhatsApp, Telegram responses
Cal.com webhooks to track bookings, link to contacts and campaigns
AI-generated ad copy for Facebook, Google, LinkedIn with targeting suggestions
Track contacts per day, SMS/Email sent, responses, opt-outs, cost breakdown
Full timeline per contact showing all SMS, Emails, Ads, responses, meetings
System Architecture
┌─────────────────────────────────────────────────────────┐
│ UNIFIED PLATFORM │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │
│ │ Contact │ │ Enrichment │ │ Campaign │ │
│ │ Management │ │ Pipeline │ │ Management │ │
│ └─────────────┘ └──────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │
│ │ Marketing │ │ Chat │ │ Analytics │ │
│ │ History │ │ Interface │ │ Dashboard │ │
│ └─────────────┘ └──────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │
│ │ Ad Copy │ │ SMS │ │ Email │ │
│ │ Generator │ │ (Sent.dm) │ │ (Postmark) │ │
│ └─────────────┘ └──────────────┘ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────┘
│
▼
┌────────────────┐
│ PostgreSQL │
│ Database │
└────────────────┘
│
┌────────┴────────┐
│ │
▼ ▼
┌─────────────┐ ┌──────────┐
│ Chatwoot │ │ n8n │
│ (Inbox) │ │ (Scrapers)│
└─────────────┘ └──────────┘
│
▼
┌─────────────┐
│ Cal.com │
│ (Meetings) │
└─────────────┘Technology Stack
Database Schema
contacts
Core contact information with enriched data
campaigns
SMS/Email/Ad campaign definitions
marketing_activities
Every SMS, Email, Ad interaction per contact
daily_analytics
Aggregated daily metrics
conversation_messages
Omnichannel messages (SMS, Email, Facebook, Instagram, WhatsApp)
calendar_bookings
Cal.com meeting bookings
enrichment_queue
Human review queue for enrichment
ad_campaigns
Social media ad campaigns
Implementation Phases
Database + Backend API
Goals:
- Set up PostgreSQL database with Prisma ORM
- Create backend API endpoints for contacts and campaigns
- Migrate contractor-marketing to use API
- Add basic authentication
Key Tasks:
- •Initialize Prisma and create schema
- •Create API endpoints (contacts, campaigns, analytics)
- •Refactor frontend to use API calls
- •Implement Next-Auth with credentials
With Human Review
Goals:
- Integrate fire-enrich-email enrichment engine
- Add human-in-the-loop review interface
- Create enrichment queue system
- Add chat interface for manual updates
Key Tasks:
- •Extract enrichment core from fire-enrich-email
- •Build enrichment API endpoints
- •Create review interface with approval workflow
- •Implement chat-based contact updates
Chatwoot + Cal.com Integration
Goals:
- Set up Chatwoot for unified inbox
- Track responses across SMS, Email, Facebook, Instagram, WhatsApp
- Integrate Cal.com for meeting bookings
- Link all conversations to contacts
Key Tasks:
- •Deploy Chatwoot (self-hosted or cloud)
- •Connect all communication channels
- •Build Chatwoot webhook handler
- •Build Cal.com webhook handler
- •Update contact timeline with conversations
Daily Tracking
Goals:
- Track all marketing activities per contact
- Build daily analytics dashboard
- Prevent duplicate sends
- Calculate contact frequency limits
Key Tasks:
- •Implement automatic activity tracking
- •Build daily analytics aggregation
- •Create analytics dashboard UI
- •Add contact history timeline view
& Sending
Goals:
- Create campaigns with targeting
- Send SMS via Sent.dm
- Send Email via Postmark
- Real-time progress tracking
Key Tasks:
- •Build campaign builder interface
- •Integrate Postmark for email
- •Create campaign queue worker (BullMQ + Redis)
- •Set up delivery webhooks
Goals:
- Generate ad copy based on contact data
- Create targeting suggestions
- Support Facebook, Google, LinkedIn
- Manual ad creation workflow
Key Tasks:
- •Build AI ad copy generator
- •Create targeting logic
- •Build ad builder interface
- •Manual performance tracking
Goals:
- Connect n8n scrapers to database
- Automate contact import
- Trigger enrichment from n8n
- Two-way sync
Key Tasks:
- •Create webhook endpoints for n8n
- •Add API key authentication
- •Document n8n workflow patterns
Deployment
Frontend (Current Status)
- • React 19 + Vite 8 + TypeScript
- • Multi-stage Docker build (Node 20 Alpine → nginx Alpine)
- • Deployed to Coolify via GitHub integration
- • GitHub: devsupport-tech/marketing-platform
Backend (Planned)
- • Next.js 15 API routes
- • PostgreSQL database (Supabase or self-hosted)
- • Redis for BullMQ queue
- • Deployed to Coolify or Vercel
Dependencies
- • Chatwoot (self-hosted or cloud)
- • n8n (self-hosted on Coolify)
- • Cal.com API
- • Sent.dm, Postmark, OpenAI, Firecrawl (external APIs)