Skip to content

leoui/gemini-whatsapp-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Gemini WhatsApp Bot v3

A full-featured WhatsApp AI assistant powered by Google Gemini for complex tasks, Groq (Llama 3.3 70B) for fast simple conversations, and Claude AI for investment analysis. Supports stock analysis, image generation, file creation, reminders, scheduling, Google Maps, and more.

Run headless on a VPS or manage via the Bot Manager macOS desktop app.

Made with β˜• by Lewi Verdatama


✨ Features

🧠 Smart AI Routing

  • Simple chat (greetings, Q&A, chitchat) β†’ Groq Llama 3.3 70B (free, fast, ~14,400 req/day)
  • Complex tasks (files, images, maps, analysis, reminders) β†’ Google Gemini 2.5 Flash
  • Automatic fallback: if Groq is unavailable, everything goes to Gemini seamlessly

πŸ–ΌοΈ Image Generation (Multi-Provider Waterfall)

  • Primary: Pollinations AI β€” free, no rate limits with API key Models: flux, flux-2-dev, imagen-4, seedream
  • Fallback: Google Imagen 3 β€” free tier with Gemini API key rotation

πŸ“„ File Creation

Generate and send files directly in WhatsApp:

  • πŸ“Š Excel spreadsheets (.xlsx)
  • πŸ“„ PDF documents
  • πŸ“½οΈ PowerPoint presentations (.pptx)
  • πŸ“ CSV, TXT, HTML, JSON, and code files

⏰ Reminders & Scheduling

  • Natural language scheduling: "Remind me at 7 AM to take medicine"
  • Supports relative time: "in 30 minutes", "tomorrow 9 AM"
  • Timezone-aware (configurable, defaults to Asia/Jakarta)

πŸ“¨ Proactive Messaging

  • Send messages to other contacts: "Send +Novita good morning"
  • Contact resolution: saved shortcodes β†’ contact names β†’ phone numbers

πŸ—ΊοΈ Google Maps & Calendar

  • Location search and Google Maps link sharing
  • Google Calendar event creation from natural language

πŸ“Ž File Analysis

  • Analyze images, PDFs, and documents sent by users
  • Extract text, summarize content, answer questions about files

πŸ”— WhatsApp Connection

  • QR Code scanning (primary) β€” scannable directly in the Bot Manager app
  • Phone number pairing code (automatic fallback after 3 QR failures)
  • Auto-reconnect with exponential backoff

🎭 Human-Like Behavior

  • Simulated read delays and typing indicators
  • Configurable typing speed (WPM) and response timing

πŸ“Š Investment Manager

  • /gm analyze AAPL β†’ Gemini-powered stock analysis (free)
  • /cl analyze BBRI.JK β†’ Claude-powered stock analysis (paid, shows credit used)
  • Fundamental data via FMP API β€” P/E, P/B, ROE, margins, D/E, FCF, EPS, beta
  • Technical analysis via Yahoo Finance β€” RSI, SMA20/50, support/resistance levels
  • πŸ•΅οΈ Bandarmology β€” Volume-based smart money tracking:
    • OBV trend (accumulation vs distribution)
    • Whale activity detection (πŸ‹ >2x avg volume)
    • Smart money signals (🟒 ACC, πŸ”΄ DIST, πŸ•΅οΈ STEALTH, πŸ’€ DRY-UP)
    • 7-day Bandar Score (net acc/dist)
  • Scalping specialization β€” entry zones, momentum, volume profile
  • Trading plans β€” entry, stop-loss, TP1, TP2, position sizing
  • Buy/Hold/Sell signals with confidence percentage
  • πŸ’³ Claude credit tracking β€” shows cost per analysis + remaining balance
  • US stocks + IDX stocks (BBRI.JK, BBCA.JK, TLKM.JK...)

πŸ–₯️ Bot Manager β€” macOS Desktop App (v1.3.0)

A polished Electron app for managing the bot remotely via SSH β€” no terminal required.

Panels

Panel What it does
VPS Connection Configure SSH credentials, test connection, restart bot
Bot Persona Edit character prompt, bot name, timezone
API Keys Manage Gemini / Groq / Pollinations keys
Saved Contacts Add/remove contact shortcuts
Bot Keywords Group trigger word, auto-reply toggle
Human Behavior Typing speed, read delay, burst pause
Group Behavior Mention-only mode, allowed/blocked group JIDs
πŸ“± WhatsApp Number Change linked number + in-app QR scanner
Backup VPS backup, download to Mac (dir picker), Google Drive upload
Import Settings Import from VPS or XML file; export to XML
Live Logs Real-time journal tail
Bot Status Visual health dashboard

Changelog

v1.3.0 (2026-03-10)

  • πŸ“Š Investment Manager: /cl and /gm prefix commands for AI-powered stock analysis
  • πŸ•΅οΈ Bandarmology: Volume-based smart money tracking (OBV, whale, Bandar Score)
  • πŸ’³ Claude credit tracking: Shows cost per analysis + remaining balance
  • 🧠 Anthropic API Key: New field in API Keys panel for Claude /cl analysis
  • πŸ“ˆ FMP API Key: New field for Financial Modeling Prep fundamentals
  • Yahoo Finance chart API (no crumb, works from EU VPS)
  • Scalping analysis, trading plans, buy/hold/sell signals

v1.2.7 (2026-03-09)

  • πŸ’Ύ Local persistence: All settings auto-saved and restored on app restart
  • πŸ–ΌοΈ Image generation fix: [IMAGE_GEN:] tag handler
  • πŸ‘₯ Group filter fix: Trigger word must be at start of message

v1.2.1 (2026-03-09)

  • πŸ› Fix: Startup crash SyntaxError: Identifier 'fs' has already been declared
  • πŸ“± WhatsApp Number panel: Change linked account without SSH
  • πŸ“· In-app QR scanner: QR renders directly in app with auto-refresh

v1.2.0 (2026-03-09)

  • πŸ”’ Settings survive upgrades: Mirrored to ~/.bot-manager-settings.json outside the app sandbox; auto-restored on next launch after reinstall
  • πŸ’Ύ Download backup to Mac: SFTP download with native directory picker, saves chosen path for future use
  • πŸ“„ XML export/import: Export all settings (VPS creds, API keys, persona, contacts, behavior, Google Drive creds) to .xml; import from file to restore without needing VPS access
  • πŸ—‚οΈ Import tabs: "Import from VPS" | "Import from File" tab UI

v1.1.0 (2026-03-09)

  • πŸ“Š Visual Bot Status dashboard: Hero status card with pulsing dot, 6 metric cards, animated RAM progress bar, color-coded log tail
  • ☁️ Google Drive backup: Full OAuth2 flow, folder name/ID resolution, SFTP β†’ Drive pipeline
  • πŸ› Fix: SyntaxError when saving personas with special characters β€” fixed with Base64 encoding
  • daemon-reload warning filtered from log tail

v1.0.0

  • Initial release

Download

Platform File
Apple Silicon (M1–M4) Bot Manager-1.3.0-arm64.dmg
Intel Mac Bot Manager-1.3.0-x64.dmg

Upgrading from v1.1.x? Your settings now auto-restore. As a safeguard, use Import β†’ Export Settings as XML before upgrading to keep a local backup.


πŸ—οΈ Architecture

Incoming Message
      β”‚
      β”œβ”€ /cl or /gm prefix? ───────────────────────────────► InvestorService
      β”‚       /cl β†’ Claude AI analysis                        (Yahoo Finance data)
      β”‚       /gm β†’ Gemini analysis
      β”‚
      β”œβ”€ Has media (image/PDF/file)?  ──────────────────────► Gemini (multimodal)
      β”‚
      β”œβ”€ Complex intent keyword detected? ─────────────────► Gemini
      β”‚
      └─ Short/simple text? ───────────────────────────────► Groq (Llama 3.3 70B)
                                                                   β”‚
                                                     Groq fails? β”€β”€β”˜
                                                                   └──► Gemini

πŸš€ Installation

See INSTALL.md for full setup instructions.

Prerequisites

Quick Start

git clone https://github.com/leoui/gemini-whatsapp-bot.git
cd gemini-whatsapp-bot
npm install
cp .env.example .env
nano .env       # Add your API keys
node server.js  # QR code appears in terminal

βš™οΈ Configuration

Variable Required Description
GEMINI_API_KEY βœ… Comma-separated keys for rotation
GROQ_API_KEY Optional Free simple-chat routing
POLLINATIONS_API_KEY Optional Image generation
CLAUDE_API_KEY Optional /cl investment analysis (Claude AI)
FMP_API_KEY Optional Stock fundamentals (P/E, ROE, margins)
WHATSAPP_PHONE_NUMBER Optional Pairing code fallback
TZ Optional Timezone (default: Asia/Jakarta)
GEMINI_API_KEY=key1,key2,key3   # Each free key β‰ˆ 500 req/day

πŸ“± WhatsApp Connection

Via Bot Manager App (easiest)

  1. Open Bot Manager β†’ WhatsApp Number
  2. Click Change WhatsApp Number
  3. Scan QR code that appears directly in the app

Via Terminal

Run node server.js β†’ scan QR in terminal with WhatsApp β†’ Linked Devices β†’ Link a Device.


πŸ—£οΈ Usage Examples

Request AI Result
"Hello!" Groq Greeting reply
"Create an Excel of top 10 countries" Gemini .xlsx sent
"Generate image of a sunset" Gemini Image sent
"Remind me at 7 AM to exercise" Gemini Reminder set
"Where is the Eiffel Tower?" Gemini Maps link
/gm analyze AAPL Gemini Stock analysis + trading plan
/cl analyze BBRI.JK Claude IDX stock analysis + scalping plan
/gm is NVDA undervalued? Gemini Valuation assessment

πŸ“¦ Tech Stack

Component Library
WhatsApp Baileys ^6.7.17
Gemini AI @google/genai ^0.9.0
Claude AI Anthropic API (/v1/messages)
Groq AI groq-sdk ^0.9.0
Stock Data Yahoo Finance chart API + FMP API
Desktop App Electron 33 + Electron Builder
Excel exceljs Β· PDF: pdfkit Β· PPTX: pptxgenjs

πŸ“„ License

MIT License β€” see LICENSE.

⚠️ Disclaimer

Not affiliated with WhatsApp or Meta. Use responsibly per WhatsApp's Terms of Service.

About

πŸ€– WhatsApp AI assistant powered by Google Gemini β€” image generation, file creation, reminders, scheduling, and more. Runs headless on VPS or as a desktop app.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors