Skip to content

SametCirik/WhatsApp-KYK-Bot

Repository files navigation

English   |   Türkçe


KYK Food Menu Bot - WhatsApp Automation

This is a robust desktop & server-side application developed using Java (Swing + Selenium) to manage weekly food menus for KYK (Credit and Dormitories Institution) and automatically distribute them via WhatsApp.

This project features a modern GUI for data entry, a CLI mode for server environments, and smart automation capabilities using Selenium WebDriver.


Features

Core Features

  • Menu Management: Enter, edit, and save daily menus (Breakfast & Dinner) via a user-friendly Java Swing interface.
  • Smart CSV Integration: Support for Drag & Drop to load menus from .csv files instantly.
  • WhatsApp Automation: Connects to WhatsApp Web, bypasses QR scanning (via session persistence), and sends formatted messages with emojis.
  • Schedule & Timer: Schedule messages to be sent at a specific date and time, or send them instantly.

New in v2.0

  • Server Edition (CLI Mode): A fully functional Command Line Interface (KykBotTerminal.bat) for running the bot on headless servers or via terminal.
  • Smart Navigation: Navigate through menu input fields using Arrow Keys (Up/Down) for faster data entry.
  • Robust Media Handling: Fixed issues with loading application icons and logos from JAR files.
  • Emoji Support: Improved message formatting with emoji support using System Clipboard integration (bypassing Selenium BMP errors).

Environment & Prerequisites

Before running the project, ensure you have the following installed:

  • Java JDK 21+: Required to run the application.
  • Google Chrome: The bot uses the installed Chrome browser for automation.
  • Maven: Used for dependency management (Selenium, FlatLaf, etc.) and building the project.

Installation & Setup

1. Clone the Repository

git clone https://github.com/SametCirik/WhatsApp-KYK-Bot.git
cd WhatsApp-KYK-Bot

2. Install Dependencies (Selenium & Others)

This project uses Maven. You don't need to download JARs manually. Simply run the following command in the project root to download all libraries (Selenium, etc.) defined in pom.xml:

mvn clean install

3. Build the JAR

To create an executable JAR file with all dependencies included:

mvn clean package

The output file will be located in the /target folder.


Usage

A. GUI Mode (Desktop)

Run the JAR file directly or use the command below. This opens the visual interface where you can enter menus or drag-and-drop your CSV file.

java -jar target/Whatsapp-KYK-Bot.jar
  1. Enter Menu: Fill in the breakfast and dinner fields (Use Arrow Keys to navigate!).

  2. Save/Load: Drag a .csv file into the designated area or save your manual entry.

  3. Start Bot: Click the "Botu Başlat" button to open the WhatsApp Scheduler.

B. CLI Mode (Server/Terminal)

For server environments where a GUI is not available or desired, use the provided batch script.

  1. Navigate to the project folder.

  2. Run KykBotTerminal.bat.

  3. Enter the target WhatsApp Group Name when prompted.

  4. The bot will run in the background and send today's menu.


Troubleshooting & FAQ

How do I update the WebDriver?

This project uses Selenium 4.x, which includes "Selenium Manager". It automatically detects your installed Chrome version and downloads the matching ChromeDriver.

  • Solution: Just keep your Google Chrome browser updated. Selenium handles the rest.

"AppLogo.png not found" Error

Ensure you are running the JAR file generated by mvn package. The resource loading logic checks both /bot/images/ and the root directory to find assets inside the JAR.

WhatsApp Web QR Code

The bot uses a localized ChromeProfile folder to save your login session.

  1. On the first run, you will need to scan the QR code.

  2. On subsequent runs, the session is restored automatically (no scan needed).

Note: Ensure all Chrome windows are closed before running the bot to avoid profile lock errors.


Contributing

As this is a personal project, external contributions are currently closed. However, feel free to fork the repository and experiment with the code.


AppLogo

Application Icon


Application Preview

image image image image image image

2025-10-11-06-21-05.mp4


Developer (-s)

This project was developed by Samet Cırık.