mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
Targeting & Acquisition OS (16 modules) — نظام الاستهداف الذكي - account_finder: account-first targeting; 12 buying signals; deterministic 10-25 accounts per (sector, city) - buyer_role_mapper: 14 buyer roles + sector-specific buying-committee maps + role-based Arabic angles - contact_source_policy: 12 sources (crm_customer→opt_out) with risk_score, channels-allowed, retention guidance, lawful_basis - contactability_matrix: 5 action modes (suggest_only/draft_only/approval_required/approved_execute/blocked); opt-out always blocked - linkedin_strategy: Lead Forms + Ads + manual ONLY; linkedin_do_not_do() locks scrape/auto-DM/auto-connect/extensions - email_strategy: drafts + unsubscribe footer + domain-pacing (fresh/warmed/trusted/damaged) + spam-trigger risk - whatsapp_strategy: opt-in only; rejects cold + risky phrases; opt-in template requires explicit purpose+company+unsubscribe - social_strategy: official APIs only; listening + drafts; no auto-publish - outreach_scheduler: day-by-day plans + daily limits + opt-out enforcement - reputation_guard: bounce/complaint/opt-out thresholds → healthy/watch/pause + recovery actions per channel - daily_autopilot: Arabic brief + 7 today actions + EOD report - acquisition_scorecard: pipeline + meetings + risks + productivity_score - self_growth_mode: 5 ICP focuses for Dealix; daily brief + monthly targets - free_diagnostic: Free Growth Diagnostic (3 ops + msg + risk + plan) → paid pilot recommendation - contract_drafts: Pilot/DPA/Referral/Agency/SOW outlines (legal_review_required, PDPL-aware) - service_offers: 7 targeting-tier offers + recommend by customer-type Service Tower (8 modules) — برج الخدمات الذاتية (12 productized services) - service_catalog: 12 services with target_customer/outcome/inputs/workflow/deliverables/pricing/risk/proof/upgrade - service_wizard: deterministic recommend (agency→partner; list→list_intelligence; founder→self_growth; CEO→exec_brief; budget≥2999→growth_os; default→first_10) - mission_templates: workflow steps with approval gates + linked growth missions - pricing_engine: SAR quotes scaled by company_size×urgency×channels_count + setup_fee + monthly_offer - deliverables: client report outline + proof pack template + operator checklist (no live actions) - service_scorecard: 0..100 score from drafts/replies/meetings/pipeline/CSAT - whatsapp_ceo_control: daily brief, approval cards (≤3 buttons), risk alerts, EOD reports - upgrade_paths: deterministic next-service recommendation + Arabic upsell messages Service Excellence OS (8 modules) — مصنع الخدمات الممتازة - feature_matrix: 12 must-have features per service + advanced/premium/future tiers - service_scoring: 10-dimension excellence score (clarity, speed_to_value, automation, compliance, proof, upsell, uniqueness, scalability, ops_daily, proof_data) → launch_ready/beta_only/needs_work - quality_review: 4 gates (proof / approval / pricing / channels) + status verdict; review_service_before_launch and review/all - competitor_gap: 7 competitor categories (CRM, WhatsApp tools, email assistants, LinkedIn tools, agencies, revenue intelligence, generic AI) + Dealix advantages + do-not-copy - proof_metrics: required metrics + ROI estimate (pipeline_x + closed_won_x) + Arabic summary - research_lab: monthly brief + feature hypotheses + top-3 experiments + monthly review - service_improvement_backlog: feedback→backlog conversion + impact/effort prioritization + weekly improvements - launch_package: landing outline + sales script + 12-min demo script + 5-day onboarding checklist Routers (3 new) — 62 endpoints - /api/v1/targeting/* — 20 endpoints (accounts, buying-committee, contacts, uploaded-list, outreach, daily-autopilot, self-growth, reputation, linkedin, drafts, free-diagnostic, services, contracts) - /api/v1/services/* — 20 endpoints (catalog, recommend, intake, start, workflow, deliverables, proof-pack, quote, setup-fee, monthly-offer, scorecard, upgrade-path, ceo daily-brief/approval-card/risk-alert/EOD) - /api/v1/service-excellence/* — 22 endpoints (feature-matrix, score, quality-review, review/all, proof-metrics, roi-estimate, gap-analysis, research-brief, hypotheses, experiments, monthly-review, backlog, weekly-improvements, launch-package, landing/sales/demo/onboarding) Tests (3 new files, 105 tests) - test_targeting_os: 47 tests (Arabic accounts, buying committees, opt-out blocked, cold WA blocked, LinkedIn no-scraping, email unsubscribe, WA risk, outreach plan, reputation guard, self-growth, contracts, scorecard) - test_service_tower: 38 tests (12+ services, all have pricing/proof/deliverables/approval, wizard recommendations, workflow includes approval, quote scales, CEO cards ≤3 buttons, no live send) - test_service_excellence: 33 tests (feature matrix, score returns status, ALL services pass quality gates, ROI x-multiples, 7 competitor categories, hypotheses+experiments, backlog conversion, launch package complete, demo=12min) Docs (3 new + 1 updated) - TARGETING_ACQUISITION_OS.md (Arabic) - SERVICE_TOWER_STRATEGY.md (Arabic) - SERVICE_EXCELLENCE_OS.md (Arabic) - DEALIX_100_PERCENT_LAUNCH_PLAN.md — added §36 Targeting OS + §37 Service Tower + §38 Service Excellence + §39 Landing Pages Landing pages (4 new, RTL Arabic) - services.html — 3 doors + 12 productized services - free-diagnostic.html — free growth diagnostic - first-10-opportunities.html — kill feature - agency-partner.html — agency partner program Test results - 105/105 new tests pass - Full suite: 768 passed, 2 skipped - 0 existing tests broken Safety + integration with previous layers - Targeting OS uses contactability_matrix → ALL contacts gated before any send - Service Tower's workflow includes approval gate; ALL services live_send_allowed=False - Service Excellence quality_review BLOCKS launch on missing proof/approval/pricing/unsafe channels - linkedin_do_not_do() encodes 8 explicit prohibitions (scraping/auto-DM/auto-connect/extensions) - whatsapp_do_not_do() blocks cold sends + group scraping - Contracts always: legal_review_required=True, not_legal_advice=True, PDPL sections present - Self-Growth Mode lets Dealix target its OWN ICP using the same approval-first pipeline Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
241 lines
8.9 KiB
Python
241 lines
8.9 KiB
Python
"""Targeting & Acquisition OS router."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from fastapi import APIRouter, Body
|
|
|
|
from auto_client_acquisition.targeting_os import (
|
|
analyze_uploaded_list_preview,
|
|
build_dealix_self_growth_plan,
|
|
build_daily_targeting_brief,
|
|
build_end_of_day_report,
|
|
build_followup_sequence,
|
|
build_free_growth_diagnostic,
|
|
build_lead_gen_form_plan,
|
|
build_outreach_plan,
|
|
build_self_growth_daily_brief,
|
|
build_weekly_learning_report,
|
|
calculate_channel_reputation,
|
|
draft_b2b_email,
|
|
draft_role_based_angle,
|
|
draft_whatsapp_message,
|
|
enforce_daily_limits,
|
|
evaluate_contactability,
|
|
explain_contactability_ar,
|
|
list_targeting_services,
|
|
map_buying_committee,
|
|
recommend_accounts,
|
|
recommend_dealix_targets,
|
|
recommend_linkedin_strategy,
|
|
recommend_recovery_action,
|
|
recommend_service_offer,
|
|
recommend_today_actions,
|
|
score_email_risk,
|
|
score_whatsapp_risk,
|
|
summarize_plan_ar,
|
|
summarize_reputation_ar,
|
|
)
|
|
from auto_client_acquisition.targeting_os.contract_drafts import (
|
|
draft_agency_partner_outline,
|
|
draft_dpa_outline,
|
|
draft_pilot_agreement_outline,
|
|
draft_referral_agreement_outline,
|
|
)
|
|
|
|
router = APIRouter(prefix="/api/v1/targeting", tags=["targeting-os"])
|
|
|
|
|
|
# ── Accounts ─────────────────────────────────────────────────
|
|
@router.post("/accounts/recommend")
|
|
async def accounts_recommend(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return recommend_accounts(
|
|
sector=payload.get("sector", "saas"),
|
|
city=payload.get("city", "Riyadh"),
|
|
offer=payload.get("offer", ""),
|
|
goal=payload.get("goal", "fill_pipeline"),
|
|
limit=int(payload.get("limit", 10)),
|
|
)
|
|
|
|
|
|
# ── Buying committee ─────────────────────────────────────────
|
|
@router.post("/buying-committee/map")
|
|
async def buying_committee_map(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return map_buying_committee(
|
|
sector=payload.get("sector", "saas"),
|
|
company_size=payload.get("company_size", "small"),
|
|
goal=payload.get("goal", "fill_pipeline"),
|
|
)
|
|
|
|
|
|
# ── Contacts ─────────────────────────────────────────────────
|
|
@router.post("/contacts/evaluate")
|
|
async def contacts_evaluate(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
contact = payload.get("contact") or payload
|
|
desired = payload.get("desired_channel")
|
|
result = evaluate_contactability(contact, desired_channel=desired)
|
|
result["explanation_ar"] = explain_contactability_ar(result)
|
|
return result
|
|
|
|
|
|
@router.post("/uploaded-list/analyze")
|
|
async def uploaded_list_analyze(
|
|
contacts: list[dict[str, Any]] = Body(..., embed=True),
|
|
) -> dict[str, Any]:
|
|
return analyze_uploaded_list_preview(contacts)
|
|
|
|
|
|
# ── Outreach ─────────────────────────────────────────────────
|
|
@router.post("/outreach/plan")
|
|
async def outreach_plan(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
plan = build_outreach_plan(
|
|
targets=payload.get("targets", []),
|
|
channels=payload.get("channels"),
|
|
goal=payload.get("goal", "fill_pipeline"),
|
|
)
|
|
plan = enforce_daily_limits(plan)
|
|
plan["summary_ar"] = summarize_plan_ar(plan)
|
|
return plan
|
|
|
|
|
|
# ── Daily autopilot ──────────────────────────────────────────
|
|
@router.get("/daily-autopilot/demo")
|
|
async def daily_autopilot_demo() -> dict[str, Any]:
|
|
return {
|
|
"brief": build_daily_targeting_brief(),
|
|
"today_actions": recommend_today_actions(),
|
|
"end_of_day_template": build_end_of_day_report(),
|
|
}
|
|
|
|
|
|
# ── Self-Growth Mode ─────────────────────────────────────────
|
|
@router.get("/self-growth/demo")
|
|
async def self_growth_demo() -> dict[str, Any]:
|
|
return {
|
|
"plan": build_dealix_self_growth_plan(),
|
|
"today": build_self_growth_daily_brief(),
|
|
}
|
|
|
|
|
|
@router.post("/self-growth/targets")
|
|
async def self_growth_targets(payload: dict[str, Any] = Body(default_factory=dict)) -> dict[str, Any]:
|
|
return recommend_dealix_targets(
|
|
sector_focus=payload.get("sector"),
|
|
city_focus=payload.get("city"),
|
|
limit=int(payload.get("limit", 10)),
|
|
)
|
|
|
|
|
|
@router.post("/self-growth/weekly-report")
|
|
async def self_growth_weekly(payload: dict[str, Any] = Body(default_factory=dict)) -> dict[str, Any]:
|
|
return build_weekly_learning_report(payload)
|
|
|
|
|
|
# ── Reputation guard ────────────────────────────────────────
|
|
@router.get("/reputation/status")
|
|
async def reputation_status() -> dict[str, Any]:
|
|
"""Demo reputation snapshot."""
|
|
healthy_email = {"bounce_rate": 0.005, "complaint_rate": 0.0001,
|
|
"opt_out_rate": 0.01, "reply_rate": 0.04}
|
|
risky_wa = {"block_rate": 0.04, "report_rate": 0.005,
|
|
"opt_out_rate": 0.06, "reply_rate": 0.02}
|
|
return {
|
|
"email": calculate_channel_reputation(healthy_email, channel="email"),
|
|
"whatsapp": calculate_channel_reputation(risky_wa, channel="whatsapp"),
|
|
}
|
|
|
|
|
|
@router.post("/reputation/recovery")
|
|
async def reputation_recovery(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return recommend_recovery_action(
|
|
payload.get("metrics", {}),
|
|
channel=payload.get("channel", "email"),
|
|
)
|
|
|
|
|
|
# ── LinkedIn strategy ────────────────────────────────────────
|
|
@router.post("/linkedin/strategy")
|
|
async def linkedin_strategy(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
strategy = recommend_linkedin_strategy(
|
|
segment=payload.get("segment", "B2B Saudi"),
|
|
goal=payload.get("goal", "fill_pipeline"),
|
|
)
|
|
if payload.get("with_lead_gen_form"):
|
|
strategy["lead_gen_form_plan"] = build_lead_gen_form_plan(
|
|
segment=payload.get("segment", "B2B Saudi"),
|
|
offer=payload.get("offer", "Pilot 7 days"),
|
|
campaign_name=payload.get("campaign_name", ""),
|
|
)
|
|
return strategy
|
|
|
|
|
|
# ── Drafts ───────────────────────────────────────────────────
|
|
@router.post("/drafts/email")
|
|
async def drafts_email(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
contact = payload.get("contact", {})
|
|
draft = draft_b2b_email(
|
|
contact,
|
|
offer=payload.get("offer", ""),
|
|
why_now=payload.get("why_now", ""),
|
|
)
|
|
risk = score_email_risk(contact, draft.get("body_ar", ""))
|
|
return {**draft, "risk": risk}
|
|
|
|
|
|
@router.post("/drafts/whatsapp")
|
|
async def drafts_whatsapp(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
contact = payload.get("contact", {})
|
|
return draft_whatsapp_message(
|
|
contact,
|
|
offer=payload.get("offer", ""),
|
|
why_now=payload.get("why_now", ""),
|
|
)
|
|
|
|
|
|
@router.post("/drafts/email-followup")
|
|
async def drafts_email_followup(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return build_followup_sequence(
|
|
payload.get("contact", {}),
|
|
offer=payload.get("offer", ""),
|
|
)
|
|
|
|
|
|
@router.post("/drafts/role-angle")
|
|
async def drafts_role_angle(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return draft_role_based_angle(
|
|
role_key=payload.get("role_key", "founder_ceo"),
|
|
sector=payload.get("sector", "saas"),
|
|
offer=payload.get("offer", ""),
|
|
)
|
|
|
|
|
|
# ── Free diagnostic ──────────────────────────────────────────
|
|
@router.post("/free-diagnostic")
|
|
async def free_diagnostic(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return build_free_growth_diagnostic(payload)
|
|
|
|
|
|
# ── Services + contracts ─────────────────────────────────────
|
|
@router.get("/services")
|
|
async def services_list() -> dict[str, Any]:
|
|
return list_targeting_services()
|
|
|
|
|
|
@router.post("/services/recommend")
|
|
async def services_recommend(payload: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
|
return recommend_service_offer(
|
|
customer_type=payload.get("customer_type", ""),
|
|
goal=payload.get("goal", "fill_pipeline"),
|
|
)
|
|
|
|
|
|
@router.get("/contracts/templates")
|
|
async def contracts_templates() -> dict[str, Any]:
|
|
return {
|
|
"pilot": draft_pilot_agreement_outline(),
|
|
"dpa": draft_dpa_outline(),
|
|
"referral": draft_referral_agreement_outline(),
|
|
"agency_partner": draft_agency_partner_outline(),
|
|
}
|