whatsapp-auto-bot

1.0.4 • Public • Published

whatsapp-auto-bot

WhatsAuto is a TypeScript library for automating WhatsApp Web interactions using Playwright. It simplifies the process of logging into WhatsApp Web, sending messages, and more, all through a programmatic interface.

Installation

To install WhatsAuto, use the following command:

npm install whatsapp-auto-bot
# or if you use Yarn
yarn add whatsapp-auto-bot

After installing WhatsAuto, you need to install Playwright's dependencies:

npx playwright install
# or if you use Yarn
yarn playwright install

Usage

Here's a quick example to get you started:

import { WhatsAppService } from 'whatsauto';

async function main() {
    const whatsAppService = new WhatsAppService();

    // Log in to WhatsApp Web with your phone number
    const authCode = await whatsAppService.login('YOUR_PHONE_NUMBER');

    // Use the returned authCode to link your device in WhatsApp Web
    console.log(`Please use the following code to link your device: ${authCode}`);

    // Once linked, you can send messages
    await whatsAppService.sendMessage('GROUP_NAME', 'Your message here');
}

main();

Important Note

  • When using WhatsAuto in your application, it is important to keep the application running to maintain the Playwright browser instance. The WhatsAuto library is designed to reuse the browser instance for efficiency. If your application exits, the browser instance will close, and you will need to restart the process.

Features

  • Easy to Use: Simplified methods to interact with WhatsApp Web.
  • Automated Messaging: Send messages to individual or group chats.
  • Login and Device Linking: Automates the login process and provides a code for device linking in WhatsApp Web.

Documentation

For more detailed documentation, refer to Documentation.

Contributing

Contributions are always welcome! Please read the contributing guidelines before making any changes.

License

This project is licensed under the MIT License.

Disclaimer

This library is for educational and research purposes only. Use it responsibly and at your own risk.

Readme

Keywords

none

Package Sidebar

Install

npm i whatsapp-auto-bot

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

154 kB

Total Files

11

Last publish

Collaborators

  • carloluisito