A Telegram bot that tracks Amazon product prices and notifies users when prices change. Built with Python, FastAPI, Aiogram, and MongoDB.
- Track Products: Send an Amazon product link to the bot to start tracking.
- Real-time Data: Fetches product details (price, title, rating, image) using RapidAPI.
- Automatic Monitoring: Checks prices every 30 minutes in the background.
- Smart Notifications: Sends alerts only when the price drops or increases.
- Manage List: View all tracked products and delete items you no longer want to watch.
- Multi-user Support: Handles multiple users and their individual tracking lists.
- Language: Python 3.9+
- Bot Framework: Aiogram 3.x
- Backend API: FastAPI
- Database: MongoDB (using Motor for async driver)
- HTTP Client: HTTPX
- External API: Real-Time Amazon Data API (via RapidAPI)
Before running the project, ensure you have:
- Python 3.9 or higher installed.
- A MongoDB database (local or cloud like MongoDB Atlas).
- A Telegram Bot Token from @BotFather.
- A RapidAPI Key for the Real-Time Amazon Data API.
-
Clone the repository:
git clone https://github.com/yourusername/amazon-price-tracker.git cd amazon-price-tracker -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install fastapi uvicorn aiogram motor httpx python-dotenv
-
Configuration:
Create a
.envfile in the root directory and add the following variables:# Telegram Bot BOT_TOKEN=your_telegram_bot_token # MongoDB MONGO_DB=mongodb://localhost:27017 DB_NAME=AmazonTracker # RapidAPI (Amazon Data) AMAZON_KEY=your_rapidapi_key AMAZON_URL=https://real-time-amazon-data.p.rapidapi.com/product-details # API Configuration API_URL=http://127.0.0.1:8000
You need to run the API backend and the Telegram bot separately.
-
Start the API Server:
uvicorn api.main:app --reload
-
Start the Telegram Bot:
python bot/bot.py