Skip to content

Leixien/TrackerPriceAmazon-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TrackerPriceAmazon-Bot

A simple Amazon price tracking bot written in Python by Leixien

Description of the Code

Brief description of the code

This Telegram Bot checks the price of a given Amazon Product.

  • You can save the product and check the price when you want with a single tap.
  • You can check the prices of different amazon store states by sending the link of the product itself
  • NEW! πŸ”— Automatic Amazon affiliate link conversion
  • NEW! πŸ“Š Track your conversion statistics
  • NEW! πŸ”” Daily reminders at 11:00 and 16:00 (Italy time)
  • NEW! πŸ€– AI-powered product advisor (Ollama local AI)
  • NEW! πŸ—„οΈ Optional Supabase database for analytics
  • Join my discord :)
  • Find a new song (try it <3 )

The modules I used are:

Bot Code

I created 3 files to make the code clear and readable!

In the files You will find:

πŸ”— Affiliate Link Conversion Features

Automatic Conversion

Simply send any Amazon.it link to the bot and it will automatically reply with the affiliate version!

Supported formats:

  • https://www.amazon.it/dp/B08N5WRWNW/
  • https://www.amazon.it/product-name/dp/B08N5WRWNW/
  • https://amazon.it/gp/product/B08N5WRWNW
  • https://amzn.eu/d/XXXXX (short links)

Commands

/convertlink <url>

Manually convert an Amazon link to affiliate link.

Example:

/convertlink https://www.amazon.it/dp/B08N5WRWNW/

/stats

View your conversion statistics (today and total).

/stop

Disable daily reminders.

/start

Re-enable daily reminders.

Daily Reminders

The bot sends automatic reminders at 11:00 and 16:00 (Italy time) to all subscribed users!

πŸ€– AI Product Advisor

Features

The bot includes an intelligent AI assistant powered by Ollama (local AI on Raspberry Pi):

  • πŸ’‘ Smart product recommendations based on your requests
  • πŸ” Product comparisons (e.g., "iPhone 15 vs Samsung S24")
  • πŸ’° Budget-based suggestions (e.g., "laptop gaming under 1000€")
  • 🎯 Personalized advice tailored to your needs
  • πŸ”’ 100% FREE - runs locally on Raspberry Pi, no API costs!

How it Works

Simply ask the bot for product advice in natural language:

Examples:

"Mi consigli un laptop per gaming sotto 1000€?"
"Quale Γ¨ il miglior smartphone con fotocamera?"
"Confronta iPhone 15 vs Samsung S24"
"Ho bisogno di cuffie wireless per correre"
"Cerco una friggitrice ad aria buona"

The bot will:

  1. 🧠 Analyze your request with AI
  2. πŸ’‘ Generate personalized recommendations
  3. πŸ”— Provide affiliate Amazon links automatically

/aihelp

Show detailed AI assistant help and examples.

Setup AI (Raspberry Pi)

The AI runs locally on Raspberry Pi using Ollama (free, open-source).

Quick Start

# On Raspberry Pi
chmod +x scripts/setup_raspberry_ollama.sh
./scripts/setup_raspberry_ollama.sh

The script will:

  • βœ… Install Ollama
  • βœ… Download AI model (Mistral 7B / LLaMA 3.2)
  • βœ… Configure the service
  • βœ… Test the installation

Full guide: See docs/SETUP_AI.md

Requirements

  • Raspberry Pi 4/5 with 4GB RAM (for Mistral 7B)
  • Raspberry Pi 4 with 2GB RAM (for LLaMA 3.2 3B)
  • Raspberry Pi 3 with 2GB RAM (for LLaMA 3.2 1B)
  • Raspberry Pi OS (64-bit)

AI Disabled by Default?

No problem! The bot works perfectly even without AI. Simply set in .env:

AI_ENABLED=false

Installation & Setup

1. Install dependencies

pip install -r requirements.txt

2. Configure environment

Create a .env file from the template:

cp .env.example .env

Edit .env and add your bot token:

BOT_TOKEN=your_telegram_bot_token_here

3. Configure affiliate tag

Edit config.py and set your Amazon affiliate tag:

AFFILIATE_TAG = "your-tag-21"

4. Run the bot

python main.py

Project Structure

TrackerPriceAmazon-Bot/
β”œβ”€β”€ main.py                      # Main bot with command handlers
β”œβ”€β”€ scraper.py                   # Amazon scraper for prices
β”œβ”€β”€ myFunctions.py               # Utility functions
β”œβ”€β”€ config.py                    # Configuration (affiliate tag, timezones, AI, etc.)
β”‚
β”œβ”€β”€ handlers/
β”‚   β”œβ”€β”€ amazon_affiliate.py      # Affiliate link conversion logic
β”‚   └── ai_assistant.py          # AI product advisor (NEW)
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ user_manager.py          # User tracking for reminders
β”‚   β”œβ”€β”€ scheduler.py             # Daily reminder scheduler
β”‚   β”œβ”€β”€ ollama_client.py         # Ollama AI client (NEW)
β”‚   └── supabase_manager.py      # Supabase database (NEW, optional)
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ users.json               # User database for broadcast
β”‚   └── stats.json               # Conversion statistics
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ SETUP_AI.md              # AI setup guide (NEW)
β”‚   └── SETUP_SUPABASE.md        # Supabase setup guide (NEW)
β”‚
└── scripts/
    └── setup_raspberry_ollama.sh  # Ollama auto-install script (NEW)

Next Upgrade

I will try to add some new features every month to make this bot useful Some features I will improve in the next month:

  • βœ… Schedulable Messages for price alert (DONE - Daily reminders implemented!)
  • βœ… AI-powered product recommendations (DONE - Ollama AI integrated!)
  • Amazon Product API integration for real product search
  • A graphic with the price of the product
  • Inline mode for SuperGroups
  • Price drop notifications
  • Multi-language support (EN/IT/ES)

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •