
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
innovatorswhatsappclass
Advanced tools
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.
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.
npm install innovatorswhatsappclass
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()
// 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']
})
// 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!'
)
// 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')
// Get chat history
const messages = await client.loadMessages(chatId, 50)
// Get specific message
const message = await client.loadMessage(chatId, messageId)
For a complete working example with message handling, group management, and error handling, check out our example.js
file. This example includes:
Feel free to use this example as a starting point for your WhatsApp bot implementation.
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 participantThe 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)
}
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Developed by Innovators Soft. Based on the @whiskeysockets/baileys library.
FAQs
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.
The npm package innovatorswhatsappclass receives a total of 62 weekly downloads. As such, innovatorswhatsappclass popularity was classified as not popular.
We found that innovatorswhatsappclass demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.