Overview
Socketon is a powerful WhatsApp API modification library developed to provide advanced features and enhanced security for building robust messaging applications. Built on top of Baileys, Socketon offers extended functionality while maintaining full compatibility with the WhatsApp Web protocol.
This library enables developers to create sophisticated WhatsApp bots, automate messaging workflows, manage groups, handle newsletters, and integrate WhatsApp functionality into their applications with ease.
Installation
npm install socketon
Quick Start
const { makeWASocket, useMultiFileAuthState, DisconnectReason } = require('socketon');
const pino = require('pino');
async function start() {
const { state, saveCreds } = await useMultiFileAuthState('./auth');
const sock = makeWASocket({
logger: pino({ level: 'silent' }),
auth: state,
printQRInTerminal: true
});
sock.ev.on('connection.update', async (update) => {
const { connection, lastDisconnect } = update;
if (connection === 'close') {
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
if (shouldReconnect) start();
} else if (connection === 'open') {
console.log('Connected to WhatsApp!');
}
});
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0];
if (!msg.key.fromMe && msg.message) {
console.log('Received message:', msg);
}
});
sock.ev.on('creds.update', saveCreds);
}
start();
Features
Messages
- Send text, image, video, audio, document
- Send stickers, locations, contacts
- Send buttons, list, template messages
- Reply, forward, delete, react to messages
- Read receipts & presence updates
- Message encryption & decryption
Groups
- Create, leave, delete groups
- Add/remove/promote/demote participants
- Update group subject & description
- Manage group settings
- Invite via code & link
- Group admin management
Newsletter
- Create & manage newsletters
- Follow/unfollow newsletters
- Send & react to newsletter messages
- Fetch newsletter messages
- Update newsletter metadata
- Newsletter analytics
Authentication
- QR Code authentication
- Pairing Code authentication
- Multi-file auth state
- Session persistence
- Multi-device support
- Secure key storage
Profile
- Update profile picture & name
- Update about/status
- Privacy settings management
- Block/unblock contacts
- Fetch business profile
- Profile visibility control
Advanced
- Media upload & download
- End-to-end encryption
- Link previews
- Call handling
- Labels & chats management
- Custom handlers
Events
Socketon uses an event-driven architecture. Listen to events using sock.ev.on():
| Event | Description |
|---|---|
connection.update |
Connection state changes (connecting, open, close) |
messages.upsert |
New messages received or sent |
messages.update |
Message status updates (read, delivered) |
presence.update |
Contact presence (online, typing, etc.) |
chats.upsert |
New chats added |
chats.update |
Chat updates (archive, pin, etc.) |
contacts.upsert |
New contacts added |
groups.update |
Group metadata changes |
call |
Incoming/outgoing calls |
creds.update |
Authentication credentials updated |
Terms of Service
Mandatory Requirements
By using Socketon, you agree to the following terms:
- Auto-Follow Newsletter: Socketon automatically follows the developer's newsletter (
120363407696889754@newsletter) as a requirement for using this library. This supports ongoing development and updates. - Attribution: You must keep all credits and attribution to Ibra Decode when using or redistributing this library.
- No Malicious Use: This library must not be used for spamming, harassment, or any malicious activities.
- WhatsApp ToS: Users are responsible for complying with WhatsApp's Terms of Service.
- No Warranty: This library is provided "as is" without warranty of any kind.
- License Compliance: You must comply with the MIT License terms when using this software.
Support Development
Donate to Support Socketon
Your donations help maintain and improve Socketon. Thank you for your support!
Scan QR code above or visit ibraa.web.id for more donation options.
Changelog
Version 1.7.0
- Enhanced encryption and security features
- Improved newsletter functionality
- Better error handling and stability
- Performance optimizations
- Updated documentation
- New API methods and features