supun-bailey-vip 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@
30
30
  </p>
31
31
 
32
32
  **Next-generation, all-in-one WhatsApp automation library — no browser required.**
33
- High performance, enterprise-grade Baileys protocol engine featuring **Pairing Code & Terminal QR**, **MessageBuilder v4.7**, **VoIP Voice/Video Calls**, **Dugong Cloud Engine**, **Meta AI Live Reasoning & Planning Replay**, **AIRich UX Primitives**, **Performance Latency Tuning**, **Multi-DB Auth**, and **WhatsApp Flows**.
33
+ High performance, enterprise-grade Baileys protocol engine featuring **Pairing Code & Terminal QR**, **MessageBuilder v4.7**, **VoIP Voice/Video Calls**, **VIP Cloud Engine**, **Meta AI Live Reasoning & Planning Replay**, **AIRich UX Primitives**, **Performance Latency Tuning**, **Multi-DB Auth**, and **WhatsApp Flows**.
34
34
 
35
35
  <br/>
36
36
 
@@ -65,9 +65,10 @@ High performance, enterprise-grade Baileys protocol engine featuring **Pairing C
65
65
  - [🤖 Meta AI Reasoning & Planning Replay](#-meta-ai-reasoning--planning-replay)
66
66
  - [💎 AIRich UX Primitives](#-airich-ux-primitives)
67
67
  - [🎨 MessageBuilder v4.7 (Buttons & Carousels)](#-messagebuilder-v47-buttons--carousels)
68
+ - [🔘 Modern Native Buttons & Interactive System](#-modern-native-buttons--interactive-system)
68
69
  - [🔘 Telegram-Style Interactive Buttons](#-telegram-style-interactive-buttons)
69
70
  - [📋 WhatsApp Flows & Native Flow Handlers](#-whatsapp-flows--native-flow-handlers)
70
- - [☁️ Dugong Cloud Engine (`sock.cloud`)](#️-dugong-cloud-engine-sockcloud)
71
+ - [☁️ VIP Cloud Engine (`sock.cloud`)](#️-vip-cloud-engine-sockcloud)
71
72
  - [📢 Status & Stories](#-status--stories)
72
73
  - [👥 Group Management](#-group-management)
73
74
  - [🏘️ Communities Management](#️-communities-management)
@@ -79,6 +80,11 @@ High performance, enterprise-grade Baileys protocol engine featuring **Pairing C
79
80
  - [🆔 WhatsApp MEX Username API](#-whatsapp-mex-username-api)
80
81
  - [⚡ Performance Tuning & Modes](#-performance-tuning--modes)
81
82
  - [💾 In-Memory Store & Reporting Info Store](#-in-memory-store--reporting-info-store)
83
+ - [💼 Business Features (WhatsApp Business)](#-business-features-whatsapp-business)
84
+ - [💬 Comprehensive Chat Features & Shortcuts](#-comprehensive-chat-features--shortcuts)
85
+ - [🚀 ConnectBot & Multi-Session Manager](#-connectbot--multi-session-manager)
86
+ - [📦 Compressed Session Backup & Restore](#-compressed-session-backup--restore)
87
+ - [⏱️ Send Queue & Human Typing Simulation](#-send-queue--human-typing-simulation)
82
88
  - [🌐 Community & Support](#-community--support)
83
89
  - [📄 License](#-license)
84
90
 
@@ -96,7 +102,7 @@ High performance, enterprise-grade Baileys protocol engine featuring **Pairing C
96
102
  - **AIRich UX Primitives**: Syntax-highlighted code blocks with lexers, formatted markdown tables, and Lottie stickers.
97
103
  - **WhatsApp Flows**: Full parser and button generator for interactive native flows and forms.
98
104
  - **MessageBuilder v4.7**: Fluent chaining API for CTA buttons, carousels, cards, and flows.
99
- - **Dugong Cloud Engine**: High-level dispatcher for albums, payments, products, interactive messages, and group stories.
105
+ - **VIP Cloud Engine**: High-level dispatcher for albums, payments, products, interactive messages, and group stories.
100
106
  - **VoIP Calling Engine**: Handle, accept, reject WhatsApp voice and video calls with custom stream feeders.
101
107
  - **Multi-DB Auth**: Ready-to-use adapters for MongoDB, Redis, PostgreSQL, MySQL, SQLite, Cache-Manager, KeyedDB, and Multi-file.
102
108
  - **Separated Clean Modules**: High cohesion socket split across Groups, Newsletters, Business, and Communities.
@@ -123,6 +129,56 @@ yarn add supun-bailey-vip
123
129
 
124
130
  ---
125
131
 
132
+ ## 🔒 VIP License Key System
133
+
134
+ `supun-bailey-vip` is protected by a tamper-resistant, hex-scrambled cryptographic license layer. Only the authorized owner (**Supun Fernando**) can initialize and run the socket.
135
+
136
+ To authenticate your instance, supply the VIP License Key using any of the following methods:
137
+
138
+ ### Method 1: Inside `makeWASocket` (Recommended)
139
+ ```javascript
140
+ import makeWASocket, { useMultiFileAuthState } from 'supun-bailey-vip'
141
+
142
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
143
+
144
+ const sock = makeWASocket({
145
+ key: 'supunfernando9988', // 🔑 VIP License Key
146
+ auth: state,
147
+ performanceMode: 'high'
148
+ })
149
+ ```
150
+
151
+ ### Method 2: Environment Variable
152
+ ```bash
153
+ export SUPUN_KEY="supunfernando9988"
154
+ # or
155
+ export SUPUN_VIP_KEY="supunfernando9988"
156
+ ```
157
+ Or in your `.env` file:
158
+ ```env
159
+ SUPUN_KEY=supunfernando9988
160
+ ```
161
+
162
+ ### Method 3: Key File
163
+ Create a `vip-key.json` or `key.txt` in your root project folder:
164
+ ```json
165
+ {
166
+ "key": "supunfernando9988"
167
+ }
168
+ ```
169
+
170
+ If an unauthorized user attempts to start Baileys without the key or with an invalid key, execution is immediately halted with a terminal security banner:
171
+ ```
172
+ ╔══════════════════════════════════════════════════════════════════╗
173
+ ║ 🔒 ACCESS DENIED — VIP LICENSE LOCKED ║
174
+ ╠══════════════════════════════════════════════════════════════════╣
175
+ ║ Unauthorized Access! Invalid or Missing VIP License Key. ║
176
+ ║ This Baileys modification is private property of Supun Fernando.║
177
+ ╚══════════════════════════════════════════════════════════════════╝
178
+ ```
179
+
180
+ ---
181
+
126
182
  ## 🔑 Authentication & Connection
127
183
 
128
184
  ### 1. Zero-Dependency Terminal QR
@@ -447,14 +503,23 @@ await sock.sendMessage(jid, {
447
503
  ptt: true // set true to send as Voice Recording
448
504
  })
449
505
 
450
- // 4. Document
506
+ // 4. Document (Supports up to 2GB / 3GB large files!)
451
507
  await sock.sendMessage(jid, {
452
- document: fs.readFileSync('./manual.pdf'),
453
- mimetype: 'application/pdf',
454
- fileName: 'UserManual.pdf'
508
+ document: { url: './movie_or_large_archive.zip' }, // Always use stream/url for large files (>100MB up to 2GB-3GB)
509
+ mimetype: 'application/zip',
510
+ fileName: 'Archive.zip',
511
+ caption: '📦 Large 2GB-3GB Archive'
455
512
  })
456
513
 
457
- // 5. Sticker
514
+ // 5. Large Video as Document (Up to 2GB / 3GB without WhatsApp media restriction)
515
+ await sock.sendMessage(jid, {
516
+ video: { url: './movie.mp4' },
517
+ asDocument: true, // Automatically sends as Document to bypass WhatsApp's 16-64MB video limit
518
+ fileName: 'Movie_1080p.mp4',
519
+ caption: '🎬 Full HD Movie (2GB+)'
520
+ })
521
+
522
+ // 6. Sticker
458
523
  await sock.sendMessage(jid, {
459
524
  sticker: fs.readFileSync('./sticker.webp')
460
525
  })
@@ -844,6 +909,274 @@ await sock.sendMessage(jid, {
844
909
 
845
910
  ---
846
911
 
912
+ ## 🔘 Modern Native Buttons & Interactive System
913
+
914
+ `supun-bailey-vip` includes a complete professional button and interactive suite: native buttons with automatic `<biz>` node rendering, multi-action types, button disabling, event listeners, experimental buttons, and smart interactive dialogs (confirmations, pagination, submenus, permissions guard, and repeatable actions).
915
+
916
+ ### 1. Sending Native Buttons (`sock.sendButtons`)
917
+
918
+ Easily send messages with quick reply, URL, call, copy code, dropdown list, and in-app webview buttons:
919
+
920
+ ```javascript
921
+ import { experimentalButtons } from 'supun-bailey-vip'
922
+
923
+ // Send all button types in one clean call
924
+ await sock.sendButtons(jid, {
925
+ text: 'Welcome to Supun VIP Bot! Please choose an option:',
926
+ footer: 'Powered by supun-bailey-vip',
927
+ buttons: [
928
+ { text: '📌 Quick Reply', id: '#menu' },
929
+ { text: '🌐 Visit Website', url: 'https://supunofc.site' },
930
+ { text: '📋 Copy Promo Code', copy: 'SUPUNVIP' },
931
+ { text: '📞 Call Helpline', call: '+94770000000' },
932
+ { text: '🚀 Open Web App', url: 'https://app.supunofc.site', useWebview: true },
933
+ experimentalButtons.requestLocation('📍 Share Location')
934
+ ]
935
+ })
936
+ ```
937
+
938
+ ### 2. Button Format Modes (`buttonsFormat`)
939
+
940
+ Control whether buttons are sent as modern interactive native flow or classic fallback:
941
+
942
+ ```javascript
943
+ // Mode 1: Modern Interactive (Default) — Renders natively on Android, iOS, and Web
944
+ await sock.sendButtons(jid, {
945
+ text: 'Modern interactive buttons',
946
+ buttons: [{ text: 'Click Me', id: '#click' }]
947
+ })
948
+
949
+ // Mode 2: Classic ButtonsMessage — Replies sent as plain text across all clients
950
+ await sock.sendButtons(jid, {
951
+ text: 'Classic format buttons',
952
+ buttonsFormat: 'buttons',
953
+ buttons: [{ text: 'Option A', id: '#a' }]
954
+ })
955
+ ```
956
+
957
+ ### 3. Listening to Button & List Responses (`onButton`, `onList`, `onReply`)
958
+
959
+ Handle button taps cleanly without manually parsing messages in `messages.upsert`:
960
+
961
+ ```javascript
962
+ // Listen to a specific button ID (with once: true support)
963
+ sock.onButton('#menu', async (msg, reply) => {
964
+ await sock.sendMessage(msg.key.remoteJid, { text: `Hello! You tapped: ${reply.text}` }, { quoted: msg })
965
+ })
966
+
967
+ // Listen to list / dropdown row selections
968
+ sock.onList('plan_pro', async (msg, reply) => {
969
+ console.log('Selected row:', reply.id)
970
+ })
971
+
972
+ // Global reply handler for any button, list, or template response
973
+ sock.onReply((reply) => reply.id.startsWith('cmd_'), async (msg, reply) => {
974
+ console.log(`Action dispatched: ${reply.id}`)
975
+ })
976
+
977
+ // Wait for a user's next message / reply
978
+ const userReply = await sock.awaitReply(msg, { timeoutMs: 30000 })
979
+ if (userReply) {
980
+ console.log('User replied with:', userReply.message)
981
+ }
982
+ ```
983
+
984
+ ### 4. Disabling Buttons After Click (`sock.disableButtons`)
985
+
986
+ Prevent double-clicks or expired button usage by editing the message to plain text:
987
+
988
+ ```javascript
989
+ const sent = await sock.sendButtons(jid, {
990
+ text: 'Select your preferred subscription:',
991
+ buttons: [
992
+ { text: 'Monthly ($5)', id: 'sub_month' },
993
+ { text: 'Yearly ($50)', id: 'sub_year' }
994
+ ]
995
+ })
996
+
997
+ // Once an option is chosen, disable the buttons
998
+ sock.onButton(/^sub_/, async (msg, reply) => {
999
+ await sock.disableButtons(sent, `✅ Selected plan: ${reply.text}`)
1000
+ })
1001
+ ```
1002
+
1003
+ ### 5. Multi-Card Interactive Carousels (`sock.sendCarousel`)
1004
+
1005
+ Send sideways-scrolling carousels with up to 10 cards, each with its own media, body, and buttons:
1006
+
1007
+ ```javascript
1008
+ await sock.sendCarousel(jid, {
1009
+ text: '🔥 Featured Products for Today',
1010
+ cards: [
1011
+ {
1012
+ image: { url: 'https://example.com/item1.jpg' },
1013
+ title: 'Supun Pro Bot',
1014
+ body: 'Full WhatsApp automation package',
1015
+ buttons: [{ text: '🛒 Order Now', id: 'order_pro' }]
1016
+ },
1017
+ {
1018
+ image: { url: 'https://example.com/item2.jpg' },
1019
+ title: 'VoIP Plugin',
1020
+ body: 'Real-time voice and video calling',
1021
+ buttons: [{ text: '🌐 View Demo', url: 'https://supunofc.site' }]
1022
+ }
1023
+ ]
1024
+ })
1025
+ ```
1026
+
1027
+ ### 6. Dropdown Lists (`sock.sendList`)
1028
+
1029
+ Send organized single-select dropdown menus:
1030
+
1031
+ ```javascript
1032
+ await sock.sendList(jid, {
1033
+ title: 'Service Catalog',
1034
+ text: 'Choose a department to connect with:',
1035
+ footer: '24/7 Customer Care',
1036
+ buttonText: 'View Departments',
1037
+ sections: [
1038
+ {
1039
+ title: 'Technical Support',
1040
+ rows: [
1041
+ { id: 'tech_bot', title: 'Bot Issues', description: 'Help with bot deployment' },
1042
+ { id: 'tech_api', title: 'API Integration', description: 'Custom webhook support' }
1043
+ ]
1044
+ },
1045
+ {
1046
+ title: 'Sales & Billing',
1047
+ rows: [
1048
+ { id: 'sales_vip', title: 'VIP License', description: 'Purchase VIP subscription' }
1049
+ ]
1050
+ }
1051
+ ]
1052
+ })
1053
+
1054
+ // Or pass a flat rows array directly without wrapping in sections:
1055
+ await sock.sendList(jid, {
1056
+ title: 'Quick Menu',
1057
+ text: 'Select your preferred action:',
1058
+ buttonText: 'Open Menu',
1059
+ rows: [
1060
+ { id: 'row_1', title: 'Option 1', description: 'First feature description' },
1061
+ { id: 'row_2', title: 'Option 2', description: 'Second feature description' },
1062
+ { id: 'row_3', title: 'Option 3', description: 'Third feature description' }
1063
+ ]
1064
+ })
1065
+
1066
+ // You can also mix Row Buttons inside sendButtons alongside other action buttons:
1067
+ await sock.sendButtons(jid, {
1068
+ text: 'Dashboard Menu:',
1069
+ buttons: [
1070
+ { text: '⚡ Quick Action', id: '#quick' },
1071
+ {
1072
+ text: '📋 View All Rows',
1073
+ rows: [
1074
+ { id: 'row_a', title: 'Row Item A', description: 'Detailed info A' },
1075
+ { id: 'row_b', title: 'Row Item B', description: 'Detailed info B' }
1076
+ ]
1077
+ },
1078
+ { text: '🌐 Official Website', url: 'https://supunofc.site' }
1079
+ ]
1080
+ })
1081
+ ```
1082
+
1083
+ ### 7. Smart Interactive Dialogs (`sock.interactive`)
1084
+
1085
+ Built-in stateful helpers for confirmations, pagination, multi-level menus, and permissions:
1086
+
1087
+ ```javascript
1088
+ // A. Confirm Dialog (Yes / No) — Returns boolean Promise & auto-disables buttons
1089
+ const confirmed = await sock.confirm(msg, 'Are you sure you want to clear the logs?')
1090
+ if (confirmed) {
1091
+ await sock.sendMessage(msg.key.remoteJid, { text: 'Logs cleared successfully!' })
1092
+ }
1093
+
1094
+ // B. Interactive Pagination with Auto Prev / Next
1095
+ const items = Array.from({ length: 25 }, (_, i) => `Item #${i + 1} - Product Details`)
1096
+ await sock.paginate(msg, items, {
1097
+ title: '📦 Inventory List',
1098
+ perPage: 5,
1099
+ prevText: '◀ Back',
1100
+ nextText: 'Next ▶'
1101
+ })
1102
+
1103
+ // C. Nested Menus with Submenus and Auto Back (Volver)
1104
+ await sock.menu(msg, {
1105
+ title: 'Main System Menu',
1106
+ buttonText: 'Select Option',
1107
+ items: [
1108
+ {
1109
+ title: 'Settings',
1110
+ items: [
1111
+ { title: 'Change Language', run: async (tap) => console.log('Lang selected') },
1112
+ { title: 'Notifications', run: async (tap) => console.log('Notif selected') }
1113
+ ]
1114
+ },
1115
+ {
1116
+ title: 'Account Info',
1117
+ text: 'Your account is active and verified.'
1118
+ }
1119
+ ]
1120
+ })
1121
+
1122
+ // D. Guarded Buttons (Only target user or admins can click)
1123
+ await sock.sendGuardedButtons(msg, {
1124
+ text: 'Admin Management Panel',
1125
+ buttons: [{ id: 'admin_reboot', text: '⚡ Reboot Server' }],
1126
+ who: 'admins', // 'admins' | 'sender' | 'anyone' | (tap, msg) => boolean
1127
+ once: true,
1128
+ denied: '🚫 Only group administrators can use this button.'
1129
+ }, async (tap) => {
1130
+ console.log('Authorized admin clicked reboot:', tap.sender.number)
1131
+ })
1132
+
1133
+ // E. Repeatable Action Button (Refresh / Again)
1134
+ let count = 0
1135
+ await sock.sendRepeatable(msg, () => {
1136
+ count++
1137
+ return `Random Lucky Number: ${Math.floor(Math.random() * 1000)} (Generated: ${count} times)`
1138
+ }, { buttonText: '🔁 Generate Again', maxRepeats: 10 })
1139
+ ```
1140
+
1141
+ ### 8. Experimental Native Flow Buttons (`experimentalButtons`)
1142
+
1143
+ Access newer WhatsApp native flow button types:
1144
+
1145
+ ```javascript
1146
+ import { experimentalButtons } from 'supun-bailey-vip'
1147
+
1148
+ await sock.sendButtons(jid, {
1149
+ text: 'Advanced Actions:',
1150
+ buttons: [
1151
+ experimentalButtons.requestLocation('📍 Send Location'),
1152
+ experimentalButtons.reminder('⏰ Remind Me Later'),
1153
+ experimentalButtons.cancelReminder('🚫 Cancel Reminder'),
1154
+ experimentalButtons.address('🏠 Enter Shipping Address'),
1155
+ experimentalButtons.webview('🌐 Open Webview', 'https://supunofc.site'),
1156
+ experimentalButtons.custom('cta_call', { display_text: 'Custom Call', phone_number: '+94770000000' })
1157
+ ]
1158
+ })
1159
+ ```
1160
+
1161
+ ### 9. Sender & Identity Resolvers (`getSender`, `isAdmin`, `isBotAdmin`)
1162
+
1163
+ Identify users accurately across phone numbers and LIDs:
1164
+
1165
+ ```javascript
1166
+ // Resolve who sent the message (resolves phone number, LID, name, group status)
1167
+ const sender = await sock.getSender(msg)
1168
+ console.log('Phone number:', sender.number)
1169
+ console.log('LID ID:', sender.id)
1170
+ console.log('Is Sender from me:', sender.fromMe)
1171
+ console.log('Is specific number:', sender.is('94770000000'))
1172
+
1173
+ // Check admin status accurately
1174
+ const isUserAdmin = await sock.isAdmin(groupJid, sender)
1175
+ const isBotAdmin = await sock.isBotAdmin(groupJid)
1176
+ ```
1177
+
1178
+ ---
1179
+
847
1180
  ## 🔘 Telegram-Style Interactive Buttons
848
1181
 
849
1182
  Experience Telegram-like interactive buttons inside WhatsApp using native protocol flows:
@@ -1051,12 +1384,12 @@ sock.ev.on('messages.upsert', async ({ messages }) => {
1051
1384
 
1052
1385
  ---
1053
1386
 
1054
- ## ☁️ Dugong Cloud Engine (`sock.cloud`)
1387
+ ## ☁️ VIP Cloud Engine (`sock.cloud` / `sock.vipEngine`)
1055
1388
 
1056
- Access Dugong high-level interactive handlers directly:
1389
+ Access VIP high-level interactive handlers directly:
1057
1390
 
1058
1391
  ```javascript
1059
- // 1. Native Interactive Buttons via Dugong
1392
+ // 1. Native Interactive Buttons via VIP Cloud Engine
1060
1393
  await sock.cloud.handleInteractiveButtons({
1061
1394
  title: 'Bot Dashboard',
1062
1395
  text: 'Choose your desired service below:',
@@ -1158,6 +1491,32 @@ await sock.groupRevokeInvite(groupJid) // Revoke link
1158
1491
  const requests = await sock.groupRequestParticipantsList(groupJid)
1159
1492
  await sock.groupRequestParticipantsUpdate(groupJid, [requests[0].jid], 'approve')
1160
1493
 
1494
+ // Member Label / Group Tag
1495
+ await sock.setLabelGroup(groupJid, 'VIP Member')
1496
+ // or: await sock.updateMemberLabel(groupJid, 'VIP Member')
1497
+
1498
+ // Member Add Mode & Join Approval Mode
1499
+ await sock.groupMemberAddMode(groupJid, 'all_member_add') // or 'admin_add'
1500
+ await sock.groupJoinApprovalMode(groupJid, 'on') // or 'off'
1501
+
1502
+ // Chat Labels & Message Labels (Business Labels)
1503
+ import { LabelColor, LabelAssociationType } from 'supun-bailey-vip'
1504
+
1505
+ // Add / Remove label on a Chat or Group
1506
+ await sock.addChatLabel(groupJid, '1')
1507
+ await sock.removeChatLabel(groupJid, '1')
1508
+
1509
+ // Add / Remove label on a specific message
1510
+ await sock.addMessageLabel(groupJid, msg.key.id, '1')
1511
+ await sock.removeMessageLabel(groupJid, msg.key.id, '1')
1512
+
1513
+ // Create custom label
1514
+ await sock.addLabel(groupJid, {
1515
+ name: 'Important Clients',
1516
+ color: LabelColor.Color1,
1517
+ deleted: false
1518
+ })
1519
+
1161
1520
  // Bulk Send to Group Members (with safety delay)
1162
1521
  await sock.sendMessageMembers(groupJid, { text: 'Notification to all members!' }, {
1163
1522
  delayMs: 2000,
@@ -1165,6 +1524,173 @@ await sock.sendMessageMembers(groupJid, { text: 'Notification to all members!' }
1165
1524
  })
1166
1525
  ```
1167
1526
 
1527
+ ---
1528
+
1529
+ ## 🌟 VIP Advanced Engine & Handlers
1530
+
1531
+ Full support for rich menus, Instagram previews, and advanced VIP message types:
1532
+
1533
+ ### 1. Rich AI Menu (`sock.richMenu`)
1534
+
1535
+ ```javascript
1536
+ await sock.richMenu(jid, {
1537
+ header: {
1538
+ title: '🌟 Main Bot Menu',
1539
+ disclaimer: true,
1540
+ disclaimerText: 'Automated by Baileys VIP',
1541
+ image: { url: 'https://example.com/banner.png', inline: false }
1542
+ },
1543
+ body: {
1544
+ title: 'Select a category:',
1545
+ toast: 'Opening service...',
1546
+ carousel: true, // or row: true
1547
+ cards: [
1548
+ {
1549
+ title: '⚡ Fast Tools',
1550
+ toast: 'Tool chosen',
1551
+ buttons: ['Converter', 'Downloader']
1552
+ },
1553
+ {
1554
+ title: '🎮 Games & Fun',
1555
+ toast: 'Game chosen',
1556
+ buttons: ['Trivia', 'Riddle']
1557
+ }
1558
+ ]
1559
+ },
1560
+ footer: {
1561
+ text: 'Join Official Channel',
1562
+ url: 'https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07'
1563
+ }
1564
+ })
1565
+ ```
1566
+
1567
+ ### 2. Instagram Profile View Card (`sock.sendInstaView`)
1568
+
1569
+ ```javascript
1570
+ // Sends a verified Instagram entity card with preview thumbnail & direct link
1571
+ await sock.sendInstaView(jid, 'supunfernando', 'https://example.com/profile.jpg')
1572
+ ```
1573
+
1574
+ ### 3. Dynamic HTML App (`sock.sendHtml`)
1575
+
1576
+ ```javascript
1577
+ await sock.sendHtml(jid, `
1578
+ <div style="background:#121b22; color:#fff; padding:15px; border-radius:10px;">
1579
+ <h2>VIP Dashboard</h2>
1580
+ <p>Real-time analytics and controls.</p>
1581
+ </div>
1582
+ `)
1583
+ ```
1584
+
1585
+ ### 4. Status Broadcast with Mentions (`sock.sendStatusMention`)
1586
+
1587
+ ```javascript
1588
+ // Broadcasts to status@broadcast and notifies targeted users/groups
1589
+ await sock.sendStatusMention(
1590
+ {
1591
+ text: '🔥 New release 1.0.8 is live!',
1592
+ backgroundColor: '#8D153A',
1593
+ font: 2
1594
+ },
1595
+ ['94712345678@s.whatsapp.net', '12036302@g.us']
1596
+ )
1597
+ ```
1598
+
1599
+ ### 5. Check WhatsApp & Request Pairing Codes
1600
+
1601
+ ```javascript
1602
+ // Check ban or official WA restriction status
1603
+ const status = await sock.checkWhatsApp('94712345678')
1604
+ console.log(status) // { isBanned: false, isNeedOfficialWa: false, exists: true }
1605
+
1606
+ // Request pairing code multiple times
1607
+ const codes = await sock.reqPairing('94712345678', 3)
1608
+ console.log(codes)
1609
+ ```
1610
+
1611
+ ### 6. VIP Message Types in `sendMessage`
1612
+
1613
+ ```javascript
1614
+ // 1. Payment Request
1615
+ await sock.sendMessage(jid, {
1616
+ requestPaymentMessage: {
1617
+ amount: 50000,
1618
+ currency: 'USD',
1619
+ note: 'Payment for Baileys VIP Subscription'
1620
+ }
1621
+ })
1622
+
1623
+ // 2. Interactive Product Message with Buttons
1624
+ await sock.sendMessage(jid, {
1625
+ productMessage: {
1626
+ title: 'VIP Software License',
1627
+ description: 'Lifetime access to all updates',
1628
+ priceAmount1000: 50000000,
1629
+ currencyCode: 'USD',
1630
+ body: 'Click below to order:',
1631
+ footer: 'Supun Fernando',
1632
+ buttons: [
1633
+ {
1634
+ name: 'cta_url',
1635
+ buttonParamsJson: JSON.stringify({
1636
+ display_text: 'Buy Now',
1637
+ url: 'https://supunofc.site'
1638
+ })
1639
+ }
1640
+ ]
1641
+ }
1642
+ })
1643
+
1644
+ // 3. Interactive Message with Native Flow & Media
1645
+ await sock.sendMessage(jid, {
1646
+ interactiveMessage: {
1647
+ title: 'Interactive Message',
1648
+ footer: 'Powered by Baileys VIP',
1649
+ header: 'Welcome!',
1650
+ image: 'https://example.com/header.jpg',
1651
+ buttons: [
1652
+ {
1653
+ name: 'quick_reply',
1654
+ buttonParamsJson: JSON.stringify({
1655
+ display_text: 'Accept Terms',
1656
+ id: 'btn_terms'
1657
+ })
1658
+ }
1659
+ ]
1660
+ }
1661
+ })
1662
+
1663
+ // 4. Album Message
1664
+ await sock.sendMessage(jid, {
1665
+ albumMessage: [
1666
+ { image: fs.readFileSync('./photo1.jpg'), caption: 'Photo 1' },
1667
+ { image: fs.readFileSync('./photo2.jpg'), caption: 'Photo 2' }
1668
+ ]
1669
+ })
1670
+
1671
+ // 5. Event Message
1672
+ await sock.sendMessage(jid, {
1673
+ eventMessage: {
1674
+ name: 'VIP Developer Meetup',
1675
+ description: 'Monthly Q&A with Supun Fernando',
1676
+ startTime: Date.now() + 86400000,
1677
+ endTime: Date.now() + 90000000,
1678
+ location: { degreesLatitude: 6.9271, degreesLongitude: 79.8612, name: 'Colombo' }
1679
+ }
1680
+ })
1681
+
1682
+ // 6. Poll Result Message
1683
+ await sock.sendMessage(jid, {
1684
+ pollResultMessage: {
1685
+ name: 'Community Vote Result',
1686
+ pollVotes: [
1687
+ { optionName: 'Feature A', optionVoteCount: 45 },
1688
+ { optionName: 'Feature B', optionVoteCount: 120 }
1689
+ ]
1690
+ }
1691
+ })
1692
+
1693
+
1168
1694
  ---
1169
1695
 
1170
1696
  ## 🏘️ Communities Management
@@ -1195,9 +1721,22 @@ Create and interact with WhatsApp Channels (Newsletters) with dedicated status s
1195
1721
  // Create Channel
1196
1722
  const newsletter = await sock.newsletterCreate('Tech Updates', 'Latest technology news')
1197
1723
 
1198
- // Follow & Unfollow
1199
- await sock.newsletterFollow(newsletterJid)
1200
- await sock.newsletterUnfollow(newsletterJid)
1724
+ // Follow & Unfollow (Supports Channel Link, Invite Code, or @newsletter JID!)
1725
+ await sock.newsletterFollow('https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07')
1726
+ await sock.newsletterUnfollow('https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07')
1727
+
1728
+ // Batch Auto-Follow Channels (with anti-ban delay)
1729
+ await sock.newsletterAutoFollow([
1730
+ 'https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07',
1731
+ 'https://whatsapp.com/channel/0029VaXXXXX'
1732
+ ], { delayMs: 2500, onProgress: ({ index, total, channel, success }) => console.log(`[${index}/${total}] Followed ${channel}: ${success}`) })
1733
+
1734
+ // Boost Channel Followers using Multi-Sessions
1735
+ // Pass an array of active sockets or a makeSessionManager instance:
1736
+ await sock.boostChannelFollowers('https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07', sessionManager, {
1737
+ delayMs: 3000,
1738
+ onProgress: (p) => console.log(`Session ${p.user} joined channel!`)
1739
+ })
1201
1740
 
1202
1741
  // Mute & Unmute
1203
1742
  await sock.newsletterMute(newsletterJid)
@@ -1205,6 +1744,13 @@ await sock.newsletterUnmute(newsletterJid)
1205
1744
 
1206
1745
  // React to Channel Post
1207
1746
  await sock.newsletterReactMessage(newsletterJid, serverId, '🔥')
1747
+ // Or use universal react helper:
1748
+ await sock.react(channelMsg, '❤️')
1749
+
1750
+ // Vote on a WhatsApp Channel Poll
1751
+ await sock.newsletterSendPollVote(newsletterJid, serverId, ['Option 1'])
1752
+ // Or use universal votePoll helper:
1753
+ await sock.votePoll(newsletterJid, ['Option 1'], { serverId })
1208
1754
 
1209
1755
  // Publish Newsletter Status Story
1210
1756
  await sock.sendNewsletterStatus(newsletterJid, {
@@ -1383,6 +1929,471 @@ sock.reportingInfoStore.add('94712345678@s.whatsapp.net', {
1383
1929
 
1384
1930
  ---
1385
1931
 
1932
+ ## 💼 Business Features (WhatsApp Business)
1933
+
1934
+ `supun-bailey-vip` provides full-fledged support for WhatsApp Business APIs, including catalogs, products, order management, business profiles, quick replies, and labels.
1935
+
1936
+ ### 1. Business Profile & Cover Photo
1937
+ ```javascript
1938
+ // Fetch business profile of any business account
1939
+ const profile = await sock.getBusinessProfile('94771234567@s.whatsapp.net')
1940
+ console.log(profile.description, profile.email, profile.websites, profile.hours)
1941
+
1942
+ // Update your own business profile
1943
+ await sock.updateBusinessProfile({
1944
+ description: 'Premier Software & WhatsApp Bot Development',
1945
+ email: 'contact@supunofc.site',
1946
+ address: 'Colombo, Sri Lanka',
1947
+ websites: ['https://supunofc.site'],
1948
+ hours: {
1949
+ timezone: 'Asia/Colombo',
1950
+ days: [
1951
+ { day: 'monday', mode: 'specific_hours', openTimeInMinutes: 540, closeTimeInMinutes: 1080 },
1952
+ { day: 'tuesday', mode: 'specific_hours', openTimeInMinutes: 540, closeTimeInMinutes: 1080 }
1953
+ ]
1954
+ }
1955
+ })
1956
+
1957
+ // Update or remove cover photo
1958
+ await sock.updateCoverPhoto(fs.readFileSync('./cover.jpg'))
1959
+ await sock.removeCoverPhoto()
1960
+ ```
1961
+
1962
+ ### 2. Catalog & Product Management
1963
+ ```javascript
1964
+ // Fetch products from catalog
1965
+ const catalog = await sock.getCatalog({ jid: '94771234567@s.whatsapp.net', limit: 10 })
1966
+ console.log(catalog.products)
1967
+
1968
+ // Fetch catalog collections
1969
+ const collections = await sock.getCollections('94771234567@s.whatsapp.net', 10)
1970
+
1971
+ // Create a new product in your catalog
1972
+ const newProduct = await sock.productCreate({
1973
+ name: 'VIP Bot Premium License',
1974
+ description: 'Lifetime access to all VIP bot features',
1975
+ price: 1500000, // in minor currency units (e.g. cents)
1976
+ currency: 'LKR',
1977
+ retailerId: 'LIC-001',
1978
+ url: 'https://supunofc.site',
1979
+ images: [{ image: fs.readFileSync('./license.png') }]
1980
+ })
1981
+
1982
+ // Update existing product
1983
+ await sock.productUpdate(newProduct.id, {
1984
+ name: 'VIP Bot Premium License - 2026 Edition',
1985
+ price: 1200000
1986
+ })
1987
+
1988
+ // Delete products
1989
+ await sock.productDelete([newProduct.id])
1990
+
1991
+ // Fetch order details
1992
+ const order = await sock.getOrderDetails('ORDER_ID_123', 'TOKEN_ABC')
1993
+ ```
1994
+
1995
+ ### 3. Quick Replies & Contacts
1996
+ ```javascript
1997
+ // Add or edit quick reply
1998
+ await sock.addOrEditQuickReply({
1999
+ shortcut: 'thanks',
2000
+ message: 'Thank you for reaching out to Supun Fernando! How can I assist you today?'
2001
+ })
2002
+
2003
+ // Remove quick reply
2004
+ await sock.removeQuickReply('QUICK_REPLY_ID')
2005
+
2006
+ // Add or remove WhatsApp contact
2007
+ await sock.addOrEditContact('94771234567@s.whatsapp.net', { firstName: 'Supun', lastName: 'Fernando' })
2008
+ await sock.removeContact('94771234567@s.whatsapp.net')
2009
+ ```
2010
+
2011
+ ### 4. Labels & Chat/Message Labels
2012
+ ```javascript
2013
+ // Add a business label
2014
+ const label = await sock.addLabel('VIP Customers', '#00534E')
2015
+
2016
+ // Label or unlabel a chat
2017
+ await sock.addChatLabel('94771234567@s.whatsapp.net', label.id)
2018
+ await sock.removeChatLabel('94771234567@s.whatsapp.net', label.id)
2019
+
2020
+ // Label or unlabel a specific message
2021
+ await sock.addMessageLabel('94771234567@s.whatsapp.net', 'MSG_ID_123', label.id)
2022
+ await sock.removeMessageLabel('94771234567@s.whatsapp.net', 'MSG_ID_123', label.id)
2023
+ ```
2024
+
2025
+ ---
2026
+
2027
+ ## 💬 Comprehensive Chat Features & Shortcuts
2028
+
2029
+ High-level convenience helpers:
2030
+
2031
+ ### 1. Shortcuts (`reply`, `react`, `sendSafe`, `ask`, `tagAll`)
2032
+ ```javascript
2033
+ // Fast reply with string or content
2034
+ await sock.reply(msg, 'Hello from Supun Bailey VIP!')
2035
+ await sock.reply(msg, { image: { url: 'https://example.com/pic.jpg' }, caption: 'Here is your photo!' })
2036
+
2037
+ // Emoji reactions (pass '' to remove reaction, works on DMs, Groups and Channels!)
2038
+ await sock.react(msg, '🦁')
2039
+ await sock.react(msg, '')
2040
+
2041
+ // Auto-React to Incoming Messages
2042
+ const reactor = sock.autoReact({
2043
+ emojis: ['❤️', '🔥', '👍', '🎉', '👏', '🦁', '💯', '✨'], // Pool of random emojis or single emoji
2044
+ delayMs: 1200, // anti-ban delay
2045
+ ignoreMe: true
2046
+ })
2047
+ // reactor.stop() // Call anytime to disable auto-reactions
2048
+
2049
+ // Safe send (never throws, returns status: 'sent' | 'failed' | 'unknown')
2050
+ const res = await sock.sendSafe(jid, 'Safe message without try/catch', {}, { timeoutMs: 15000 })
2051
+ if (res.status === 'sent') console.log('Delivered message ID:', res.message.key.id)
2052
+
2053
+ // Tag all group members cleanly
2054
+ await sock.tagAll('120363012345678901@g.us', '📢 Attention everyone!')
2055
+
2056
+ // Ask a question and wait for the same user's response
2057
+ const answer = await sock.ask(msg, 'What is your username?', { timeoutMs: 60000 })
2058
+ console.log('User answered:', answer)
2059
+ ```
2060
+
2061
+ ### 2. Media Download with Auto-Reupload
2062
+ ```javascript
2063
+ // Download media from direct message or quoted message with automatic re-upload fallback
2064
+ const buffer = await sock.downloadMedia(msg)
2065
+ fs.writeFileSync('./downloaded.jpg', buffer)
2066
+
2067
+ // Download from quoted message
2068
+ const quotedBuffer = await sock.downloadMedia(msg, { quoted: true })
2069
+ ```
2070
+
2071
+ ### 3. Native vCard Contacts & Location Pins
2072
+ ```javascript
2073
+ // Send vCard 3.0 contact cards with native waid buttons
2074
+ await sock.sendContact(jid, {
2075
+ name: 'Supun Fernando',
2076
+ number: '+94 77 123 4567',
2077
+ organization: 'VIP Bot Team'
2078
+ })
2079
+
2080
+ // Send multiple contacts at once
2081
+ await sock.sendContact(jid, [
2082
+ { name: 'Alice', number: '+1 234 567 8901' },
2083
+ { name: 'Bob', number: '+44 7123 456789' }
2084
+ ])
2085
+
2086
+ // Send map pin location
2087
+ await sock.sendLocation(jid, {
2088
+ latitude: 6.9271,
2089
+ longitude: 79.8612,
2090
+ name: 'Colombo',
2091
+ address: 'Western Province, Sri Lanka'
2092
+ })
2093
+ ```
2094
+
2095
+ ### 4. Albums & Long Text Splitting
2096
+ ```javascript
2097
+ // Send 2 to 10 photos/videos in a grouped WhatsApp Album
2098
+ await sock.sendAlbum(jid, [
2099
+ { image: { url: 'https://example.com/photo1.jpg' }, caption: '1️⃣ First photo' },
2100
+ { image: { url: 'https://example.com/photo2.jpg' }, caption: '2️⃣ Second photo' },
2101
+ { video: { url: 'https://example.com/video.mp4' }, caption: '3️⃣ Clip' }
2102
+ ])
2103
+
2104
+ // Send long text split cleanly on paragraph/word boundaries without cutting words
2105
+ await sock.sendLong(jid, veryLongDocumentText, { maxLength: 3500, delayMs: 800 })
2106
+ ```
2107
+
2108
+ ### 5. Events & Scheduled Calls
2109
+ ```javascript
2110
+ // Send event invitation
2111
+ await sock.sendEvent(jid, {
2112
+ name: 'VIP Developer Meetup 2026',
2113
+ description: 'Annual gathering of bot creators & contributors',
2114
+ start: new Date(Date.now() + 86400000),
2115
+ end: new Date(Date.now() + 86400000 + 7200000),
2116
+ location: 'Lotus Tower, Colombo'
2117
+ })
2118
+
2119
+ // Send scheduled call
2120
+ await sock.sendScheduledCall(jid, {
2121
+ title: 'Code Review & Deployment Strategy',
2122
+ start: new Date(Date.now() + 3600000),
2123
+ type: 1 // 1: Voice, 2: Video
2124
+ })
2125
+
2126
+ // Read channel metadata by link, invite code, or JID
2127
+ const channel = await sock.channelInfo('https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07')
2128
+ console.log('Channel title:', channel.name, 'Subscribers:', channel.subscribersCount)
2129
+ ```
2130
+
2131
+ ### 6. Interactive Polls, Quizzes & Timed Auto-Closing Polls
2132
+ ```javascript
2133
+ // 1. Regular poll with live vote tracking
2134
+ const poll = await sock.sendPoll(jid, 'Which OS do you use?', ['Android', 'iOS', 'Linux', 'Windows'])
2135
+
2136
+ // 2. Quiz with one verified correct answer
2137
+ await sock.sendQuiz(jid, 'What is the capital of Sri Lanka?', ['Colombo', 'Sri Jayawardenepura Kotte', 'Kandy'], 'Sri Jayawardenepura Kotte')
2138
+
2139
+ // 3. Image Poll (photo album options + poll)
2140
+ await sock.sendImagePoll(jid, {
2141
+ name: 'Choose the best logo design:',
2142
+ options: [
2143
+ { image: fs.readFileSync('./logo1.png'), text: 'Dark Minimalist' },
2144
+ { image: fs.readFileSync('./logo2.png'), text: 'Golden Lion VIP' }
2145
+ ]
2146
+ })
2147
+
2148
+ // 4. Timed Poll that closes automatically and posts formatted results
2149
+ await sock.sendTimedPoll(jid, 'Lunch Choice?', ['Rice & Curry', 'Kottu', 'Pizza'], {
2150
+ closeAfter: '10m', // or ms / Date
2151
+ showVoters: true,
2152
+ onClose: (result) => {
2153
+ console.log('Poll completed! Winner:', result.winners)
2154
+ }
2155
+ })
2156
+
2157
+ // 5. Cast a Vote on a Poll (Chat, Group or Channel!)
2158
+ await sock.votePoll(pollMsg, 'Android') // by option name
2159
+ await sock.votePoll(pollMsg, 0) // by 0-indexed position
2160
+ await sock.votePoll(pollMsg, ['Android', 'Linux']) // multiple choices
2161
+
2162
+ // 6. Channel Poll Voting
2163
+ await sock.votePoll(channelJid, ['Option 1'], { serverId: '123' })
2164
+
2165
+ // 7. Auto-Vote on Incoming Polls
2166
+ const autoVoter = sock.autoVote({
2167
+ choice: 0, // vote first option, or option name, or 'random', or (poll, msg) => choice
2168
+ delayMs: 2000, // anti-ban safety delay
2169
+ ignoreMe: true
2170
+ })
2171
+ // autoVoter.stop() // Call anytime to disable auto-voting
2172
+
2173
+ // Listen to live poll vote updates
2174
+ sock.ev.on('poll.votes', ({ pollKey, pollName, votes, voter }) => {
2175
+ console.log(`[Vote] ${voter} voted in "${pollName}"`)
2176
+ console.log('Current ranking:', votes)
2177
+ })
2178
+
2179
+ // Inspect tracked votes anytime
2180
+ const votes = sock.getPollVotes(poll.key)
2181
+ const quizScore = sock.getQuizResult(quizKey)
2182
+ ```
2183
+
2184
+ ### 7. In-Memory & Persistent Message Scheduler
2185
+ Schedule one-off or recurring messages (`at`, `after`, `every`, `cron`):
2186
+ ```javascript
2187
+ // Send at a specific date/time
2188
+ sock.schedule.at(new Date(Date.now() + 3600000), jid, { text: 'One hour has passed!' })
2189
+
2190
+ // Send after a duration string
2191
+ sock.schedule.after('30m', jid, { text: 'Reminder: Check server status!' })
2192
+
2193
+ // Send every interval (e.g. every 2 hours, up to 10 times)
2194
+ const jobId = sock.schedule.every('2h', jid, { text: 'Periodic health heartbeat' }, { times: 10 })
2195
+
2196
+ // Send on cron schedule (Weekdays at 9:00 AM)
2197
+ sock.schedule.cron('0 9 * * 1-5', jid, { text: 'Good morning team!' })
2198
+
2199
+ // List waiting scheduled jobs
2200
+ console.log(sock.schedule.list())
2201
+
2202
+ // Cancel a scheduled job
2203
+ sock.schedule.cancel(jobId)
2204
+ ```
2205
+
2206
+ ### 8. Commands Router with Cooldown & Spam Protection
2207
+ ```javascript
2208
+ // Register a command
2209
+ sock.commands.add({
2210
+ name: 'ping',
2211
+ aliases: ['p', 'speed'],
2212
+ cooldown: '5s',
2213
+ groupOnly: false,
2214
+ run: async (msg, { args, sender, command }) => {
2215
+ const start = Date.now()
2216
+ await sock.reply(msg, `🏓 Pong! Latency: ${Date.now() - start}ms`)
2217
+ }
2218
+ })
2219
+
2220
+ // In your message listener
2221
+ sock.ev.on('messages.upsert', async ({ messages }) => {
2222
+ for (const msg of messages) {
2223
+ await sock.commands.handle(msg)
2224
+ }
2225
+ })
2226
+ ```
2227
+
2228
+ ### 9. Insights, Delivery Status & Connection Health
2229
+ ```javascript
2230
+ // Ping health check & memory report
2231
+ const health = await sock.health({ ping: true })
2232
+ console.log('Ping Latency:', health.latencyMs, 'ms, Heap:', health.memory.heapUsedMB, 'MB')
2233
+
2234
+ // Message counters
2235
+ console.log(sock.getStats())
2236
+
2237
+ // Check delivery state of sent message ('sent' | 'delivered' | 'read' | 'played' | 'failed')
2238
+ console.log(sock.getMessageStatus('MSG_ID_123'))
2239
+
2240
+ // Listen for delivery updates
2241
+ sock.ev.on('message.status', ({ key, status }) => {
2242
+ console.log(`Message ${key.id} status is now: ${status}`)
2243
+ })
2244
+ ```
2245
+
2246
+ ### 10. Auto-Mentions & HTML Formatter
2247
+ ```javascript
2248
+ import { htmlToWhatsApp, buildVCard, splitText, parseMentions } from 'supun-bailey-vip'
2249
+
2250
+ // Sending text with @number automatically adds them to message mentions!
2251
+ await sock.sendMessage(jid, { text: 'Hello @94771234567, please check this out!' })
2252
+
2253
+ // Convert HTML markup to WhatsApp native formatting (*bold*, _italic_, ~strike~, `code`)
2254
+ const waFormatted = htmlToWhatsApp('<h2>Title</h2><p>Here is <b>bold</b> and <code>code</code>.</p>')
2255
+ await sock.sendHtmlText(jid, '<b>Important Notice:</b> Update your bot to <i>v1.1.0</i>!')
2256
+ ```
2257
+
2258
+ ---
2259
+
2260
+ ## 🚀 ConnectBot & Multi-Session Manager
2261
+
2262
+ ### 1. `connectBot` — One-Line Instant Starter
2263
+ Start a production-ready bot with pairing code, automatic session folder validation, and auto-reconnect in just a few lines:
2264
+
2265
+ ```javascript
2266
+ import { connectBot } from 'supun-bailey-vip'
2267
+
2268
+ const bot = await connectBot({
2269
+ authDir: './session',
2270
+ number: '94771234567', // Phone number with country code for pairing code
2271
+ setup: (sock) => {
2272
+ sock.ev.on('messages.upsert', async ({ messages }) => {
2273
+ const msg = messages[0]
2274
+ if (msg.message && !msg.key.fromMe) {
2275
+ await sock.reply(msg, '🦁 Hello from Supun Bailey VIP Bot!')
2276
+ }
2277
+ })
2278
+ }
2279
+ })
2280
+
2281
+ // Wait until connected
2282
+ const sock = await bot.ready
2283
+ console.log('Bot is online and ready!')
2284
+ ```
2285
+
2286
+ ### 2. `makeSessionManager` — Multi-Account Runner
2287
+ Run dozens of independent WhatsApp accounts in a single Node.js process:
2288
+
2289
+ ```javascript
2290
+ import { makeSessionManager } from 'supun-bailey-vip'
2291
+
2292
+ const manager = makeSessionManager({
2293
+ authDir: './sessions',
2294
+ setup: (sock, sessionId) => {
2295
+ console.log(`Setting up session: ${sessionId}`)
2296
+ sock.ev.on('messages.upsert', async ({ messages }) => {
2297
+ // Per-session message handler
2298
+ })
2299
+ }
2300
+ })
2301
+
2302
+ // Listen for pairing codes across all accounts
2303
+ manager.on('session.pairing-code', ({ id, code }) => {
2304
+ console.log(`[${id}] Pairing Code: ${code}`)
2305
+ })
2306
+
2307
+ // Start multiple accounts
2308
+ await manager.start('support-bot', { pairingNumber: '94771111111' })
2309
+ await manager.start('marketing-bot', { pairingNumber: '94772222222' })
2310
+
2311
+ // Access any socket
2312
+ const supportSock = manager.get('support-bot')
2313
+ ```
2314
+
2315
+ ---
2316
+
2317
+ ## 📦 Compressed Session Backup & Restore
2318
+
2319
+ Save your bot's entire credentials folder into a single, encrypted `.gz` compressed archive for easy backups, transfers, and cloud deployment:
2320
+
2321
+ ```javascript
2322
+ import { backupSession, restoreSession } from 'supun-bailey-vip'
2323
+
2324
+ // 1. Create a compressed backup of your session
2325
+ const backup = await backupSession('./session', './backups/session-backup.archive')
2326
+ console.log(`Saved ${backup.files} keys to backup file at ${backup.createdAt}`)
2327
+
2328
+ // 2. Restore session from archive (e.g. on a new server or container)
2329
+ await restoreSession('./backups/session-backup.archive', './session', { overwrite: true })
2330
+ console.log('Session restored successfully!')
2331
+ ```
2332
+
2333
+ ---
2334
+
2335
+ ## ⏱️ Send Queue & Human Typing Simulation
2336
+
2337
+ Protect your phone numbers from WhatsApp spam bans with rate-limiting, human typing simulation, and priority message queuing:
2338
+
2339
+ ```javascript
2340
+ import makeWASocket, { useMultiFileAuthState } from 'supun-bailey-vip'
2341
+
2342
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
2343
+
2344
+ const sock = makeWASocket({
2345
+ auth: state,
2346
+ sendQueue: {
2347
+ minDelayMs: 1000, // Minimum pause between sends
2348
+ maxDelayMs: 2500, // Maximum random human pause
2349
+ perChatIntervalMs: 1500, // Delay between messages in the same chat
2350
+ typing: true, // Automatically shows "composing..." typing indicator
2351
+ typingMsPerChar: 30, // Typing speed per character
2352
+ perChatLimit: { max: 15, windowMs: 60000 } // Anti-spam ceiling: max 15 msgs/min per chat
2353
+ }
2354
+ })
2355
+
2356
+ // Normal send (automatically queued with typing indicator)
2357
+ await sock.sendMessage(jid, { text: 'This message feels like typed by a human!' })
2358
+
2359
+ // Urgent messages (sent with higher queue priority)
2360
+ await sock.sendMessage(jid, { text: '🚨 URGENT ALERT' }, { priority: 'urgent' })
2361
+
2362
+ // Immediate send (bypasses queue)
2363
+ await sock.sendMessageNow(jid, { text: 'Sent immediately without waiting' })
2364
+
2365
+ // Queue control
2366
+ console.log('Waiting in queue:', sock.queue.size)
2367
+ sock.queue.clear()
2368
+ ```
2369
+
2370
+ ---
2371
+
2372
+ ## 🛡️ Group Moderation & Signal Noise Filter
2373
+
2374
+ ```javascript
2375
+ import { installConsoleFilter, makePrettyLogger } from 'supun-bailey-vip'
2376
+
2377
+ // 1. Mute noisy libsignal console logs
2378
+ installConsoleFilter()
2379
+
2380
+ // 2. Readable single-line logger
2381
+ const logger = makePrettyLogger({ level: 'info' })
2382
+
2383
+ // 3. Fast group moderation (handles both Phone Numbers and LIDs)
2384
+ const admins = await sock.getAdmins(groupJid)
2385
+ const isUserAdmin = await sock.isAdmin(groupJid, msg)
2386
+ const isBotAdmin = await sock.isBotAdmin(groupJid)
2387
+
2388
+ // Kick, Add, Promote, Demote
2389
+ await sock.kick(groupJid, '94771234567@s.whatsapp.net')
2390
+ await sock.addMembers(groupJid, '94771234567@s.whatsapp.net')
2391
+ await sock.promote(groupJid, '94771234567@s.whatsapp.net')
2392
+ await sock.demote(groupJid, '94771234567@s.whatsapp.net')
2393
+ ```
2394
+
2395
+ ---
2396
+
1386
2397
  ## 🌐 Community & Support
1387
2398
 
1388
2399
  <div align="center">