Slice 10 — Marketing
Outbound communication: targeted SMS/email campaigns, GBP review reply assistance, Instagram/Facebook cross-posting. Respects opt-in flags and audit-logs sends.
Status: Schema done. Twilio integration not wired. Meta + GBP not wired.
Drafted from planning · v0.1
Scope
marketing_segments— saved customer queriesmarketing_campaigns— one batch sendmarketing_sends— per-recipient log- Twilio SMS for SMS campaigns
- Email provider (Resend or Postmark) for email campaigns
- GBP API for review replies
- Meta Graph for IG/FB cross-posts
Schema
marketing_segments(id, name, query_json, created_at)marketing_campaigns(id, segment_id, channel, subject, body, sent_at, status)marketing_sends(id, campaign_id, customer_id, channel_id, status, error_msg, sent_at)
Endpoints
GET /api/marketing/segments— listPOST /api/marketing/segments— create from queryPOST /api/marketing/campaigns— draftPOST /api/marketing/campaigns/:id/send— send (queued)GET /api/marketing/campaigns/:id/sends— per-recipient status
UI
Marketing screen (mockup-only today):
- Segments list (e.g., "Tune-up customers from last spring", "VIP customers", "Marketing-opted-in within 50km")
- Campaign composer (segment + channel + subject/body + send-now/schedule)
- Send progress + per-recipient status
In edit mode:
- Edit segment query
- Edit campaign template
Opt-in / opt-out enforcement
Every send checks the customer's marketing_email_opt_in or marketing_sms_opt_in. Sends to opted-out recipients return without API call and log status='skipped_opt_out'.
Twilio inbound STOP/UNSUBSCRIBE webhook flips the opt-in flag automatically and sends a confirmation.
What's not yet built
All UI and endpoints. Twilio adapter is the first piece needed; the rest layers on.