This project demonstrates how to integrate with Africa's Talking SMS API using Python and Flask. It provides functionality to send SMS messages and receive incoming messages through a webhook.
# SMS AI Learning Platform
## Project Description
This project is a Flask-based application that integrates with Africa's Talking SMS API and Google's Gemini AI to create both an SMS-based and a web-based chat interface. It allows users to interact with an AI assistant via SMS and through a modern web chat interface, storing conversations in a database.
## Features
* **SMS Integration**: Send and receive messages via Africa's Talking SMS API.
* **Web Chat Interface**: A modern, mobile-responsive web interface for chatting with the AI.
* **AI Powered Responses**: Utilizes Google's Gemini AI for generating chat responses.
* **Conversation History**: Stores conversation history in an SQLite database.
* **User and Message Management**: Database models for managing users (based on phone numbers) and messages.
* **Modular Structure**: Application is organized into blueprints, services, and models for better maintainability.
* **Database Migrations**: Uses Flask-Migrate for managing database schema changes.
* **Health Check**: An endpoint (`/health`) to check the application's status.
## Project Structure
```
SMS AI Learning/
├── app/
│ ├── __init__.py # Application factory and configuration
│ │ ├── __init__.py
│ │ └── config.py # Configuration settings
│ ├── models/
│ │ ├── __init__.py
│ │ └── models.py # Database models (User, Message)
│ ├── routes/
│ │ ├── __init__.py
│ │ ├── health_routes.py # Health check blueprint
│ │ ├── sms_routes.py # SMS callback and sending blueprint
│ │ └── web_routes.py # Web chat interface and API blueprint
│ ├── services/
│ │ ├── __init__.py
│ │ ├── ai_service.py # Google Gemini AI integration
│ │ └── sms_service.py # Africa's Talking SMS integration
│ └── templates/
│ └── chat_template.py # HTML template for the web chat interface
├── migrations/ # Flask-Migrate directory
│ ├── versions/ # Migration scri …