https://github.com/sunjay-dev/whatsapp-bot-with-puppeteer
Automate WhatsApp messages with Puppeteer. Send fun messages programmatically!
https://github.com/sunjay-dev/whatsapp-bot-with-puppeteer
automation message messaging nodejs puppeteer puppeteer-core whatsapp whatsapp-bot
Last synced: 8 months ago
JSON representation
Automate WhatsApp messages with Puppeteer. Send fun messages programmatically!
- Host: GitHub
- URL: https://github.com/sunjay-dev/whatsapp-bot-with-puppeteer
- Owner: sunjay-dev
- License: mit
- Created: 2023-09-29T13:12:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-26T15:26:18.000Z (about 1 year ago)
- Last Synced: 2025-04-07T04:54:20.789Z (about 1 year ago)
- Topics: automation, message, messaging, nodejs, puppeteer, puppeteer-core, whatsapp, whatsapp-bot
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WhatsApp Puppeteer Bot
## Overview
This project is a simple WhatsApp automation script using Puppeteer. It leverages Puppeteer's capabilities to send messages on WhatsApp.
## Features
* Launches a headless browser with Puppeteer.
* Navigates to WhatsApp Web ([https://web.whatsapp.com](https://web.whatsapp.com)).
* Waits for the user to scan the QR code and log in.
* Sends a series of messages to a specified chat, demonstrating message automation.
* Ends with a fun message to inform the recipient that it's just a demo project (Optional).
## How to Use
1. Clone the repository and install dependencies:
```bash
git clone https://github.com/sunjay-dev/whatsapp-bot-with-puppeteer.git
cd whatsapp-bot-with-puppeteer
npm install
```
2. Run the script:
```bash
node script.js
```
3. When WhatsApp Web opens:
* Scan the QR code using your phone.
* Press Enter on terminal.
* Let the script automatically send messages after login.
---
### If Not Using Windows, Do This Instead
This script uses the Windows Chrome path by default:
```js
const options = {
headless: false, // Set to true to run in the background
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', // Replace with path to your Chrome
};
```
### 🛠️ How to Find the Path to Chrome
Depending on your operating system, the Chrome path will be different:
* **On Windows:**
```
C:\Program Files\Google\Chrome\Application\chrome.exe
```
> Right-click the Chrome shortcut → **Properties** → copy the path from the **Target** field.
* **On macOS:**
```bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
```
* **On Linux:**
Run this command in the terminal:
```bash
which google-chrome
```
Once you find the correct path, update the `executablePath` value in your script accordingly.
---
## Important Note
This script is for **educational and demonstrative purposes only**. Use automation responsibly and always respect the terms of service of any platform you interact with.
---
## Contributing
Feel free to contribute by opening issues or submitting pull requests.
---
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.