New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

innovatorswhatsappclass

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

innovatorswhatsappclass

A powerful WhatsApp client library that provides seamless integration between Baileys and WhatsApp-web.js style APIs. This library makes it easy to create WhatsApp bots and automation tools with a familiar interface.

1.0.4
latest
npm
Version published
Weekly downloads
62
1966.67%
Maintainers
0
Weekly downloads
 
Created
Source

INNOVATORS SOFT WhatsApp Class

A powerful WhatsApp client library that provides seamless integration between Baileys and WhatsApp-web.js style APIs. This library makes it easy to create WhatsApp bots and automation tools with a familiar interface.

Features

  • 🚀 Easy to use, familiar WhatsApp-web.js style API
  • 📱 Multi-device support
  • 💬 Send and receive messages
  • 📸 Media handling (images, videos, documents)
  • 👥 Group management
  • 💾 Message history and chat management
  • 🔄 Auto-reconnect functionality
  • 📝 Read receipts
.code-block-header { display: flex; justify-content: space-between; align-items: center; background-color: #2d2d2d; padding: 8px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-bottom: -24px; } .code-block-header span { color: #e6e6e6; font-size: 0.9em; } .copy-button { background: transparent; border: 1px solid #666; border-radius: 4px; color: #e6e6e6; padding: 4px 8px; cursor: pointer; font-size: 0.8em; } .copy-button:hover { background: #666; }

Installation

bash Copy
npm install innovatorswhatsappclass

Quick Start

javascript Copy
const { WhatsAppClient } = require('innovatorswhatsappclass')
const qrcode = require('qrcode-terminal')

// Create client instance
const client = new WhatsAppClient({ sessionName: ".Sessions" });

// Handle QR Code
client.on('qr', qr => {
    qrcode.generate(qr, { small: true })
})

// Handle ready event
client.on('connected', () => {
    console.log('Client is ready!')
})

// Connect to WhatsApp
client.connect()

Usage Examples

1. Basic Messaging

javascript Copy
// Send a text message
await client.sendMessage('1234567890@s.whatsapp.net', 'Hello world!')

// Send a reply
await client.sendMessage('1234567890@s.whatsapp.net', 'This is a reply', {
    quoted: originalMessage
})

// Send with mentions
await client.sendMessage('1234567890@s.whatsapp.net', {
    type: 'text',
    text: 'Hey @user!',
    mentions: ['user@s.whatsapp.net']
})

2. Media Handling

javascript Copy
// Send an image
await client.sendMedia('1234567890@s.whatsapp.net', './image.jpg', {
    caption: 'Check out this image!'
})

// Send a document
await client.sendDocument('1234567890@s.whatsapp.net', './document.pdf', 
    'Check out this document!'
)

3. Group Management

javascript Copy
// Get all groups
const groups = await client.getAllGroups()

// Add participant to group
await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'add')

// Remove participant
await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'remove')

// Promote to admin
await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'promote')

// Demote admin
await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'demote')

4. Message History

javascript Copy
// Get chat history
const messages = await client.loadMessages(chatId, 50)

// Get specific message
const message = await client.loadMessage(chatId, messageId)

More Examples and Information

For a complete working example with message handling, group management, and error handling, check out our example.js file. This example includes:

  • 🔄 Connection handling and QR code generation
  • 📨 Message handling with commands
  • 👥 Group management examples
  • ⚡ Event listeners for various scenarios
  • 🛠️ Error handling and logging

Feel free to use this example as a starting point for your WhatsApp bot implementation.

Bot Commands

The library includes example bot commands that you can use:

  • !ping - Check if bot is alive
  • !echo <text> - Echo back your text
  • !mention - Mention you in a message
  • !reply - Reply to your message
  • !location - Send a location
  • !contact - Send a contact card
  • !react - React to your message with ❤️
  • !media - Send an example image
  • !doc - Send an example document
  • !history [count] - Show message history
  • !groups - List all your groups
  • !add <number> - Add participant to group
  • !remove <number> - Remove participant from group
  • !promote <number> - Promote participant to admin
  • !demote <number> - Demote admin to participant

Error Handling

The library includes comprehensive error handling:

client.on('error', error => {
    console.error('Client Error:', error)
})

try {
    await client.sendMessage(to, message)
} catch (error) {
    console.error('Error sending message:', error)
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

Developed by Innovators Soft. Based on the @whiskeysockets/baileys library.

FAQs

Package last updated on 03 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts