/WahGPT-Bot

WhatsApp Chat Bot with ChatGPT4 Api Integration 🤖💬🎨

Primary LanguageJavaScriptMIT LicenseMIT

WahGPT - WhatsApp Chatbot with ChatGPT Integration

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.

Features

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

Getting Started

Prerequisites

  • Node.js and npm installed on your machine.
  • WhatsApp account and a phone with an active internet connection.

Installation

  1. Clone the repository:

    git clone https://github.com/well300/WahGPT.git
  2. Navigate to the project directory:

    cd WahGPT
  3. Install dependencies:

    npm install
  4. Run the application:

    npm start
  5. Scan the QR code displayed with your WhatsApp Web to authenticate.

Code Structure

1. Initialization

The script initializes the WhatsApp client and sets up event listeners for authentication, QR code display, and readiness.

2. Authentication and State Management

It manages authentication state using the useMultiFileAuthState function from @whiskeysockets/baileys.

3. Message Processing

The bot listens for incoming messages and interacts with the ChatGPT API to generate responses.

4. Connection Handling

Event listeners handle connection updates, such as QR code display, connection establishment, and disconnection.

5. Error Handling

The script includes error handling to gracefully manage API errors and other exceptions.

Usage

  1. Send messages to the WhatsApp number associated with the bot.
  2. Experience intelligent responses generated by ChatGPT.

Contributing

Feel free to contribute by submitting issues or pull requests. Your feedback and improvements are welcomed!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • 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! 🤖🚀