Skip to content

Auto-reply chatbot for WhatsApp using Python, OpenAI GPT-3.5, and PyAutoGUI. Reads messages and sends smart, automated replies.

License

Notifications You must be signed in to change notification settings

Toshaksha/auto-reply-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Auto-Reply Chatbot using OpenAI & PyAutoGUI

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.


🚀 Features

  • 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

🧠 How It Works

  1. Uses screen coordinates to open WhatsApp Web or any chat window
  2. Selects and copies the most recent message using mouse automation
  3. Analyzes if the message is from a specific sender (like "Tom")
  4. If yes, it sends the conversation to OpenAI's chat model
  5. Copies the AI-generated response and automatically pastes it into the chat window
  6. Sends the reply. Done. All hands-free. ✨

🚀 How to Run

  1. Clone or download the repository:
git clone https://github.com/Toshaksha/auto-reply-chatbot.git
cd auto-reply-chatbot
  1. (Optional) Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate      # On Windows: venv\Scripts\activate
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Update your OpenAI API key in auto_reply_bot.py (replace "your-api-key" with your actual key).

  2. Use cursor_points.py to find your screen coordinates and update them in auto_reply_bot.py.

  3. 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.


🗂 Project Structure

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

🔧 Requirements

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.


🔐 Setup

  1. Get your OpenAI API Key
  2. Replace "your-api-key" in the code with your actual key
  3. Adjust coordinates in the script to match your screen layout
  4. Run the script locally in PyCharm or a Python terminal (Colab won’t work for GUI automation)

📌 Example Behavior

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 ✅

⚙️ Tech Stack

  • Python 3.x
  • OpenAI GPT-3.5 Turbo
  • PyAutoGUI (for clicks, drags, and typing)
  • Pyperclip (to handle clipboard copy-paste)

🧠 Project Insights

  • 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

💡 Notes

  • 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

👤 Author

Toshaksha GitHub Profile


If you found this cool or helpful, feel free to star the repo and share!


About

Auto-reply chatbot for WhatsApp using Python, OpenAI GPT-3.5, and PyAutoGUI. Reads messages and sends smart, automated replies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages