An open API service indexing awesome lists of open source software.

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!

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.