mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
CI Fix:
All 8 Tier-1 API routes now use fully lazy imports — no module-level
imports of app.database, app.services, or app.models. Every import
happens inside the function body. This prevents pytest collection
failure (exit code 4) caused by import chain side effects during
test discovery.
Pattern: _get_db() async generator wraps app.database.get_db lazily.
Service/model imports are inside each route handler function.
Revenue Activation System (3 phases):
revenue-activation/FIRST_3_CLIENTS_PLAN.md
— ICP definition, outreach scripts (WhatsApp/LinkedIn/Email),
demo strategy, pricing (15K-50K SAR pilot), closing playbook,
objection handling, referral scripts, pipeline KPIs
revenue-activation/deployment/LIVE_DEPLOYMENT_GUIDE.md
— Step-by-step client installation in 48h, data import,
training agenda, pilot monitoring, post-pilot conversion
revenue-activation/AUTOMATED_REVENUE_ENGINE.md
— Self-generating pipeline: outreach→demo→pilot→case study→referral,
auto-sequences, AI response classification, upsell triggers,
90-day revenue targets (100K+ SAR MRR)
revenue-activation/outreach/whatsapp-sequences.json
— 3 ready-to-use sequences: cold B2B, warm referral, post-pilot convert
revenue-activation/demo/seed_demo_tenant.py
— Seeds demo tenant with 15 leads, 8 deals, 3 approvals with SLA,
4 connectors, 1 evidence pack for executive simulation demos
https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
310 lines
10 KiB
Markdown
310 lines
10 KiB
Markdown
# 🚀 Automated Revenue Engine — Self-Generating Pipeline
|
|
|
|
> **هدف**: النظام يجيب العملاء بنفسه
|
|
> **المعادلة**: Outreach → Demo → Pilot → Case Study → Referral → Repeat
|
|
|
|
---
|
|
|
|
## Revenue Loop Architecture
|
|
|
|
```
|
|
┌─────────────────────────────────────────────┐
|
|
│ AUTOMATED REVENUE LOOP │
|
|
│ │
|
|
│ ┌──────────┐ ┌──────────┐ │
|
|
│ │ OUTREACH │───→│ REPLY │ │
|
|
│ │ Engine │ │ Handler │ │
|
|
│ └──────────┘ └────┬─────┘ │
|
|
│ │ │
|
|
│ ┌────▼─────┐ │
|
|
│ │ DEMO │ │
|
|
│ │ Scheduler│ │
|
|
│ └────┬─────┘ │
|
|
│ │ │
|
|
│ ┌────▼─────┐ │
|
|
│ │ PILOT │ │
|
|
│ │ Deployer │ │
|
|
│ └────┬─────┘ │
|
|
│ │ │
|
|
│ ┌────▼─────┐ │
|
|
│ │ CLOSE │ │
|
|
│ │ + Upsell │ │
|
|
│ └────┬─────┘ │
|
|
│ │ │
|
|
│ ┌──────────┐ ┌────▼─────┐ │
|
|
│ │ REFERRAL│←───│ CASE │ │
|
|
│ │ Engine │ │ STUDY │ │
|
|
│ └────┬─────┘ └──────────┘ │
|
|
│ │ │
|
|
│ └──────→ Back to OUTREACH ───→ 🔄 │
|
|
└─────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Component 1: Outreach Engine (أتوماتيكي)
|
|
|
|
### Daily Automated Outreach
|
|
```
|
|
كل يوم الساعة 9 صباحًا (Asia/Riyadh):
|
|
1. LinkedIn: ارسل 10 connection requests جديدة
|
|
2. WhatsApp: ارسل 5 follow-ups لمن لم يرد
|
|
3. Email: ارسل 5 cold emails جديدة
|
|
```
|
|
|
|
### Target Source Automation
|
|
| المصدر | الطريقة | التكرار |
|
|
|--------|---------|---------|
|
|
| LinkedIn Sales Navigator | بحث بالـ ICP criteria | يومي |
|
|
| Google Maps | بحث "[قطاع] + الرياض" | أسبوعي |
|
|
| غرف التجارة | scrape قوائم الأعضاء | شهري |
|
|
| الإحالات | auto-ask بعد كل pilot ناجح | مع كل نجاح |
|
|
|
|
### Sequence Engine (موجود في الكود)
|
|
الكود الموجود: `backend/app/services/sequence_engine.py`
|
|
|
|
```
|
|
Step 1 (Day 0): WhatsApp opening → wait 24h
|
|
Step 2 (Day 1): LinkedIn connection → wait 48h
|
|
Step 3 (Day 3): Email with case study → wait 72h
|
|
Step 4 (Day 6): WhatsApp follow-up → wait 72h
|
|
Step 5 (Day 9): Final attempt + different angle → end
|
|
```
|
|
|
|
### Response Classification (AI)
|
|
الكود الموجود: `backend/app/services/ai/arabic_nlp.py`
|
|
|
|
| الرد | التصنيف | الإجراء |
|
|
|------|---------|---------|
|
|
| "حابين نعرف أكثر" | HOT | حجز demo فوري |
|
|
| "أرسل معلومات" | WARM | إرسال one-pager + متابعة |
|
|
| "مو مهتمين" | COLD | إيقاف + إعادة بعد 90 يوم |
|
|
| "من أنتم؟" | CURIOUS | إرسال company profile |
|
|
| لا رد | SILENT | تابع بالـ sequence |
|
|
|
|
---
|
|
|
|
## Component 2: Demo Automation
|
|
|
|
### Auto Demo Booking
|
|
الكود الموجود: `backend/app/api/v1/meetings.py`
|
|
|
|
```
|
|
When: Lead classified as HOT
|
|
Action:
|
|
1. Send calendar link (Cal.com)
|
|
2. Auto-confirm via WhatsApp
|
|
3. Send pre-demo brief
|
|
4. Remind 1h before
|
|
```
|
|
|
|
### Pre-Demo Data Prep (AI)
|
|
الكود الموجود: `backend/app/services/company_research.py`
|
|
|
|
```
|
|
Before each demo, auto-generate:
|
|
1. Company profile from public data
|
|
2. Sector-specific pain points
|
|
3. ROI estimate based on company size
|
|
4. Competitive landscape
|
|
5. Recommended demo flow
|
|
```
|
|
|
|
### Demo Environment
|
|
```
|
|
For each prospect:
|
|
1. Create demo tenant
|
|
2. Seed with their sector template
|
|
3. Pre-load 5 sample deals matching their business
|
|
4. Configure Executive Room with relevant KPIs
|
|
5. Generate sample Evidence Pack
|
|
```
|
|
|
|
---
|
|
|
|
## Component 3: Pilot Auto-Deployment
|
|
|
|
### When Prospect Says "Yes to Pilot"
|
|
```
|
|
Automated sequence:
|
|
1. Generate pilot agreement (PDF, Arabic)
|
|
2. Send for e-signature
|
|
3. On signature:
|
|
a. Create production tenant
|
|
b. Send onboarding email
|
|
c. Schedule training call
|
|
d. Create Slack/WhatsApp support channel
|
|
4. Day 1: Auto-import their data
|
|
5. Day 7: Auto-send mid-pilot report
|
|
6. Day 12: Auto-send results + conversion offer
|
|
```
|
|
|
|
---
|
|
|
|
## Component 4: Close + Upsell Automation
|
|
|
|
### Auto-Close Triggers
|
|
```
|
|
When (pilot_day >= 12 AND usage_score > 70%):
|
|
→ Send conversion offer
|
|
→ Include pilot metrics
|
|
→ Include pricing options
|
|
→ Schedule close call
|
|
|
|
When (pilot_day >= 12 AND usage_score < 30%):
|
|
→ Send engagement email
|
|
→ Offer extended pilot
|
|
→ Schedule check-in call
|
|
```
|
|
|
|
### Upsell Triggers
|
|
```
|
|
When (active_users > initial_seats):
|
|
→ Suggest seat expansion
|
|
|
|
When (deals_count > 50):
|
|
→ Suggest Strategic tier
|
|
|
|
When (using_approvals AND wants_evidence_packs):
|
|
→ Suggest Sovereign tier
|
|
|
|
When (monthly_anniversary):
|
|
→ Send ROI report
|
|
→ Include upsell options
|
|
```
|
|
|
|
---
|
|
|
|
## Component 5: Case Study Auto-Generation
|
|
|
|
### After Successful Pilot
|
|
الكود الموجود: `backend/app/services/executive_roi_service.py`
|
|
|
|
```
|
|
Auto-generate case study from:
|
|
1. Before metrics (from pilot setup)
|
|
2. After metrics (from Executive Room snapshot)
|
|
3. Delta calculation (actual improvement)
|
|
4. Client quote (request via WhatsApp)
|
|
5. Format as PDF (Arabic + English)
|
|
```
|
|
|
|
### Case Study Template
|
|
```json
|
|
{
|
|
"client_name": "auto",
|
|
"sector": "auto",
|
|
"challenge": "auto-from-ICP",
|
|
"solution_deployed": ["Revenue OS", "Approval Center", "Executive Room"],
|
|
"metrics": {
|
|
"approval_time_before_hours": "auto",
|
|
"approval_time_after_hours": "auto",
|
|
"improvement_percent": "calculated",
|
|
"deals_visibility_before": "auto",
|
|
"deals_visibility_after": "auto",
|
|
"executive_adoption": "auto"
|
|
},
|
|
"quote_ar": "from-client",
|
|
"generated_at": "auto"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Component 6: Referral Automation
|
|
|
|
### Auto-Referral Request (Day 30 post-conversion)
|
|
```
|
|
WhatsApp:
|
|
"[الاسم]، شهر معنا وإن شاء الله النتائج واضحة 🎉
|
|
|
|
سؤال بسيط: هل تعرف 2-3 شركات ممكن يستفيدون؟
|
|
|
|
لو عرّفتنا عليهم:
|
|
🎁 شهر مجاني عليك
|
|
🎁 خصم 20% للشركة اللي ترشّحها"
|
|
```
|
|
|
|
### Referral Tracking
|
|
```
|
|
For each referral:
|
|
1. Track source (who referred)
|
|
2. Auto-add to outreach queue
|
|
3. Personalize: "مرشح من [اسم العميل]"
|
|
4. If converts: credit referrer
|
|
5. Send referrer notification
|
|
```
|
|
|
|
---
|
|
|
|
## Revenue Funnel Metrics Dashboard
|
|
|
|
### Weekly Dashboard
|
|
```
|
|
PIPELINE:
|
|
Outreach Pool: [===========================] 500
|
|
Contacted: [================== ] 200 (40%)
|
|
Replied: [======== ] 60 (30%)
|
|
Demo Scheduled: [==== ] 20 (33%)
|
|
Demo Completed: [=== ] 15 (75%)
|
|
Pilot Started: [== ] 6 (40%)
|
|
Pilot Active: [== ] 4 (67%)
|
|
Converted to Paid: [= ] 3 (75%)
|
|
|
|
REVENUE:
|
|
MRR: 45,000 SAR
|
|
Pipeline: 150,000 SAR
|
|
|
|
VELOCITY:
|
|
Outreach → Reply: 3 days
|
|
Reply → Demo: 2 days
|
|
Demo → Pilot: 5 days
|
|
Pilot → Paid: 14 days
|
|
Total cycle: 24 days
|
|
```
|
|
|
|
---
|
|
|
|
## Weekly Revenue Operations Cadence
|
|
|
|
| اليوم | النشاط | الوقت |
|
|
|-------|--------|-------|
|
|
| **الأحد** | Review pipeline + plan outreach | 30 min |
|
|
| **الاثنين** | Outreach blitz (30 contacts) | 2 hours |
|
|
| **الثلاثاء** | Demos + follow-ups | 3 hours |
|
|
| **الأربعاء** | Pilot check-ins + close attempts | 2 hours |
|
|
| **الخميس** | Admin: invoices, onboarding, case studies | 2 hours |
|
|
|
|
---
|
|
|
|
## Revenue Targets — 90 Day Ramp
|
|
|
|
| الشهر | العملاء | MRR (SAR) | Pipeline (SAR) |
|
|
|-------|---------|-----------|---------------|
|
|
| **الشهر 1** | 3 pilots | 15K-45K (one-time) | 100K |
|
|
| **الشهر 2** | 3 paid + 5 pilots | 15K-36K MRR | 250K |
|
|
| **الشهر 3** | 8 paid + 5 pilots | 40K-100K MRR | 500K |
|
|
|
|
### يوم الـ 90:
|
|
- **8+ عملاء يدفعون**
|
|
- **100K+ SAR MRR**
|
|
- **3+ case studies**
|
|
- **Revenue engine يشتغل لحاله**
|
|
|
|
---
|
|
|
|
## الأدوات الموجودة في الكود (جاهزة للاستخدام)
|
|
|
|
| الأداة | الملف | الاستخدام |
|
|
|--------|-------|----------|
|
|
| WhatsApp Sender | `openclaw/plugins/whatsapp_plugin.py` | إرسال رسائل أوتوماتيكية |
|
|
| Sequence Engine | `services/sequence_engine.py` | متابعات متعددة القنوات |
|
|
| Arabic NLP | `services/ai/arabic_nlp.py` | تصنيف الردود |
|
|
| Lead Scoring | `ai-agents/prompts/lead-qualification-agent.md` | تأهيل العملاء |
|
|
| Company Research | `services/company_research.py` | بحث الشركات |
|
|
| Proposal Generator | `ai-agents/prompts/proposal-drafting-agent.md` | إنشاء العروض |
|
|
| Executive ROI | `services/executive_roi_service.py` | حساب ROI |
|
|
| Meeting Booking | `api/v1/meetings.py` | حجز الاجتماعات |
|
|
| PDF Generation | WeasyPrint + Arabic RTL | تصدير التقارير |
|
|
| PDPL Consent | `services/pdpl/consent_manager.py` | الامتثال |
|