Automate WhatsApp or chat replies using Python + AI! This project reads messages, detects specific senders, and generates witty auto-responses using OpenAI — all powered by desktop automation.
- Monitors your screen for new chat messages
- Checks if the last message is from a target sender (like “Tom”)
- Uses OpenAI GPT-3.5 Turbo to generate smart replies
- Replies with context-aware, fun, and slightly sarcastic messages
- Full desktop automation with pyautogui
- Uses screen coordinates to open WhatsApp Web or any chat window
- Selects and copies the most recent message using mouse automation
- Analyzes if the message is from a specific sender (like "Tom")
- If yes, it sends the conversation to OpenAI's chat model
- Copies the AI-generated response and automatically pastes it into the chat window
- Sends the reply. Done. All hands-free. ✨
- Clone or download the repository:
git clone https://github.com/Toshaksha/auto-reply-chatbot.git
cd auto-reply-chatbot
- (Optional) Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the required dependencies:
pip install -r requirements.txt
-
Update your OpenAI API key in
auto_reply_bot.py
(replace"your-api-key"
with your actual key). -
Use
cursor_points.py
to find your screen coordinates and update them inauto_reply_bot.py
. -
Run the chatbot script locally:
python auto_reply_bot.py
⚠️ Note: This script requires desktop GUI automation, so it won’t work in cloud environments like Google Colab.
auto-reply-chatbot/
│
├── auto_reply_bot.py # Main automation + chatbot script
├── cursor_points.py # Utility to get screen coordinates for mouse clicks/drags
├── requirements.txt # Python packages required
├── README.md # Project documentation
└── .gitignore # Git ignore rules
pip install -r requirements.txt
You’ll also need to get your screen coordinates. Use
cursor_points.py
to find your own screen coordinates for clicking and dragging.
Hover your mouse over buttons/text boxes to get coordinates, then plug them into the main script.
- Get your OpenAI API Key
- Replace
"your-api-key"
in the code with your actual key - Adjust coordinates in the script to match your screen layout
- Run the script locally in PyCharm or a Python terminal (Colab won’t work for GUI automation)
Last message detected from: Tom
Chat history copied ✅
Sending chat to OpenAI...
Generated response: Bro, tu coding karta hai ya memes banata hai? 😂
Response sent ✅
- Python 3.x
- OpenAI GPT-3.5 Turbo
- PyAutoGUI (for clicks, drags, and typing)
- Pyperclip (to handle clipboard copy-paste)
- Using OpenAI's chat API for contextual replies
- Automating desktop interactions with
pyautogui
- Reading and parsing chat-like text for decision making
- Designing prompt instructions to control tone and output
- Writing clean, well-documented automation scripts
- This project is for educational and demo purposes only
- Coordinates are device-specific — make sure to adjust them
- Doesn’t work in Google Colab since it requires local GUI control
Toshaksha GitHub Profile
⭐ If you found this cool or helpful, feel free to star the repo and share!