Skip to content

sunjay-dev/whatsapp-bot-with-puppeteer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

    git clone https://github.com/sunjay-dev/whatsapp-bot-with-puppeteer.git
    cd whatsapp-bot-with-puppeteer
    npm install
  2. Run the script:

    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:

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:

    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
  • On Linux: Run this command in the terminal:

    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 file for details.

About

Automate WhatsApp messages with Puppeteer. Send fun messages programmatically!

Topics

Resources

License

Stars

Watchers

Forks