How sarthak-genai-33/whatsapp-education-bot works
Project Type & Purpose
• This is a single-service backend application (no separate frontend) implemented in Python using Flask.
• It functions as a WhatsApp messaging bot for the education domain, handling incoming webhooks from Twilio’s WhatsApp API and dispatching context-aware replies across seven major educational use cases.
File Structure Analysis
Top‐level files only—no nested “src” or “services” directories. All core logic lives in:
• app.py – Flask app, webhook endpoint (/whatsapp)
• requirements.txt – Twilio SDK, Flask, Gunicorn dependencies
• Procfile, runtime.txt, railway.toml – Deployment configuration for Heroku/Railway
• README.md – Project description, usage, and flow examples
Key Architecture Insights from README
• Webhook-driven: Twilio forwards incoming WhatsApp messages to your Flask endpoint.
• In-memory data structures (sessions, menus) today, with plans for an external database.
• Hosted behind Gunicorn and a PaaS (Heroku, Railway).
• Local dev uses ngrok to expose a secure tunnel for Twilio.
1. WhatsApp User (Mobile App)
2. Twilio WhatsApp API (Cloud Service)
3. Flask Web Server
• Webhook Controller (/whatsapp endpoint)
• Message Processing Module (parsing “Body”, routing to feature handlers)
• Feature Handlers (Student Support, Admissions, Exams, Fees, etc.)
4. In-Memory Data Store (Session state, menu definitions)
5. Optional Future Components (PostgreSQL/MySQL/MongoDB, Admin Dashboard)
6. Deployment Environment
• Gunicorn WSGI server
• PaaS (Heroku/Railway)
7. Developer Tools (ngrok for local tunneling)
Architectural Patterns & Principles
• Event-driven webhook architecture.
• Modular handlers per feature domain.
• Dependency inversion for data store (in-memory today, swappable with real DB).
• Stateless web tier behind a WSGI server (Gunicorn).
• Clear separation of external services vs. internal logic.