# FB Autopilot — Zero-Touch Hausa Social Media System Fully automated pipeline: discovers trends → drafts a Hausa post → sources/generates an image → scores confidence → either auto-publishes to Facebook OR pauses and asks for your approval on WhatsApp → publishes on your "YES" reply. Runs on a free GitHub Actions cron — no server needed.
# FB Autopilot — Zero-Touch Hausa Social Media System
Fully automated pipeline: discovers trends → drafts a Hausa post → sources/generates an image →
scores confidence → either auto-publishes to Facebook OR pauses and asks for your approval on
WhatsApp → publishes on your "YES" reply. Runs on a free GitHub Actions cron — no server needed.
---
## 1. Logic Diagram
```
┌────────────────────────────┐
│ GitHub Actions Cron │
│ (runs main.py 2x/day) │
└──────────────┬─────────────┘
│
▼
┌────────────────────────────┐
│ 1. trend_discovery.py │
│ - NewsAPI.org (free tier) │
│ - Google News RSS (NG+world)│
│ - Reddit r/Nigeria (free) │
│ → ranked list of topics │
└──────────────┬─────────────┘
▼
┌────────────────────────────┐
│ 2. content_generator.py │
│ - Gemini 1.5 Flash (free) │
│ - Grounding prompt: only │
│ use supplied source text │
│ (anti-hallucination) │
│ - Outputs: Hausa post, │
│ confidence_score (0-100),│
│ sensitivity_flag (bool) │
└──────────────┬─────────────┘
▼
┌────────────────────────────┐
│ 3. media_handler.py │
│ - Pollinations.ai (free, │
│ no key, image-from-text) │
│ - Fallback: Unsplash API │
│ (free tier, real photo) │
└──────────────┬─────────────┘
▼
┌────────────────────────────┐
│ 4. guardrail.py │
│ decide: AUTO vs REVIEW │
└──────┬───────────────┬─────┘
AUTO │ │ REVIEW
▼ ▼
┌────────────────────┐ ┌──────────────────────────┐
│ facebook_publisher │ │ whatsapp_notifier.py │
│ → Graph API POST │ │ → CallMeBot/Twilio │
│ → DONE │ │ sends draft+image link │
└────────────────────┘ │ → saves pending job to │
│ state/pending.json │
│ → waits for your reply │
└─────────────┬─────────────┘
▼
┌──────────────────────────┐
│ approval_listener.py │
│ (Flask webhook on Render │
│ free tier, always-on) │
│ - Twilio inbound webhook │
│ - "YES" → publish │
│ - " …