A simple and interactive USSD-powered Bitcoin learning platform built with Flask, Africaβs Talking API, and Gemini AI. Users can dial a USSD shortcode (e.g. *2140#) and access beginner-friendly Bitcoin education through menu options or ask AI questions.
USSD Menu
- What is Bitcoin?
- How Bitcoin Works
- Bitcoin vs Traditional Currencies
- Ask AI Assistant
AI Assistant
Users can ask Bitcoin-related questions, and responses are generated using Gemini Flash 1.5.
Backend Stack
- Python (Flask)
- Africa's Talking USSD API
- Google Gemini AI (gemini-flash-1.5)
- Ngrok for public URL tunneling
- dotenv for private API keys
πProject Structure
sms-bot/
βββ ussd.py
βββ .env
βββ requirements.txt
βββ README.md
Environment Variables
Your .env file should contain:
GOOGLE_API_KEY=your_gemini_key
AT_API_KEY=your_africastalking_api_key
AT_USERNAME=sandbox
SHORTCODE=*2140#
Installation & Setup
1.Create Virtual Environment
python -m venv venv
source venv/Scripts/activate
2.Install Dependencies
pip install -r requirements.txt
3.Run the Backend
python sms.py
- Expose with Ngrok
ngrok http 5000
Copy the generated public URL (e.g., https://abcd.ngrok-free.app).
Configure Africa's Talking Sandbox
USSD Callback URLs
In Africaβs Talking Dashboard β Simulator β Settings:
Type URL USSD Callback URL https://your-ngrok-url.ngrok-free.app/ussd
Testing the USSD App Using Africaβs Talking Simulator
Open the simulator: https://simulator.africastalking.com
Enter Kenyan phone number (e.g., 0700000000)
Enter your shortcode:
*2140#
Navigate the menu.