HeySalad ® Pay Zambia SMS Solution
# YNAB SMS Ingestion (Supabase Edge + Gemini AI)
Automatically captures transaction SMS messages from Zambian banks and mobile money services, then imports them into YNAB (You Need A Budget).
**Powered by Google Gemini AI** for intelligent SMS parsing — no brittle regex rules!
## How it works
1. **iOS Shortcut** triggers when you receive **any SMS**.
2. The Shortcut sends the SMS to your **Supabase Edge Function**.
3. **Gemini AI** analyzes the message to determine if it's a real transaction.
4. If it is, the function extracts amount, direction, payee, and category.
5. The transaction is **posted to YNAB** for your review.
> **Why process ALL messages?** Zambian banks use different currency formats—`ZMW`, `K`, `Kwacha`—so filtering by "ZMW" would miss some transactions. The AI handles filtering, so it's safe to send everything.
## Why AI?
Traditional regex-based parsing has problems:
- ❌ Too strict → misses valid transactions with unusual formats
- ❌ Too loose → imports spam/promos that mention amounts ("WIN ZMW 5,000!")
- ❌ Breaks when banks change message formats
Gemini AI understands **context**:
- ✅ Knows "WIN ZMW 5,000!" is a promo, not a transaction
- ✅ Handles casual mentions of money in conversations
- ✅ Adapts to new message formats automatically
- ✅ Extracts payee names and suggests categories
- ✅ Understands all currency formats: `ZMW`, `K`, `Kwacha`
## Features
- 🤖 **AI-powered parsing** — Gemini understands context, not just patterns
- 💰 **Smart amount extraction** — Gets transaction amount, not balance
- ↔️ **Direction detection** — Knows inflow vs outflow from context
- 👤 **Smart payee matching** — Matches existing YNAB payees only (never creates new ones)
- 🏷️ **Smart category matching** — Matches against your actual YNAB categories
- 📝 **Clean memos** — AI generates detailed, organized memos
- 🏦 **Multi-account routing** — Routes by SMS sender or account ending
- 🔄 **Deduplication** — Same SMS won't create duplicate transactions
- ✋ **Ma …