Commit Graph

2 Commits

Author SHA1 Message Date
Claude
066ce32aa7
feat(dealix): full automation outreach system — draft queue + pipeline + send
Complete outreach automation that generates drafts → Sami approves → system sends:

1. OutreachDraft model (models/outreach_draft.py):
   DB-persisted draft queue. Every message starts as status='draft'.
   Fields: company, channel, subject, body, followups, sector, scores,
   status (draft→approved→sent→replied→opted_out→bounced), timestamps.

2. Daily Pipeline (automation.py → /daily-pipeline/run):
   Generates N targets per sector/city, runs compliance check,
   creates personalized emails with Arabic pain maps, stores as
   draft rows in DB. Returns batch_id for approval.

3. Draft Queue API (drafts.py):
   - GET /drafts — list by status/channel/batch
   - GET /drafts/stats — counts per status
   - GET /drafts/{id} — full draft with body + followups
   - POST /drafts/{id}/approve — mark approved
   - POST /drafts/approve-batch — approve entire batch
   - POST /drafts/{id}/send — dispatch via email/whatsapp/sms
   - POST /drafts/{id}/skip — archive draft
   - PATCH /drafts/{id} — edit before approving
   - POST /drafts/{id}/log-reply — paste reply → auto-classify →
     generate suggested response → update status

4. Send dispatch uses existing integrations:
   - Email: integrations/email_sender.py (SMTP)
   - WhatsApp: integrations/whatsapp.py (Business API + mock)
   - SMS: integrations/sms.py (Unifonic)
   - LinkedIn: manual_required (copy from dashboard)

Safety:
- All drafts require approval (approval_required=True default)
- Unsubscribe reply → immediate opt_out status
- Compliance gate blocks: opt_out, bounced, high_risk, no_source
- Personal email → warning to use manual channel
- Rate limits enforced at send level

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-25 17:33:30 +00:00
Claude
b3fb265237
feat(dealix): autonomous daily targeting + email + reply engine
Complete automation system for 50 personalized emails/day:

1. POST /api/v1/automation/daily-targeting/generate
   - Pulls candidates by sector/city, scores, selects top 50
   - 9 Saudi sectors with Arabic pain maps and ROI hypotheses

2. POST /api/v1/automation/email/generate
   - Personalized email per company with subject, body, 2 follow-ups,
     call script, LinkedIn manual message
   - Signal-aware (HubSpot/WhatsApp detection in opening line)
   - Opt-out included in every email
   - Max 130 words per email

3. POST /api/v1/automation/compliance/check
   - Blocks: opt-out, bounced, high-risk, no-source, invalid email
   - Warns: personal email → manual channel preferred
   - PDPL-aware: free email domains flagged

4. POST /api/v1/automation/reply/classify
   - 12 categories: interested, ask_price, ask_demo, unsubscribe, etc
   - Arabic + English keyword matching
   - Pre-written Khaliji response for each category
   - auto_reply_allowed flag per category
   - unsubscribe → immediate opt_out + suppress

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-25 13:28:12 +00:00