system-prompts-and-models-o.../dealix/auto_client_acquisition/launch_ops/outreach_messages.py
Dealix Builder 84f1ad9620 feat(launch+revenue): Private Beta Launch Ops + Revenue Launch — 14 modules + 29 endpoints + 56 tests + scripts/landing/docs
Launch Ops (5 modules) — برج إطلاق الـ Private Beta
- private_beta: 499 SAR × 7-day offer + safety notes + 6-question Arabic FAQ
- demo_flow: 12-minute minute-by-minute Arabic demo + 5 discovery Qs + 6 objection responses + close script
- outreach_messages: 4 segments × 5 prospects = 20 + per-segment Arabic messages + 3-step follow-ups + 6 reply handlers
- go_no_go: 10-gate readiness + 3 critical gates (no_secrets/live_sends_disabled/staging_health) + verdict + next-actions
- launch_scorecard: 11 event types + daily/weekly aggregation + targets (20 outreach/5 replies/3 demos/1 pilot daily)

Revenue Launch (7 modules) — تحويل Dealix إلى دخل
- offer_builder: 4 offers (Private Beta, 499 Pilot, Growth OS Pilot 1.5-3K, Free Case Study) + segment-aware recommend
- pipeline_tracker: 8-stage deterministic pipeline + add/update/summarize + revenue tracking + win rate
- outreach_sequence: re-export single source of truth from launch_ops with revenue-tier wrappers
- demo_closer: re-export from launch_ops
- pilot_delivery: 12-field intake form + 5-phase 24h delivery plan + per-service templates (First 10 / List Intel / Free Diagnostic)
- proof_pack_template: 5-line Arabic client summary + ROI estimate (pipeline_x + closed_won_x) + next-step recommendation (upsell/iterate/extend)
- payment_manual_flow: Moyasar invoice step-by-step (halalas-correct) + Arabic payment-link message + confirmation checklist; NEVER charges via API

Service Tower extensions (2 modules)
- contract_templates: re-export targeting_os contracts + new SLA outline (legal_review_required, PDPL-aware)
- vertical_service_map: 6 verticals (B2B SaaS / agencies / training-consulting / real estate / healthcare-local / retail-ecommerce) with primary+supporting services + buyer roles + common pains + winning offer

Routers (2 new) — 29 endpoints
- /api/v1/launch/* — 11 endpoints (private-beta/offer, demo/flow, outreach/{first-20, message, followup}, go-no-go, readiness, scorecard/{event, daily, weekly, demo})
- /api/v1/revenue-launch/* — 18 endpoints (offers + offers/recommend, outreach/{first-20, followup}, demo-flow, pipeline/{schema, summarize}, pilot-delivery/{intake-form, 24h-plan, first-10, list-intelligence, free-diagnostic}, payment/{invoice-instructions, link-message, confirmation-checklist}, proof-pack/{template, client-summary, next-step})

Tests (2 new files, 56 tests)
- test_launch_ops.py: 25 tests (Private Beta offer essentials + Arabic FAQ; demo flow 12-min structure; first-20 segments × 5; outreach Arabic + drafts only; followup steps differ; reply handlers include unsubscribe; go/no-go critical gates block; scorecard aggregation + verdict)
- test_revenue_launch.py: 31 tests (offers correct prices, no_live_charge=True; segment-aware recommends; pipeline 8 stages + add/update/summarize + win rate; outreach v2 Arabic; intake fields; 24h plan 5 phases; invoice halalas correct; payment confirmation blocks premature delivery; proof pack 5 lines + 3 next-step paths)

Scripts (1 new)
- scripts/launch_readiness_check.py: runs 10 gates locally + optional --staging-url; pretty/JSON output; critical gates determine GO/NO-GO/FIX-THEN-GO verdict

Landing pages (2 new, RTL Arabic)
- list-intelligence.html — List Intelligence service detail (499–1,500 SAR)
- growth-os.html — Growth OS Monthly subscription page (2,999 SAR/month)

Docs (1 new + 1 updated)
- REVENUE_TODAY_PLAYBOOK.md (Arabic) — 12-section playbook: offers, segments, messages, demo, pipeline, 24h delivery, Moyasar manual flow, proof pack, daily targets, go/no-go, what-not-to-do, next-step
- DEALIX_100_PERCENT_LAUNCH_PLAN.md — added §40 Launch Ops + §41 Revenue Launch + §42 Service Tower extensions + §43 Scripts

Test results
- 56/56 new tests pass
- Full suite: 824 passed, 2 skipped (missing API keys, unrelated)
- 0 existing tests broken

Safety integration
- All offers: live_send_allowed=False, no_live_charge=True, approval_required=True
- 10-gate go/no-go BLOCKS launch if no_secrets/live_sends_disabled/staging_health fail
- Moyasar: invoice/payment-link manual only; NEVER calls live charge API
- Payment confirmation checklist blocks delivery before invoice paid status
- All outreach messages: drafts only, follow-ups capped at 3, opt-out honored immediately
- 6 verticals mapped to safe service stacks; LinkedIn always Lead Forms (never scraping)

Integration with previous layers
- Launch Ops uses platform_services tool_gateway, intelligence_layer command_feed, security_curator redaction
- Revenue Launch uses targeting_os contractability + service_tower offers + intelligence_layer simulator
- Pipeline tracker integrates with action_ledger for stage transitions
- Proof Pack template references intelligence_layer proof metrics + service_excellence ROI

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 17:28:08 +03:00

189 lines
7.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""First 20 outreach segments + per-segment Arabic messages + reply handlers."""
from __future__ import annotations
from typing import Any
def build_first_20_segments() -> dict[str, Any]:
"""The deterministic first-20 plan — 4 segments × 5 prospects each."""
return {
"total_targets": 20,
"segments": [
{
"id": "agency_b2b",
"label_ar": "وكالات تسويق B2B",
"count": 5,
"best_offer_id": "agency_partner_program",
"fallback_offer_id": "partner_sprint",
"primary_channel": "email",
},
{
"id": "training_consulting",
"label_ar": "شركات تدريب واستشارات",
"count": 5,
"best_offer_id": "first_10_opportunities_sprint",
"fallback_offer_id": "free_growth_diagnostic",
"primary_channel": "email",
},
{
"id": "saas_tech_small",
"label_ar": "SaaS / تقنية صغيرة",
"count": 5,
"best_offer_id": "first_10_opportunities_sprint",
"fallback_offer_id": "growth_os_monthly",
"primary_channel": "linkedin_lead_form",
},
{
"id": "services_with_whatsapp",
"label_ar": "شركات خدمات لديها واتساب نشط",
"count": 5,
"best_offer_id": "list_intelligence",
"fallback_offer_id": "whatsapp_compliance_setup",
"primary_channel": "email",
},
],
"rules_ar": [
"لا scraping ولا قوائم مشتراة.",
"استخدم علاقاتك المباشرة + جهات تعرفها.",
"كل رسالة يدوية، لا automation.",
"حد أقصى 3 follow-ups ثم أرشفة.",
],
}
_BASE_INTRO = "هلا [الاسم]، أطلقنا Beta محدودة لـ Dealix."
def build_outreach_message(segment_id: str, *, name: str = "[الاسم]") -> dict[str, Any]:
"""Build the first-touch Arabic message for a segment."""
intro = f"هلا {name}،"
if segment_id == "agency_b2b":
body = (
f"{intro} عندي Beta خاص للوكالات.\n\n"
"Dealix يساعد الوكالة تطلع فرص لعملائها، تجهز رسائل عربية، تدير "
"موافقات، وتطلع Proof Pack باسم الوكالة والعميل.\n\n"
"أبحث عن وكالة واحدة نجرب معها Pilot مشترك على عميل حقيقي. "
"يناسبك ديمو 15 دقيقة؟"
)
elif segment_id == "training_consulting":
body = (
f"{intro} متابع توسع شركتكم في برامج الشركات.\n\n"
"Dealix يطلع لكم 10 فرص B2B خلال 7 أيام، يكتب الرسائل بالعربي، "
"ويخلي صاحب القرار يوافق قبل أي تواصل، وبعدها يعطي Proof Pack.\n\n"
"Pilot بـ499 ريال أو مجاني مقابل case study. يناسبك ديمو 12 دقيقة؟"
)
elif segment_id == "saas_tech_small":
body = (
f"{intro} رأيت إصدار النسخة الجديدة من منتجكم — مبروك.\n\n"
"نشتغل على مدير نمو عربي يطلع 10 فرص B2B، يستخدم LinkedIn Lead "
"Forms (لا scraping)، ويكتب الرسائل بالعربي.\n\n"
"أبغى أجربه مع شركة SaaS سعودية واحدة. يناسبك ديمو 12 دقيقة؟"
)
elif segment_id == "services_with_whatsapp":
body = (
f"{intro} عندكم قاعدة عملاء واتساب نشطة، صحيح؟\n\n"
"Dealix ينظف القائمة، يصنف الـ opt-in، يحظر cold WhatsApp تلقائياً، "
"ويكتب رسائل عربية للحملات الآمنة + Proof Pack شهري.\n\n"
"List Intelligence بـ4991,500 ريال. يناسبك أعطيك تشخيص مجاني أولاً؟"
)
else:
body = (
f"{intro} {_BASE_INTRO}\n\n"
"Dealix يطلع لك 10 فرص B2B + رسائل عربية + Proof Pack — "
"وأنت توافق قبل أي تواصل. Pilot 7 أيام بـ499 ريال. "
"يناسبك ديمو 12 دقيقة؟"
)
return {
"segment_id": segment_id,
"channel": "email_or_dm",
"body_ar": body,
"approval_required": True,
"live_send_allowed": False,
}
def build_followup_message(
segment_id: str, *, step: int = 1, name: str = "[الاسم]",
) -> dict[str, Any]:
"""Build follow-up #1, #2, or #3 (final archive)."""
if step <= 1:
body = (
f"هلا {name}، أرسل لك مثال سريع بدل شرح طويل؟\n"
"أقدر أطلع لك عينة من 3 فرص مناسبة لشركتكم + رسالة واحدة جاهزة + "
"ملاحظة عن أفضل قناة. إذا أعجبتك نكمل Pilot كامل."
)
kind = "followup_1"
elif step == 2:
body = (
f"هلا {name}، أعرف أن وقتك مزدحم.\n"
"سؤال أخير: لو طلعت لك 3 فرص B2B بالعربي مجاناً هذا الأسبوع، "
"تعطيني 15 دقيقة feedback؟"
)
kind = "followup_2"
else:
body = (
f"هلا {name}، أعتذر على الإلحاح.\n"
"أرشّفها وأكون موجود لو احتجتني لاحقاً. شاكر لك."
)
kind = "followup_3_final"
return {
"segment_id": segment_id,
"step": step,
"kind": kind,
"body_ar": body,
"approval_required": True,
"live_send_allowed": False,
}
def build_reply_handlers() -> dict[str, dict[str, str]]:
"""Standard reply-classifier → response mapping (Arabic)."""
return {
"interested": {
"label_ar": "مهتم",
"response_ar": (
"ممتاز. أرسل لك intake form + موعد ديمو 12 دقيقة هذا الأسبوع. "
"أي وقت يناسبك بين 10 ص و 5 م؟"
),
"next_action": "send_intake_and_demo_link",
},
"needs_more_info": {
"label_ar": "يحتاج معلومات أكثر",
"response_ar": (
"أرسل لك Free Growth Diagnostic — 3 فرص + رسالة + توصية، "
"بدون التزام. أحتاج فقط: قطاعكم، مدينتكم، عرضكم الرئيسي."
),
"next_action": "send_free_diagnostic_intake",
},
"price_objection": {
"label_ar": "اعتراض سعر",
"response_ar": (
"تمام، نبدأ بـ Free Diagnostic مجاناً. "
"تشوفون النتائج قبل أي دفع."
),
"next_action": "send_free_diagnostic_intake",
},
"not_now": {
"label_ar": "ليس الآن",
"response_ar": (
"تمام، شاكر لك. أتواصل معك بعد شهرين بدون إلحاح. "
"إن احتجتنا قبل، أنا موجود."
),
"next_action": "schedule_followup_60_days",
},
"no_thanks": {
"label_ar": "غير مهتم",
"response_ar": "تمام، شاكر لك. أرشّفها وأتمنى لكم التوفيق.",
"next_action": "archive",
},
"unsubscribe": {
"label_ar": "إلغاء",
"response_ar": "تم. لن أتواصل معك مجدداً.",
"next_action": "honor_opt_out_immediately",
},
}