How sanafagal/whatsapp-sender works
Project type and purpose
• Desktop automation tool built in Python, with a Tkinter GUI, that uses PyAutoGUI to automate WhatsApp Web for bulk messaging.
• Key layers: User Interface, Service/Business Logic, Utilities, External Systems (Browser and WhatsApp Web).
File structure
Top-level src/ folders:
• components/ – reusable GUI widgets (app_window.py, ui_components.py)
• config/ – constants (timing, styles)
• services/ – JSON loader (json_service.py) and core messaging orchestration (message_service.py)
• ui/ – high-level UI panels (settings_panel, vendor_panel) and subcomponents (delay_config, log_manager)
• utils/ – low-level helpers (browser_utils.py to launch browsers, json_handler.py, sound_utils.py, time_utils.py)
• app.py – entry point that initializes the UI and wires all modules
README for additional insights
• Reads JSON data → vendor queues → config delays → selects browser → clicks “send” → logs progress.
• Technologies: Python, Tkinter, PyAutoGUI, JSON, browser-based WhatsApp Web.
Main components & interactions
a. Components
1. GUI Layer
– AppWindow & UI Components (buttons, panels, logs)
– SettingsPanel, VendorPanel
2. Configuration
– constants.py (DEFAULT_DELAYS)
– styles.py (UI theming)
3. JSON Service
– json_service loads/parses file via json_handler
4. Message Service
– Orchestratesreading data + delays + PyAutoGUI actions
5. Utility Layer
– BrowserUtils: launches Edge/Brave/Default
– TimeUtils: computes and enforces delays
– SoundUtils: play success/error beeps
6. External Systems
– Local browser executable
– WhatsApp Web endpoint
b. Interactions (Data-flow)
1. User clicks “Browse & Load” → GUI calls JSON Service → JSON Service uses JSON Handler → returns list of message records
2. User configures delays in SettingsPanel (reads/writes to constants)
3. User selects Vendor → GUI invokes Message Service with selected subset
4. Message Service:
• Calls BrowserUtils to open browser to WhatsApp Web
• Loops messages: uses PyAutoGUI to enter phone+text, send, then TimeUtils delays
• Uses SoundUtils to signal success/failure
• Sends status updates/events back to UI via LogManager
5. GUI LogManager displays progress in real time
c. Architectural patterns & principles
• Layered Architecture (Presentation → Business Logic → Utilities → External)
• Separation of concerns: UI vs services vs utilities vs config
• Single-responsibility per module (e.g., json_service vs message_service)
d. Key technologies
• Python 3.x
• Tkinter for UI
• PyAutoGUI for automation
• JSON for data transport
• Native browser executables
Don’t over-complicate
[User Interface (Tkinter)]──calls──> [JSON Service]──uses──> [JSON Handler (util)]
│
└──invokes──> [Message Service]
│
├──calls──> [BrowserUtils]──launches──> [Browser Executable]──connects──> [WhatsApp Web]
├──calls──> [TimeUtils] (delay logic)
├──calls──> [SoundUtils] (feedback)
└──emits logs──> [LogManager]──renders──> [User Interface]