WahGPT is a WhatsApp chatbot built using the @whiskeysockets/baileys
library, allowing users to interact with an intelligent chatbot powered by GPT (ChatGPT4). This README provides a comprehensive explanation of the code structure and functionality.
- WhatsApp Integration: Utilizes
@whiskeysockets/baileys
to connect to the WhatsApp Web platform, enabling the bot to send and receive messages. - GPT Integration: Communicates with the ChatGPT API to generate responses based on user input.
- Node.js and npm installed on your machine.
- WhatsApp account and a phone with an active internet connection.
-
Clone the repository:
git clone https://github.com/well300/WahGPT.git
-
Navigate to the project directory:
cd WahGPT
-
Install dependencies:
npm install
-
Run the application:
npm start
-
Scan the QR code displayed with your WhatsApp Web to authenticate.
The script initializes the WhatsApp client and sets up event listeners for authentication, QR code display, and readiness.
It manages authentication state using the useMultiFileAuthState
function from @whiskeysockets/baileys
.
The bot listens for incoming messages and interacts with the ChatGPT API to generate responses.
Event listeners handle connection updates, such as QR code display, connection establishment, and disconnection.
The script includes error handling to gracefully manage API errors and other exceptions.
- Send messages to the WhatsApp number associated with the bot.
- Experience intelligent responses generated by ChatGPT.
Feel free to contribute by submitting issues or pull requests. Your feedback and improvements are welcomed!
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the authors of
@whiskeysockets/baileys
for providing a powerful library for WhatsApp Web automation. - Appreciation to OpenAI for ChatGPT APIs.
Happy Chatting with WahGPT! π€π