An intelligent Python bot that monitors WhatsApp Desktop and automatically sends contextual replies to any message using Google's Gemini AI.
- Smart Detection: Uses Gemini Vision AI to understand any message type
- Contextual Replies: Generates intelligent, relevant responses
- Spam Prevention: Built-in rate limiting and cooldown system
- Customizable Personality: Make the bot witty, helpful, sarcastic, or professional
- Full Window Capture: Automatically detects messages from entire WhatsApp window
-
Install Python dependencies:
pip install -r requirements.txt
-
Get a Google Gemini API key:
- Visit Google AI Studio
- Create an API key
-
Create a
.envfile in the project root:cp .env.example .env
Then edit
.envand add your API key:GOOGLE_API_KEY=your_actual_api_key_here
-
Run the bot:
python smart_bot.py
Run the setup checker to ensure everything is configured:
python check_setup.pyThis will verify:
- All dependencies are installed
.envfile has valid API key- WhatsApp Desktop is running
- Gemini API connection works
python smart_bot.pyThe bot will automatically:
- Capture the full WhatsApp window
- Detect new messages using AI
- Generate and send intelligent replies
- Track message history to avoid spam
Edit smart_bot.py to customize response style:
BOT_PERSONALITY = """
You are a witty, sarcastic friend.
Keep responses under 15 words.
"""REPLY_COOLDOWN = 300 # Wait 5 min before replying to same message
SCAN_INTERVAL = 20 # Check every 20 seconds
MAX_REPLIES_PER_HOUR = 10 # Prevent spamFor more customization options, edit the BOT_PERSONALITY, REPLY_COOLDOWN, SCAN_INTERVAL, and other settings in smart_bot.py.
- Works only on WhatsApp Desktop (Windows)
- Requires active WhatsApp window
- Uses Google Gemini API (free tier available)
- Be mindful of rate limits to avoid spam detection
- Test in private chats first before using in groups
- Keep
DEBUG_MODE = Trueinitially to verify bot behavior (screenshots saved indebug/folder) - Start with conservative rate limits (default: 10 replies/hour)
- Test in private chats before using in groups
- Monitor API quota usage (free tier: ~20 requests/day for gemini-2.5-flash)
- Adjust
SCAN_INTERVALbased on your needs (default: 20 seconds)