This is a Node.js server that facilitates the creation of WhatsApp Web sessions using the whatsapp-web.js library. It also serves as a communication bridge between clients and the WhatsApp Web interface.
Before running this server, ensure you have the following installed:
- Node.js
- npm (Node Package Manager)
Follow these steps to set up and run the server:
-
Clone this repository to your local machine:
git clone <repository-url>
-
Navigate to the project directory:
cd <project-directory>
-
Install the required dependencies:
npm install
-
Start the server:
node server.js
-
The server will start and listen on port 3002.
- Create WhatsApp Web sessions programmatically.
- Generate and emit QR codes for session initialization.
- Authenticate and initialize WhatsApp Web sessions.
- Retrieve all chats from the WhatsApp Web interface.
- Connect to the server using a WebSocket client (e.g., a web application).
- Emit a "createSession" event with a session ID to initiate a WhatsApp Web session.
- The server will generate a QR code for session initialization.
- Scan the QR code using a mobile device with WhatsApp installed.
- Once authenticated, the server will emit a "ready" event to indicate that the session is ready.
- Clients can then send a "getAllChats" event to retrieve all chats from the WhatsApp Web interface.
This is a simple React web application that allows you to create a WhatsApp Web session by scanning a QR code. It uses the whatsapp-web.js library for interacting with WhatsApp Web. The server is implemented using Node.js, Express, and socket.io.
Before running this application, ensure you have the following installed:
- Node.js
- npm (Node Package Manager)
Follow these steps to set up and run the application:
-
Clone this repository to your local machine:
git clone <repository-url>
-
Navigate to the project directory:
cd <project-directory>
-
Install the required dependencies for the client:
cd client npm install
-
Install the required dependencies for the server:
cd .. npm install
-
Start the server:
node server.js
-
Start the client application:
cd client npm start
-
Open your web browser and go to
http://localhost:3000
to access the WhatsApp Web JS Client.
- Enter a session ID in the input field.
- Click the "Create Session" button to initiate the WhatsApp Web session.
- A QR code will be displayed.
- Open WhatsApp on your mobile device.
- Tap on the three dots in the upper-right corner and select "WhatsApp Web."
- Scan the displayed QR code with your mobile device's camera.
- Once the session is authenticated, you will see the "Get All Chats" button.
- Click the "Get All Chats" button to retrieve all your chats.
- Create WhatsApp Web sessions by scanning QR codes.
- Display the QR code for session initialization.
- Retrieve and display all chats after session authentication.