@realvare/baileys 1.0.0

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.
Files changed (201) hide show
  1. package/LICENSE +41 -0
  2. package/README.MD +2227 -0
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +5604 -0
  5. package/WAProto/index.d.ts +63156 -0
  6. package/WAProto/index.js +195638 -0
  7. package/WAProto/p.html +1 -0
  8. package/engine-requirements.js +10 -0
  9. package/lib/Defaults/baileys-version.json +3 -0
  10. package/lib/Defaults/index.d.ts +53 -0
  11. package/lib/Defaults/index.js +108 -0
  12. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  13. package/lib/Signal/Group/ciphertext-message.js +15 -0
  14. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  15. package/lib/Signal/Group/group-session-builder.js +64 -0
  16. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  17. package/lib/Signal/Group/group_cipher.js +96 -0
  18. package/lib/Signal/Group/index.d.ts +11 -0
  19. package/lib/Signal/Group/index.js +57 -0
  20. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  21. package/lib/Signal/Group/keyhelper.js +55 -0
  22. package/lib/Signal/Group/queue-job.d.ts +1 -0
  23. package/lib/Signal/Group/queue-job.js +57 -0
  24. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  25. package/lib/Signal/Group/sender-chain-key.js +34 -0
  26. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  27. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  28. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  29. package/lib/Signal/Group/sender-key-message.js +69 -0
  30. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  31. package/lib/Signal/Group/sender-key-name.js +51 -0
  32. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  33. package/lib/Signal/Group/sender-key-record.js +53 -0
  34. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  35. package/lib/Signal/Group/sender-key-state.js +99 -0
  36. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  37. package/lib/Signal/Group/sender-message-key.js +29 -0
  38. package/lib/Signal/libsignal.d.ts +3 -0
  39. package/lib/Signal/libsignal.js +174 -0
  40. package/lib/Socket/Client/index.d.ts +2 -0
  41. package/lib/Socket/Client/index.js +18 -0
  42. package/lib/Socket/Client/types.d.ts +16 -0
  43. package/lib/Socket/Client/types.js +13 -0
  44. package/lib/Socket/Client/websocket.d.ts +13 -0
  45. package/lib/Socket/Client/websocket.js +111 -0
  46. package/lib/Socket/business.d.ts +172 -0
  47. package/lib/Socket/business.js +260 -0
  48. package/lib/Socket/chats.d.ts +85 -0
  49. package/lib/Socket/chats.js +1094 -0
  50. package/lib/Socket/groups.d.ts +124 -0
  51. package/lib/Socket/groups.js +423 -0
  52. package/lib/Socket/index.d.ts +172 -0
  53. package/lib/Socket/index.js +32 -0
  54. package/lib/Socket/messages-interactive.js +259 -0
  55. package/lib/Socket/messages-recv.d.ts +161 -0
  56. package/lib/Socket/messages-recv.js +1518 -0
  57. package/lib/Socket/messages-send.d.ts +151 -0
  58. package/lib/Socket/messages-send.js +1085 -0
  59. package/lib/Socket/newsletter.d.ts +136 -0
  60. package/lib/Socket/newsletter.js +250 -0
  61. package/lib/Socket/socket.d.ts +43 -0
  62. package/lib/Socket/socket.js +1269 -0
  63. package/lib/Socket/usync.d.ts +36 -0
  64. package/lib/Socket/usync.js +123 -0
  65. package/lib/Store/index.d.ts +2 -0
  66. package/lib/Store/index.js +8 -0
  67. package/lib/Store/make-in-memory-store.d.ts +118 -0
  68. package/lib/Store/make-in-memory-store.js +499 -0
  69. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  70. package/lib/Store/make-ordered-dictionary.js +81 -0
  71. package/lib/Store/object-repository.d.ts +10 -0
  72. package/lib/Store/object-repository.js +27 -0
  73. package/lib/Types/Auth.d.ts +114 -0
  74. package/lib/Types/Auth.js +2 -0
  75. package/lib/Types/Call.d.ts +13 -0
  76. package/lib/Types/Call.js +2 -0
  77. package/lib/Types/Chat.d.ts +109 -0
  78. package/lib/Types/Chat.js +4 -0
  79. package/lib/Types/Contact.d.ts +29 -0
  80. package/lib/Types/Contact.js +2 -0
  81. package/lib/Types/Events.d.ts +199 -0
  82. package/lib/Types/Events.js +2 -0
  83. package/lib/Types/GroupMetadata.d.ts +64 -0
  84. package/lib/Types/GroupMetadata.js +2 -0
  85. package/lib/Types/Label.d.ts +35 -0
  86. package/lib/Types/Label.js +27 -0
  87. package/lib/Types/LabelAssociation.d.ts +29 -0
  88. package/lib/Types/LabelAssociation.js +9 -0
  89. package/lib/Types/Message.d.ts +741 -0
  90. package/lib/Types/Message.js +7 -0
  91. package/lib/Types/Newsletter.d.ts +22 -0
  92. package/lib/Types/Newsletter.js +18 -0
  93. package/lib/Types/Product.d.ts +78 -0
  94. package/lib/Types/Product.js +2 -0
  95. package/lib/Types/Signal.d.ts +63 -0
  96. package/lib/Types/Signal.js +2 -0
  97. package/lib/Types/Socket.d.ts +134 -0
  98. package/lib/Types/Socket.js +2 -0
  99. package/lib/Types/State.d.ts +27 -0
  100. package/lib/Types/State.js +2 -0
  101. package/lib/Types/USync.d.ts +25 -0
  102. package/lib/Types/USync.js +2 -0
  103. package/lib/Types/index.d.ts +65 -0
  104. package/lib/Types/index.js +43 -0
  105. package/lib/Utils/auth-utils.d.ts +18 -0
  106. package/lib/Utils/auth-utils.js +209 -0
  107. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  108. package/lib/Utils/baileys-event-stream.js +63 -0
  109. package/lib/Utils/business.d.ts +22 -0
  110. package/lib/Utils/business.js +234 -0
  111. package/lib/Utils/cache-manager.d.ts +16 -0
  112. package/lib/Utils/cache-manager.js +137 -0
  113. package/lib/Utils/chat-utils.d.ts +70 -0
  114. package/lib/Utils/chat-utils.js +734 -0
  115. package/lib/Utils/crypto.d.ts +40 -0
  116. package/lib/Utils/crypto.js +193 -0
  117. package/lib/Utils/decode-wa-message.d.ts +35 -0
  118. package/lib/Utils/decode-wa-message.js +207 -0
  119. package/lib/Utils/event-buffer.d.ts +35 -0
  120. package/lib/Utils/event-buffer.js +624 -0
  121. package/lib/Utils/generics.d.ts +89 -0
  122. package/lib/Utils/generics.js +448 -0
  123. package/lib/Utils/history.d.ts +19 -0
  124. package/lib/Utils/history.js +94 -0
  125. package/lib/Utils/index.d.ts +22 -0
  126. package/lib/Utils/index.js +38 -0
  127. package/lib/Utils/jid-validation.d.ts +2 -0
  128. package/lib/Utils/jid-validation.js +186 -0
  129. package/lib/Utils/link-preview.d.ts +21 -0
  130. package/lib/Utils/link-preview.js +152 -0
  131. package/lib/Utils/logger.d.ts +11 -0
  132. package/lib/Utils/logger.js +59 -0
  133. package/lib/Utils/lt-hash.d.ts +12 -0
  134. package/lib/Utils/lt-hash.js +51 -0
  135. package/lib/Utils/make-mutex.d.ts +7 -0
  136. package/lib/Utils/make-mutex.js +43 -0
  137. package/lib/Utils/messages-media.d.ts +120 -0
  138. package/lib/Utils/messages-media.js +848 -0
  139. package/lib/Utils/messages.d.ts +131 -0
  140. package/lib/Utils/messages.js +1843 -0
  141. package/lib/Utils/newsletter-utils.d.ts +2 -0
  142. package/lib/Utils/newsletter-utils.js +48 -0
  143. package/lib/Utils/noise-handler.d.ts +19 -0
  144. package/lib/Utils/noise-handler.js +150 -0
  145. package/lib/Utils/performance-config.d.ts +70 -0
  146. package/lib/Utils/performance-config.js +183 -0
  147. package/lib/Utils/process-message.d.ts +42 -0
  148. package/lib/Utils/process-message.js +498 -0
  149. package/lib/Utils/rate-limiter.js +90 -0
  150. package/lib/Utils/retry.js +66 -0
  151. package/lib/Utils/signal.d.ts +33 -0
  152. package/lib/Utils/signal.js +153 -0
  153. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  154. package/lib/Utils/use-multi-file-auth-state.js +129 -0
  155. package/lib/Utils/validate-connection.d.ts +10 -0
  156. package/lib/Utils/validate-connection.js +233 -0
  157. package/lib/WABinary/constants.d.ts +27 -0
  158. package/lib/WABinary/constants.js +1303 -0
  159. package/lib/WABinary/decode.d.ts +6 -0
  160. package/lib/WABinary/decode.js +279 -0
  161. package/lib/WABinary/encode.d.ts +2 -0
  162. package/lib/WABinary/encode.js +264 -0
  163. package/lib/WABinary/generic-utils.d.ts +14 -0
  164. package/lib/WABinary/generic-utils.js +114 -0
  165. package/lib/WABinary/index.d.ts +5 -0
  166. package/lib/WABinary/index.js +21 -0
  167. package/lib/WABinary/jid-utils.d.ts +38 -0
  168. package/lib/WABinary/jid-utils.js +402 -0
  169. package/lib/WABinary/types.d.ts +18 -0
  170. package/lib/WABinary/types.js +2 -0
  171. package/lib/WAM/BinaryInfo.d.ts +8 -0
  172. package/lib/WAM/BinaryInfo.js +13 -0
  173. package/lib/WAM/constants.d.ts +38 -0
  174. package/lib/WAM/constants.js +15350 -0
  175. package/lib/WAM/encode.d.ts +2 -0
  176. package/lib/WAM/encode.js +155 -0
  177. package/lib/WAM/index.d.ts +3 -0
  178. package/lib/WAM/index.js +19 -0
  179. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  180. package/lib/WAUSync/Protocols/USyncContactProtocol.js +102 -0
  181. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  182. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +110 -0
  183. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  184. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  185. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  186. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  187. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  188. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  189. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  190. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  191. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  192. package/lib/WAUSync/Protocols/index.js +20 -0
  193. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  194. package/lib/WAUSync/USyncQuery.js +147 -0
  195. package/lib/WAUSync/USyncUser.d.ts +12 -0
  196. package/lib/WAUSync/USyncUser.js +26 -0
  197. package/lib/WAUSync/index.d.ts +3 -0
  198. package/lib/WAUSync/index.js +19 -0
  199. package/lib/index.d.ts +17 -0
  200. package/lib/index.js +53 -0
  201. package/package.json +109 -0
package/README.MD ADDED
@@ -0,0 +1,2227 @@
1
+ <div align="center">
2
+
3
+ ![Wave](https://capsule-render.vercel.app/api?type=waving&color=gradient&customColorList=24&height=150&section=header&text=based&fontSize=60&fontColor=ffffff&animation=fadeIn&fontAlignY=35)
4
+ <img src="https://i.gifer.com/YdBN.gif" width="200">
5
+
6
+ ![Retro](https://readme-typing-svg.herokuapp.com?font=VT323&size=24&duration=2500&pause=10000&color=8A2BE2&center=true&vCenter=true&width=250&height=25&lines=$+by+Sam+aka+Vare)
7
+ <br>
8
+ <p align="center">
9
+ <img src="https://img.shields.io/npm/v/@realvare/baileys?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="NPM Version">
10
+ <img src="https://img.shields.io/npm/dm/@realvare/baileys?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="NPM Downloads">
11
+ <img src="https://img.shields.io/badge/License-MIT-8a2be2.svg?style=for-the-badge&labelColor=2d1b69" alt="MIT License">
12
+ <img src="https://img.shields.io/github/stars/realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="GitHub Stars">
13
+ <img src="https://img.shields.io/github/forks/realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="GitHub Forks">
14
+ </p>
15
+ <p align="center">
16
+ <a href="#-main-features"><img src="https://img.shields.io/badge/_Features-8a2be2?style=flat-square&logo=github&logoColor=white"/></a>&nbsp;&nbsp;
17
+ <a href="#-installation"><img src="https://img.shields.io/badge/_Installation-8a2be2?style=flat-square&logo=npm&logoColor=white"/></a>&nbsp;&nbsp;
18
+ <a href="#-quick-guide"><img src="https://img.shields.io/badge/_Quick_Guide-8a2be2?style=flat-square&logo=rocket&logoColor=white"/></a>&nbsp;&nbsp;
19
+ <a href="#-api-documentation"><img src="https://img.shields.io/badge/_API_Documentation-8a2be2?style=flat-square&logo=book&logoColor=white"/></a>&nbsp;&nbsp;
20
+ <a href="#-support-and-community"><img src="https://img.shields.io/badge/_Support-8a2be2?style=flat-square&logo=teamspeak&logoColor=white"/></a>
21
+ </p>
22
+ <img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=20&duration=4000&pause=2500&color=8A2BE2&center=true&vCenter=true&width=800&lines=💜+A+modern%2C+powerful+and+fast+WhatsApp+Web+API+library;🔄+With+support+for+LID%2FJID+and+multi-device;">
23
+
24
+ ----
25
+
26
+ </div>
27
+
28
+ ## Table of Contents
29
+
30
+ - [Table of Contents](#table-of-contents)
31
+ - [🚀 Performance Optimization Guide](#-performance-optimization-guide)
32
+ - [🎯 Performance Optimizations](#-performance-optimizations)
33
+ - [🔧 JID/LID Validation and Normalization](#-jidlid-validation-and-normalization)
34
+ - [📈 Key Benefits](#-key-benefits)
35
+ - [🎛️ Usage Example](#️-usage-example)
36
+ - [💡 Best Practices](#-best-practices)
37
+ - [✨ Main Features](#-main-features)
38
+ - [🚀 Quick Guide](#-quick-guide)
39
+ - [Basic Example - Starting Bot](#basic-example---starting-bot)
40
+ - [Anti-Ban Example - Recommended Configuration to Avoid Bans](#anti-ban-example---recommended-configuration-to-avoid-bans)
41
+ - [📊 Advanced Cache Management](#-advanced-cache-management)
42
+ - [Advanced Cache Configuration](#advanced-cache-configuration)
43
+ - [🔍 Troubleshooting](#-troubleshooting)
44
+ - [Connection Issues](#connection-issues)
45
+ - [Memory Management](#memory-management)
46
+ - [Advanced Logging](#advanced-logging)
47
+ - [Basic Message Management with LID/JID](#basic-message-management-with-lidjid)
48
+ - [📚 API Documentation](#-api-documentation)
49
+ - [🏗️ Fundamental Methods](#️-fundamental-methods)
50
+ - [🎯 Main Events](#-main-events)
51
+ - [🎪 Messages and Interactive Features](#-messages-and-interactive-features)
52
+ - [Basic Messages](#basic-messages)
53
+ - [Text with Formatting](#text-with-formatting)
54
+ - [Basic Media](#basic-media)
55
+ - [Advanced Media](#advanced-media)
56
+ - [Stickers](#stickers)
57
+ - [Sticker Packs](#sticker-packs)
58
+ - [Stickers on Status (2025 Feature)](#stickers-on-status-2025-feature)
59
+ - [Interactive Messages](#interactive-messages)
60
+ - [Messages with Simple Buttons](#messages-with-simple-buttons)
61
+ - [Messages with Buttons and Image](#messages-with-buttons-and-image)
62
+ - [List Messages](#list-messages)
63
+ - [Collection Messages (Catalog)](#collection-messages-catalog)
64
+ - [Invoice Messages](#invoice-messages)
65
+ - [Carousel Messages with Card Types](#carousel-messages-with-card-types)
66
+ - [Interactive Messages with Audio Footer](#interactive-messages-with-audio-footer)
67
+ - [Interactive Messages with Product Header](#interactive-messages-with-product-header)
68
+ - [Interactive Response Messages](#interactive-response-messages)
69
+ - [Poll Messages](#poll-messages)
70
+ - [Poll Result Snapshot](#poll-result-snapshot)
71
+ - [Poll Update](#poll-update)
72
+ - [Comment Messages](#comment-messages)
73
+ - [Question Messages](#question-messages)
74
+ - [Question Response Messages](#question-response-messages)
75
+ - [Status Question Answer Messages](#status-question-answer-messages)
76
+ - [Status Quoted Messages](#status-quoted-messages)
77
+ - [Status Sticker Interaction Messages](#status-sticker-interaction-messages)
78
+ - [AI Rich Response Messages](#ai-rich-response-messages)
79
+ - [New Interactive Features (2025)](#new-interactive-features-2025)
80
+ - [Other Messages](#other-messages)
81
+ - [Business Call Messages (BCall)](#business-call-messages-bcall)
82
+ - [Call Log Messages](#call-log-messages)
83
+ - [Event Response Messages](#event-response-messages)
84
+ - [Status Mention Messages](#status-mention-messages)
85
+ - [Group Status Messages](#group-status-messages)
86
+ - [Bot Task Messages](#bot-task-messages)
87
+ - [Limit Sharing Messages](#limit-sharing-messages)
88
+ - [Status Add Yours Messages](#status-add-yours-messages)
89
+ - [Bot Forwarded Messages](#bot-forwarded-messages)
90
+ - [Event Cover Image Messages](#event-cover-image-messages)
91
+ - [Poll Creation Message V4](#poll-creation-message-v4)
92
+ - [Poll Creation Message V5](#poll-creation-message-v5)
93
+ - [Poll Result Snapshot Message V3](#poll-result-snapshot-message-v3)
94
+ - [Encrypted Comment Messages](#encrypted-comment-messages)
95
+ - [Encrypted Event Response Messages](#encrypted-event-response-messages)
96
+ - [Message History Bundle](#message-history-bundle)
97
+ - [Message History Notice](#message-history-notice)
98
+ - [Newsletter Follower Invite](#newsletter-follower-invite)
99
+ - [Placeholder Messages](#placeholder-messages)
100
+ - [Secret Encrypted Messages](#secret-encrypted-messages)
101
+ - [Status Notification Messages](#status-notification-messages)
102
+ - [Sticker Sync RMR Messages](#sticker-sync-rmr-messages)
103
+ - [Send Payment](#send-payment)
104
+ - [Decline Payment Request](#decline-payment-request)
105
+ - [Cancel Payment Request](#cancel-payment-request)
106
+ - [Scheduled Call Creation](#scheduled-call-creation)
107
+ - [Scheduled Call Edit](#scheduled-call-edit)
108
+ - [Pin/Unpin Messages](#pinunpin-messages)
109
+ - [🎭 Group Features](#-group-features)
110
+ - [Basic Group Management](#basic-group-management)
111
+ - [Participant Management](#participant-management)
112
+ - [Group Settings](#group-settings)
113
+ - [Advanced Group Messages](#advanced-group-messages)
114
+ - [🔧 Fix LID/JID in Your Own Main and Handler](#-fix-lidjid-in-your-own-main-and-handler)
115
+ - [Best Practices for LID/JID](#best-practices-for-lidjid)
116
+ - [Integrated Example in Main](#integrated-example-in-main)
117
+ - [Custom Handler Example](#custom-handler-example)
118
+ - [🚀 Smart LID/JID Cache](#-smart-lidjid-cache)
119
+ - [🛡️ Advanced JID Validation](#️-advanced-jid-validation)
120
+ - [📊 Conditional Logging](#-conditional-logging)
121
+ - [🔧 Performance Configuration](#-performance-configuration)
122
+ - [🧩 Events: LID and JID always available (new)](#-events-lid-and-jid-always-available-new)
123
+ - [Gestione dei Messaggi (`messages.upsert`)](#gestione-dei-messaggi-messagesupsert)
124
+ - [Gestione dei Partecipanti di Gruppo (`group-participants.update`)](#gestione-dei-partecipanti-di-gruppo-group-participantsupdate)
125
+ - [⚙️ Advanced Configuration](#️-advanced-configuration)
126
+ - [🔧 Complete Options for makeWASocket](#-complete-options-for-makewasocket)
127
+ - [🛡️ Security and Encryption](#️-security-and-encryption)
128
+ - [🌐 Support and Community](#-support-and-community)
129
+ - [📞 Contacts and Resources](#-contacts-and-resources)
130
+ - [🙏 Acknowledgments](#-acknowledgments)
131
+ - [⚠️ Disclaimer \& License](#️-disclaimer--license)
132
+ - [📋 Legal Note](#-legal-note)
133
+ - [📜 MIT License](#-mit-license)
134
+
135
+ ----
136
+
137
+ ## 🚀 Performance Optimization Guide
138
+
139
+ This section explains the built-in performance optimizations and JID/LID validation improvements.
140
+
141
+ ### 🎯 Performance Optimizations
142
+
143
+ The library now includes comprehensive performance optimizations with these default settings:
144
+
145
+ ```javascript
146
+ // Performance settings
147
+ {
148
+ enableCache: true, // Enable caching for faster data retrieval
149
+ batchSize: 50, // Process messages in batches of 50
150
+ maxRetries: 5, // Maximum reconnection attempts
151
+ retryDelay: 5000, // Initial retry delay (5 seconds)
152
+ retryBackoffMultiplier: 1.5, // Exponential backoff multiplier
153
+ maxRetryDelay: 60000, // Maximum retry delay (60 seconds)
154
+ syncFullHistory: false, // Disable full history sync to prevent slowdowns
155
+ enableLidLogging: true, // Enable LID logging for debugging
156
+ logLevel: 'debug' // Detailed logging for troubleshooting
157
+ }
158
+
159
+ // Cache settings
160
+ {
161
+ lidCache: {
162
+ ttl: 300000, // 5 minutes TTL
163
+ maxSize: 10000, // Maximum 10,000 entries
164
+ cleanupInterval: 120000 // Cleanup every 2 minutes
165
+ },
166
+ jidCache: {
167
+ ttl: 300000, // 5 minutes TTL
168
+ maxSize: 10000, // Maximum 10,000 entries
169
+ cleanupInterval: 120000 // Cleanup every 2 minutes
170
+ },
171
+ lidToJidCache: {
172
+ ttl: 300000, // 5 minutes TTL
173
+ maxSize: 5000, // Maximum 5,000 entries
174
+ cleanupInterval: 180000 // Cleanup every 3 minutes
175
+ },
176
+ groupMetadataCache: {
177
+ ttl: 600000, // 10 minutes TTL
178
+ maxSize: 2000, // Maximum 2,000 entries
179
+ cleanupInterval: 300000 // Cleanup every 5 minutes
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### 🔧 JID/LID Validation and Normalization
185
+
186
+ The library includes comprehensive JID/LID validation utilities:
187
+
188
+ ```javascript
189
+ const { validateJid, getSenderLid, toJid, normalizeJid, isValidJid } = require('@realvare/baileys');
190
+
191
+ // Validate JID with detailed error information
192
+ const result = validateJid('1234567890@s.whatsapp.net');
193
+ console.log(result.isValid, result.error);
194
+
195
+ // Extract sender information from messages
196
+ const sender = getSenderLid(message);
197
+ console.log(sender.jid, sender.lid, sender.user, sender.isValid, sender.timestamp, sender.error);
198
+
199
+ // Convert LID to JID format
200
+ const jid = toJid('1234567890@lid'); // Returns '1234567890@s.whatsapp.net'
201
+
202
+ // Normalize JID format
203
+ const normalized = normalizeJid('1234567890@lid'); // Returns '1234567890@s.whatsapp.net'
204
+
205
+ // Simple validation check
206
+ const isValid = isValidJid('1234567890@s.whatsapp.net');
207
+ ```
208
+
209
+ **Events behavior**: all emitted events (e.g. `messages.upsert`, `messages.update`, `group-participants.update`) will expose standard JIDs (`@s.whatsapp.net`, `@g.us`, etc.) in `msg.key.remoteJid` and `msg.key.participant` whenever possible. When WhatsApp provides LIDs, the original values are preserved in `msg.key.remoteLid` and `msg.key.participantLid`.
210
+
211
+ ### 📈 Key Benefits
212
+
213
+ **Performance Improvements:**
214
+ - ✅ **Reduced Latency**: Caching reduces repeated API calls by 80-90%
215
+ - ✅ **Better Throughput**: Batch processing handles message bursts efficiently
216
+ - ✅ **Improved Stability**: Exponential backoff prevents rapid reconnection attempts
217
+ - ✅ **Lower Ban Risk**: Disabled full history sync and reduced online presence marking
218
+
219
+ **Error Reduction:**
220
+ - ✅ **JID/LID Validation**: Prevents undefined errors from invalid IDs
221
+ - ✅ **Automatic Conversion**: Handles WhatsApp's LID format changes seamlessly
222
+ - ✅ **Detailed Logging**: Helps identify and debug ID-related issues
223
+ - ✅ **Graceful Fallback**: Maintains functionality even with invalid IDs
224
+
225
+ ### 🎛️ Usage Example
226
+
227
+ ```javascript
228
+ const { makeWASocket, useMultiFileAuthState, setPerformanceConfig, PerformanceConfig } = require('@realvare/baileys');
229
+
230
+ // Set up authentication
231
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
232
+
233
+ // Configure performance settings
234
+ const performanceConfig = new PerformanceConfig();
235
+
236
+ // Customize settings (optional)
237
+ performanceConfig.updatePerformanceConfig({
238
+ batchSize: 50,
239
+ maxRetries: 5,
240
+ retryDelay: 5000,
241
+ retryBackoffMultiplier: 1.5,
242
+ syncFullHistory: false
243
+ });
244
+
245
+ // Apply configuration
246
+ setPerformanceConfig(performanceConfig);
247
+
248
+ // Create socket
249
+ const sock = makeWASocket({
250
+ auth: state,
251
+ printQRInTerminal: true
252
+ });
253
+ ```
254
+
255
+ ### 💡 Best Practices
256
+
257
+ 1. **Always validate JIDs** before processing messages
258
+ 2. **Enable caching** for production environments
259
+ 3. **Disable syncFullHistory** to prevent performance issues
260
+ 4. **Use exponential backoff** for reconnection attempts
261
+ 5. **Monitor cache metrics** to optimize TTL and size settings
262
+ 6. **Implement proper error handling** for invalid JIDs/LIDs
263
+
264
+ ## ✨ Main Features
265
+
266
+ <p align="center">
267
+ <img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=18&duration=2500&pause=2500&color=8A2BE2&center=true&vCenter=true&width=600&lines=🚀+Powerful+and+Intuitive;🔧+Based+on+Baileys+with+Improvements" alt="Features">
268
+ </p>
269
+
270
+ <br>
271
+
272
+ This library, based on Baileys with specific improvements, offers an intuitive API to interact with WhatsApp Web. Here is a summary of the key features:
273
+
274
+ <table align="center">
275
+ <tr>
276
+ <td align="center" width="25%">
277
+ <h3>🔄 Core Features</h3>
278
+ <p>• Intelligent LID/JID mapping<br>• Multi-device support<br>• E2E Signal encryption<br>• Modern TypeScript</p>
279
+ </td>
280
+ <td align="center" width="25%">
281
+ <h3>💬 Messages</h3>
282
+ <p>• Text, media, interactive<br>• Buttons, lists, albums<br>• Polls, reactions<br>• Advanced templates</p>
283
+ </td>
284
+ <td align="center" width="25%">
285
+ <h3>🛠️ Developer</h3>
286
+ <p>• Real-time events<br>• Full TypeScript<br>• Extensive documentation<br>• Extensible APIs</p>
287
+ </td>
288
+ <td align="center" width="25%">
289
+ <h3>⚡ Performance</h3>
290
+ <p>• Intelligent reconnection<br>• Advanced TTL cache<br>• Performance monitoring</p>
291
+ </td>
292
+ </tr>
293
+ </table>
294
+ <p align="center">
295
+ <img src="https://64.media.tumblr.com/13bc9e3c3b332dfc008cb4b9e8571558/2a577b39b15547dc-cc/s400x600/3db051b3117b695a61ad8e0b686f2774b971d210.gifv" width="800">
296
+
297
+
298
+ ## 🚀 Quick Guide
299
+
300
+ - This section includes basic examples for authentication and connection management.
301
+
302
+ ### Basic Example - Starting Bot
303
+
304
+ ```typescript
305
+ import makeWASocket, { DisconnectReason, useMultiFileAuthState, getPerformanceConfig, setPerformanceConfig } from '@realvare/baileys';
306
+
307
+ // Configure performance and cache
308
+ setPerformanceConfig({
309
+ performance: {
310
+ enableCache: true,
311
+ enableMetrics: true
312
+ },
313
+ debug: {
314
+ enableLidLogging: true,
315
+ logLevel: 'info'
316
+ }
317
+ });
318
+
319
+ async function startBot() {
320
+ // 🔐 Multi-file authentication setup for persistent sessions
321
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
322
+
323
+ // 🌐 Socket creation with basic configuration
324
+ const sock = makeWASocket({
325
+ auth: state,
326
+ printQRInTerminal: true,
327
+ logger: console,
328
+ browser: ['VareBot', 'Chrome', '4.0.0'],
329
+ });
330
+
331
+ // Improved reconnection system
332
+ let reconnectAttempts = 0;
333
+ const config = getPerformanceConfig();
334
+
335
+ sock.ev.on('connection.update', (update) => {
336
+ const { connection, lastDisconnect } = update;
337
+
338
+ if (connection === 'close') {
339
+ const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
340
+
341
+ if (shouldReconnect) {
342
+ reconnectAttempts++;
343
+ const delay = Math.min(
344
+ config.performance.retryDelay * Math.pow(
345
+ config.performance.retryBackoffMultiplier,
346
+ reconnectAttempts - 1
347
+ ),
348
+ config.performance.maxRetryDelay
349
+ );
350
+
351
+ console.log(`🔄 Reconnection attempt ${reconnectAttempts}/${config.performance.maxRetries} in ${delay}ms`);
352
+
353
+ if (reconnectAttempts <= config.performance.maxRetries) {
354
+ setTimeout(startBot, delay);
355
+ } else {
356
+ console.log('❌ Maximum number of reconnection attempts reached');
357
+ }
358
+ }
359
+ } else if (connection === 'open') {
360
+ console.log('🟢 Connected successfully!');
361
+ reconnectAttempts = 0;
362
+ }
363
+ });
364
+
365
+ sock.ev.on('creds.update', saveCreds);
366
+ }startBot().catch(console.error);
367
+ ```
368
+
369
+ ### Anti-Ban Example - Recommended Configuration to Avoid Bans
370
+
371
+ ```typescript
372
+ import makeWASocket, { DisconnectReason, useMultiFileAuthState, getPerformanceConfig, setPerformanceConfig, getSenderLid, validateJid } from '@realvare/baileys';
373
+
374
+ // Anti-ban configuration to reduce ban risks from improper acks
375
+ setPerformanceConfig({
376
+ performance: {
377
+ enableCache: true, // Enable TTL cache to reduce API calls
378
+ enableMetrics: true, // Monitor performance to avoid overload
379
+ batchSize: 50, // Process messages in smaller batches to simulate human speed
380
+ maxRetries: 5, // Limit retry attempts to avoid aggressive behavior
381
+ retryDelay: 5000, // Base delay in ms for reconnections
382
+ retryBackoffMultiplier: 1.5,// Exponential backoff to space retries
383
+ maxRetryDelay: 60000, // Maximum delay to avoid rapid reconnections
384
+ maxMsgRetryCount: 3 // Limit message resend attempts
385
+ }
386
+ });
387
+
388
+ async function startBot() {
389
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
390
+
391
+ const sock = makeWASocket({
392
+ auth: state,
393
+ printQRInTerminal: true,
394
+ logger: console,
395
+ browser: ['YourBotName', 'Chrome', '4.0.0'], // Customize browser fingerprint
396
+ markOnlineOnConnect: false, // Crucial: Prevents always appearing online, reduces ban risk
397
+ syncFullHistory: false // Avoid syncing unnecessary data that could signal activity
398
+ });
399
+
400
+ let reconnectAttempts = 0;
401
+ const config = getPerformanceConfig();
402
+
403
+ sock.ev.on('connection.update', (update) => {
404
+ const { connection, lastDisconnect } = update;
405
+
406
+ if (connection === 'close') {
407
+ const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
408
+
409
+ if (shouldReconnect) {
410
+ reconnectAttempts++;
411
+ const delay = Math.min(
412
+ config.performance.retryDelay * Math.pow(
413
+ config.performance.retryBackoffMultiplier,
414
+ reconnectAttempts - 1
415
+ ),
416
+ config.performance.maxRetryDelay
417
+ );
418
+
419
+ console.log(`Reconnecting attempt ${reconnectAttempts}/${config.performance.maxRetries} in ${delay}ms`);
420
+
421
+ if (reconnectAttempts <= config.performance.maxRetries) {
422
+ setTimeout(startBot, delay);
423
+ } else {
424
+ console.log('Max reconnection attempts reached');
425
+ }
426
+ }
427
+ } else if (connection === 'open') {
428
+ console.log('Connected successfully!');
429
+ reconnectAttempts = 0;
430
+ }
431
+ });
432
+
433
+ // Monitor acks through message updates to ensure proper handling
434
+ sock.ev.on('messages.update', (updates) => {
435
+ for (const update of updates) {
436
+ if (update.update.status) {
437
+ console.log(`Message ${update.key.id} status: ${update.update.status}`); // Track acks (1=sent, 2=delivered, 3=read)
438
+ // Add custom logic if necessary, but avoid overriding defaults to prevent detection
439
+ }
440
+ }
441
+ });
442
+
443
+ // Advanced LID/JID utilities for ack stability
444
+ sock.ev.on('messages.upsert', ({ messages }) => {
445
+ for (const msg of messages) {
446
+ const info = getSenderLid(msg);
447
+ const validation = validateJid(info.jid);
448
+ if (validation.isValid) {
449
+ // Process and ack safely
450
+ console.log(`Valid JID: ${info.jid}, LID: ${info.lid}`);
451
+ } else {
452
+ console.warn(`Invalid JID detected: ${info.jid}`);
453
+ }
454
+ }
455
+ });
456
+
457
+ sock.ev.on('creds.update', saveCreds);
458
+ }
459
+
460
+ startBot().catch(console.error);
461
+ ```
462
+
463
+ ## 📊 Advanced Cache Management
464
+
465
+ The library now includes an advanced cache system with automatic memory management and configurable TTL:
466
+
467
+ ```typescript
468
+ import { CacheManager } from '@realvare/baileys';
469
+
470
+ // Example of using the cache
471
+ const cache = CacheManager;
472
+
473
+ // Save a value in the cache
474
+ cache.set('lidCache', 'key', 'value', 300); // TTL of 300 seconds
475
+
476
+ // Retrieve a value
477
+ const value = cache.get('lidCache', 'key');
478
+
479
+ // Get cache statistics
480
+ const stats = cache.getStats('lidCache');
481
+ console.log('Cache statistics:', stats);
482
+ ```
483
+
484
+ ### Advanced Cache Configuration
485
+
486
+ The cache can be configured with various options to optimize performance:
487
+
488
+ ```typescript
489
+ setPerformanceConfig({
490
+ cache: {
491
+ lidCache: {
492
+ ttl: 5 * 60 * 1000, // Entry lifetime
493
+ maxSize: 10000, // Maximum number of entries
494
+ cleanupInterval: 2 * 60 * 1000 // Cleanup interval
495
+ }
496
+ },
497
+ performance: {
498
+ memoryThreshold: 0.85 // Threshold for automatic cleanup
499
+ }
500
+ });
501
+ ```
502
+ ## 🔍 Troubleshooting
503
+
504
+ ### Connection Issues
505
+ - The library now implements a retry system with exponential backoff
506
+ - Automatic monitoring of connection status
507
+ - Configurable reconnection attempts
508
+
509
+ ### Memory Management
510
+ - Automatic monitoring of memory usage
511
+ - Automatic cache cleanup when necessary
512
+ - Configurable TTL for each cache type
513
+
514
+ ### Advanced Logging
515
+ ```typescript
516
+ setPerformanceConfig({
517
+ debug: {
518
+ enableLidLogging: true,
519
+ enablePerformanceLogging: true,
520
+ logLevel: 'debug'
521
+ }
522
+ });
523
+ ```
524
+
525
+ ### Basic Message Management with LID/JID
526
+
527
+ ```typescript
528
+ import makeWASocket, { getSenderLid, toJid, getCacheStats, validateJid, Logger } from '@realvare/baileys';
529
+
530
+ // ... (sock creation code here)
531
+
532
+ conn.ev.on('messages.upsert', ({ messages }) => {
533
+ for (const msg of messages) {
534
+ // 🔍 Extract sender LID with validation
535
+ const info = getSenderLid(msg);
536
+
537
+ // ✅ Validate JID before using it
538
+ const validation = validateJid(info.jid);
539
+ if (!validation.isValid) {
540
+ Logger.error('Invalid JID:', validation.error);
541
+ continue;
542
+ }
543
+
544
+ const jid = toJid(info.lid); // Normalize to JID
545
+
546
+ Logger.info('💬 Message from:', jid, 'Valid:', info.isValid);
547
+ console.log('📝 Content:', msg.message?.conversation);
548
+
549
+ // Automatically reply only if valid
550
+ if (info.isValid) {
551
+ conn.sendMessage(jid, { text: 'Message received!' });
552
+ }
553
+ }
554
+
555
+ // 📊 Monitor cache performance
556
+ const stats = getCacheStats();
557
+ Logger.performance('Cache stats:', stats);
558
+ });
559
+ ```
560
+
561
+ ---
562
+
563
+ ## 📚 API Documentation
564
+
565
+ This section expands on the main methods, with detailed examples and parameters. All methods are typed in TypeScript for a safe development experience.
566
+
567
+ ### 🏗️ Fundamental Methods
568
+
569
+ | Method | Description | Import |
570
+ |--------|-------------|--------|
571
+ | `makeWASocket(config)` | **Core**: Creates WhatsApp socket | ✅ Included |
572
+ | `useMultiFileAuthState(folder)` | **Auth**: Persistent credentials management | ✅ Included |
573
+ | `getSenderLid(msg)` | **LID**: Extracts LID from message | ✅ Included |
574
+ | `toJid(lid)` | **JID**: Converts LID → JID | ✅ Included |
575
+ | `validateJid(jid)` | **Validation**: Verifies JID | ✅ Included |
576
+ | `getCacheStats()` | **Performance**: Cache statistics | ✅ Included |
577
+ | `clearCache()` | **Cleanup**: Clears cache | ✅ Included |
578
+ | `setPerformanceConfig(config)` | **Config**: Customizes performance | ✅ Included |
579
+
580
+ **🔥 Note**: All the above methods are **ready to use** and shown in the Quick Guide. Go directly to the advanced sections for specific features!
581
+
582
+ ---
583
+
584
+ ### 🎯 Main Events
585
+
586
+ | Event | Description | Callback Signature |
587
+ |---------------------|--------------------------------------|-------------------------------------|
588
+ | `connection.update` | Connection status updates | `(update: Partial<ConnectionState>) => void` |
589
+ | `creds.update` | Credentials update | `() => void` |
590
+ | `messages.upsert` | New messages or updates | `({ messages: WAMessage[], type: MessageUpsertType }) => void` |
591
+ | `messages.update` | Changes to existing messages | `(update: WAMessageUpdate[]) => void` |
592
+ | `group-participants.update` | Group participant changes | `(update: GroupParticipantEvent) => void` |
593
+
594
+ **Event Registration Example:**
595
+ ```typescript
596
+ conn.ev.on('group-participants.update', (update) => {
597
+ console.log('Participant updated:', update);
598
+ });
599
+ ```
600
+
601
+ ---
602
+
603
+ ## 🎪 Messages and Interactive Features
604
+
605
+ ### Basic Messages
606
+
607
+ #### Text with Formatting
608
+ ```typescript
609
+ // Text with formatting and mentions
610
+ await conn.sendMessage(jid, {
611
+ text: `*Bold* _italic_ ~strikethrough~ \`monospace\`\n@mention`,
612
+ mentions: ['393476686131@s.whatsapp.net']
613
+ });
614
+ ```
615
+
616
+ #### Basic Media
617
+ ```typescript
618
+ // Image
619
+ await conn.sendMessage(jid, {
620
+ image: { url: './media/varebot.jpg' }, // Also supports Buffer
621
+ caption: 'zwag'
622
+ });
623
+
624
+ // Video
625
+ await conn.sendMessage(jid, {
626
+ video: { url: './media/oppastoppa.mp4' },
627
+ caption: 'brrrr',
628
+ gifPlayback: false // true to play as GIF
629
+ });
630
+
631
+ // Audio
632
+ await conn.sendMessage(jid, {
633
+ audio: { url: './media/audio.mp3' },
634
+ mimetype: 'audio/mp4',
635
+ ptt: true // true for voice message, false for normal audio
636
+ });
637
+
638
+ // Document
639
+ await conn.sendMessage(jid, {
640
+ document: { url: './media/doc.pdf' },
641
+ mimetype: 'application/pdf',
642
+ fileName: 'document.pdf'
643
+ });
644
+ ```
645
+
646
+ #### Advanced Media
647
+
648
+ ```typescript
649
+ // Album (Multiple images)
650
+ await conn.sendMessage(jid, {
651
+ album: imageBuffers.map(buffer => ({ image: buffer })),
652
+ caption: 'ts gettin real'
653
+ });
654
+ ```
655
+
656
+ ##### Sticker Packs
657
+
658
+ ```typescript
659
+ await conn.sendMessage(jid, {
660
+ stickerPack: {
661
+ name: 'My Sticker Pack',
662
+ publisher: 'My Bot',
663
+ description: 'A cool sticker pack', // Optional: pack description
664
+ cover: { url: './cover.webp' }, // Optional: tray icon (uses first sticker if omitted)
665
+ stickerPackId: 'pack-uuid-here', // Optional: auto-generated UUID v4 if not provided
666
+ origin: 2, // Optional: 0 = FIRST_PARTY, 1 = THIRD_PARTY, 2 = USER_CREATED (default)
667
+ caption: 'Check out my stickers!', // Optional
668
+ contextInfo: {}, // Optional
669
+ stickers: [
670
+ {
671
+ sticker: { url: './sticker1.webp' }, // Buffer, URL or stream
672
+ emojis: ['🎉', '🎊'], // Optional: defaults to ['']
673
+ isAnimated: false, // Optional: defaults to false
674
+ isLottie: false, // Optional: defaults to false
675
+ accessibilityLabel: 'Celebration', // Optional: defaults to ''
676
+ mimetype: 'image/webp' // Optional: auto-detected from upload
677
+ // fileName is auto-generated as base64(sha256(sticker)) + '.webp'
678
+ },
679
+ {
680
+ sticker: { url: './sticker2.webp' },
681
+ emojis: ['😄'],
682
+ isAnimated: false
683
+ },
684
+ {
685
+ sticker: Buffer.from(/* webp data */),
686
+ emojis: ['🔥']
687
+ }
688
+ ]
689
+ }
690
+ });
691
+ ```
692
+ ##### Stickers on Status (2025 Feature)
693
+
694
+ The new interactive stickers on Status (e.g., with lyrics or questions) can be sent by sending a sticker to `status@broadcast`.
695
+
696
+ ```typescript
697
+ await conn.sendMessage('status@broadcast', {
698
+ sticker: { url: './sticker.webp' },
699
+ caption: 'Interactive sticker on Status'
700
+ }, { statusJidList: ['user1@s.whatsapp.net', 'user2@s.whatsapp.net'] });
701
+ ```
702
+
703
+ #### Interactive Messages
704
+
705
+ These messages include interactive elements like buttons, lists, polls, carousels, collections, and invoices.
706
+
707
+ ##### Messages with Simple Buttons
708
+
709
+ Send quick reply buttons.
710
+
711
+ ```typescript
712
+ await conn.sendMessage(jid, {
713
+ text: 'Choose an option:',
714
+ footer: 'Footer',
715
+ buttons: [
716
+ { buttonId: 'cmd1', buttonText: { displayText: 'Option 1' }, type: 1 },
717
+ { buttonId: 'cmd2', buttonText: { displayText: 'Option 2' }, type: 1 },
718
+ ],
719
+ });
720
+ ```
721
+
722
+ ##### Messages with Buttons and Image
723
+
724
+ Combine an image with buttons.
725
+
726
+ ```typescript
727
+ await conn.sendMessage(jid, {
728
+ image: { url: 'https://i.ibb.co/hJW7WwxV/varebot.jpg' },
729
+ caption: 'Message with buttons and image',
730
+ footer: 'vare ✧ bot',
731
+ buttons: [
732
+ { buttonId: 'cmd', buttonText: { displayText: 'text1' }, type: 1 },
733
+ ],
734
+ });
735
+ ```
736
+
737
+ ##### List Messages
738
+
739
+ Send a list of options (only in private chats).
740
+
741
+ ```typescript
742
+ await conn.sendMessage(jid, {
743
+ text: 'This is a list!',
744
+ footer: 'purplepurplepurple!',
745
+ title: 'List Title',
746
+ buttonText: 'View List',
747
+ sections: [
748
+ {
749
+ title: 'Section 1',
750
+ rows: [
751
+ { title: 'Option 1', rowId: 'opt1',description: 'Descriptionx' },
752
+ { title: 'Option 2', rowId: 'opt2', description: 'Descriptiony' }
753
+ ]
754
+ },
755
+ ],
756
+ });
757
+ ```
758
+
759
+ ##### Collection Messages (Catalog)
760
+
761
+ Send a collection/catalog message to browse products.
762
+
763
+ ```typescript
764
+ await conn.sendMessage(jid, {
765
+ text: 'Browse our catalog!',
766
+ footer: 'Shop now',
767
+ title: 'Our Products',
768
+ collection: {
769
+ bizJid: 'business@s.whatsapp.net',
770
+ id: 'catalog123',
771
+ messageVersion: 1
772
+ }
773
+ });
774
+ ```
775
+
776
+ ##### Invoice Messages
777
+
778
+ Send an invoice with attachment (image or PDF).
779
+
780
+ ```typescript
781
+ await conn.sendMessage(jid, {
782
+ invoice: {
783
+ note: 'Invoice for your order',
784
+ token: 'invoice_token_123',
785
+ attachmentType: 1, // 0 = IMAGE, 1 = PDF
786
+ attachment: { url: './invoice.pdf' } // or image
787
+ }
788
+ });
789
+ ```
790
+
791
+ ##### Carousel Messages with Card Types
792
+
793
+ Send a carousel of cards with different card types.
794
+
795
+ ```typescript
796
+ await conn.sendMessage(jid, {
797
+ text: 'Check out these options!',
798
+ footer: 'Swipe to see more',
799
+ cards: [
800
+ {
801
+ title: 'Card 1',
802
+ body: 'Description 1',
803
+ footer: 'Footer 1',
804
+ image: { url: './image1.jpg' },
805
+ buttons: [
806
+ { name: 'quick_reply', buttonParamsJson: '{"display_text":"Button 1"}' }
807
+ ]
808
+ },
809
+ {
810
+ title: 'Card 2',
811
+ body: 'Description 2',
812
+ video: { url: './video.mp4' }
813
+ }
814
+ ],
815
+ carouselCardType: 1 // 1 = HSCROLL_CARDS (horizontal scroll), 2 = ALBUM_IMAGE - futureproof
816
+ });
817
+ ```
818
+
819
+ ##### Interactive Messages with Audio Footer
820
+
821
+ Send interactive messages with audio in the footer.
822
+
823
+ ```typescript
824
+ await conn.sendMessage(jid, {
825
+ text: 'Listen to this message!',
826
+ title: 'Audio Message',
827
+ interactiveButtons: [
828
+ { name: 'action1', buttonParamsJson: '{"display_text":"Action"}' }
829
+ ],
830
+ footer: {
831
+ text: 'Footer text',
832
+ audio: { url: './audio.mp3' } // Audio attachment in footer
833
+ }
834
+ });
835
+ ```
836
+
837
+ ##### Interactive Messages with Product Header
838
+
839
+ Send interactive messages with a product in the header.
840
+
841
+ ```typescript
842
+ await conn.sendMessage(jid, {
843
+ text: 'Check out this product!',
844
+ title: 'Featured Product',
845
+ interactiveButtons: [
846
+ { name: 'buy', buttonParamsJson: '{"display_text":"Buy Now"}' }
847
+ ],
848
+ headerProduct: {
849
+ productImage: { url: './product.jpg' },
850
+ productId: 'prod123',
851
+ title: 'Product Name',
852
+ description: 'Product Description',
853
+ currency: 'EUR',
854
+ priceAmount1000: 10000
855
+ }
856
+ });
857
+ ```
858
+
859
+ ##### Interactive Response Messages
860
+
861
+ Send responses to interactive messages (e.g., Native Flow responses).
862
+
863
+ ```typescript
864
+ await conn.sendMessage(jid, {
865
+ interactiveResponse: {
866
+ body: {
867
+ text: 'Response text',
868
+ format: 0 // 0 = DEFAULT, 1 = EXTENSIONS_1
869
+ },
870
+ nativeFlowResponse: {
871
+ name: 'flow_name',
872
+ paramsJson: '{"key":"value"}',
873
+ version: 1
874
+ },
875
+ contextInfo: {
876
+ mentionedJid: [jid]
877
+ }
878
+ }
879
+ });
880
+ ```
881
+
882
+ ##### Poll Messages
883
+
884
+ Create a poll for users to vote on.
885
+
886
+ ```typescript
887
+ await conn.sendMessage(jid, {
888
+ poll: {
889
+ name: 'Favorite Anime?',
890
+ values: ['Aot', 'Bleach', 'Death note'],
891
+ selectableCount: 1 // or >1 for multi-select
892
+ }
893
+ });
894
+ ```
895
+
896
+ ##### Poll Result Snapshot
897
+
898
+ Send a snapshot of poll results.
899
+
900
+ ```typescript
901
+ await conn.sendMessage(jid, {
902
+ pollResultSnapshot: {
903
+ name: 'Favorite Anime?',
904
+ pollVotes: [
905
+ { optionName: 'Aot', optionVoteCount: 10 },
906
+ { optionName: 'Bleach', optionVoteCount: 5 },
907
+ { optionName: 'Death note', optionVoteCount: 3 }
908
+ ],
909
+ pollType: 0, // 0 = POLL, 1 = QUIZ
910
+ contextInfo: {
911
+ mentionedJid: [jid]
912
+ }
913
+ }
914
+ });
915
+ ```
916
+
917
+ ##### Poll Update
918
+
919
+ Send a poll vote update.
920
+
921
+ ```typescript
922
+ await conn.sendMessage(jid, {
923
+ pollUpdate: {
924
+ pollCreationMessageKey: {
925
+ remoteJid: jid,
926
+ fromMe: false,
927
+ id: 'pollMessageId123'
928
+ },
929
+ vote: {
930
+ encPayload: Buffer.from('encrypted_vote_payload'),
931
+ encIv: Buffer.from('encryption_iv')
932
+ },
933
+ senderTimestampMs: Date.now()
934
+ }
935
+ });
936
+ ```
937
+
938
+ ##### Comment Messages
939
+
940
+ Comment on a specific message in a chat.
941
+
942
+ ```typescript
943
+ await conn.sendMessage(jid, {
944
+ comment: {
945
+ message: { text: 'This is a comment!' },
946
+ targetMessageKey: {
947
+ remoteJid: jid,
948
+ fromMe: false,
949
+ id: 'messageId123'
950
+ }
951
+ }
952
+ });
953
+ ```
954
+
955
+ ##### Question Messages
956
+
957
+ Create a question message that users can respond to.
958
+
959
+ ```typescript
960
+ await conn.sendMessage(jid, {
961
+ question: {
962
+ text: 'What is your favorite programming language?',
963
+ contextInfo: {
964
+ mentionedJid: [jid]
965
+ }
966
+ }
967
+ });
968
+ ```
969
+
970
+ ##### Question Response Messages
971
+
972
+ Respond to a question message.
973
+
974
+ ```typescript
975
+ await conn.sendMessage(jid, {
976
+ questionResponse: {
977
+ key: {
978
+ remoteJid: jid,
979
+ fromMe: false,
980
+ id: 'questionMessageId123'
981
+ },
982
+ text: 'My answer is TypeScript!'
983
+ }
984
+ });
985
+ ```
986
+
987
+ ##### Status Question Answer Messages
988
+
989
+ Answer a question posted on status.
990
+
991
+ ```typescript
992
+ await conn.sendMessage('status@broadcast', {
993
+ statusQuestionAnswer: {
994
+ key: {
995
+ remoteJid: 'status@broadcast',
996
+ fromMe: false,
997
+ id: 'statusQuestionId123'
998
+ },
999
+ text: 'My answer to the status question'
1000
+ }
1001
+ }, {
1002
+ statusJidList: [jid]
1003
+ });
1004
+ ```
1005
+
1006
+ ##### Status Quoted Messages
1007
+
1008
+ Quote a status message (e.g., question-answer reshare).
1009
+
1010
+ ```typescript
1011
+ await conn.sendMessage('status@broadcast', {
1012
+ statusQuoted: {
1013
+ type: 1, // QUESTION_ANSWER
1014
+ text: 'This is my response',
1015
+ thumbnail: buffer, // optional thumbnail
1016
+ originalStatusId: {
1017
+ remoteJid: 'status@broadcast',
1018
+ fromMe: false,
1019
+ id: 'originalStatusId123'
1020
+ }
1021
+ }
1022
+ }, {
1023
+ statusJidList: [jid]
1024
+ });
1025
+ ```
1026
+
1027
+ ##### Status Sticker Interaction Messages
1028
+
1029
+ Interact with stickers on status (e.g., reactions).
1030
+
1031
+ ```typescript
1032
+ await conn.sendMessage('status@broadcast', {
1033
+ statusStickerInteraction: {
1034
+ key: {
1035
+ remoteJid: 'status@broadcast',
1036
+ fromMe: false,
1037
+ id: 'statusMessageId123'
1038
+ },
1039
+ stickerKey: 'stickerKey123',
1040
+ type: 1 // REACTION
1041
+ }
1042
+ }, {
1043
+ statusJidList: [jid]
1044
+ });
1045
+ ```
1046
+
1047
+ ##### AI Rich Response Messages
1048
+
1049
+ Send AI-generated rich responses with multiple content types (tables, code, images, maps, etc.).
1050
+
1051
+ ```typescript
1052
+ await conn.sendMessage(jid, {
1053
+ ai: true,
1054
+ richResponse: {
1055
+ messageType: 1, // AI_RICH_RESPONSE_TYPE_STANDARD
1056
+ submessages: [
1057
+ {
1058
+ messageType: 2, // AI_RICH_RESPONSE_TEXT
1059
+ messageText: 'Here is the answer to your question'
1060
+ },
1061
+ {
1062
+ messageType: 4, // AI_RICH_RESPONSE_TABLE
1063
+ tableMetadata: {
1064
+ title: 'Data Table',
1065
+ rows: [
1066
+ { items: ['Header 1', 'Header 2'], isHeading: true },
1067
+ { items: ['Value 1', 'Value 2'], isHeading: false }
1068
+ ]
1069
+ }
1070
+ },
1071
+ {
1072
+ messageType: 5, // AI_RICH_RESPONSE_CODE
1073
+ codeMetadata: {
1074
+ codeLanguage: 'javascript',
1075
+ codeBlocks: [
1076
+ {
1077
+ highlightType: 0, // DEFAULT
1078
+ codeContent: 'console.log("Hello World");'
1079
+ }
1080
+ ]
1081
+ }
1082
+ }
1083
+ ],
1084
+ contextInfo: {
1085
+ mentionedJid: [jid]
1086
+ }
1087
+ }
1088
+ });
1089
+ ```
1090
+
1091
+ Note: AI rich responses may show as "not supported" on some WhatsApp clients/accounts depending on app version and feature availability.
1092
+
1093
+ #### Other Messages
1094
+
1095
+ ##### Business Call Messages (BCall)
1096
+
1097
+ Send business call messages with media.
1098
+
1099
+ ```typescript
1100
+ await conn.sendMessage(jid, {
1101
+ bCall: {
1102
+ sessionId: 'call_session_123',
1103
+ mediaType: 2, // 0 = UNKNOWN, 1 = AUDIO, 2 = VIDEO
1104
+ masterKey: Buffer.from('master_key_bytes'),
1105
+ caption: 'Business call'
1106
+ }
1107
+ });
1108
+ ```
1109
+
1110
+ ##### Call Log Messages
1111
+
1112
+ Send call log information.
1113
+
1114
+ ```typescript
1115
+ await conn.sendMessage(jid, {
1116
+ callLog: {
1117
+ isVideo: true,
1118
+ callOutcome: 0, // 0 = CONNECTED, 1 = MISSED, 2 = FAILED, 3 = REJECTED, etc.
1119
+ durationSecs: 120,
1120
+ callType: 0, // 0 = REGULAR, 1 = SCHEDULED_CALL, 2 = VOICE_CHAT
1121
+ participants: [
1122
+ { jid: 'user@s.whatsapp.net', callOutcome: 0 }
1123
+ ]
1124
+ }
1125
+ });
1126
+ ```
1127
+
1128
+ ##### Event Response Messages
1129
+
1130
+ Respond to an event message (e.g., RSVP for an event).
1131
+
1132
+ ```typescript
1133
+ await conn.sendMessage(jid, {
1134
+ eventResponse: {
1135
+ response: 1, // GOING = 1, NOT_GOING = 2, MAYBE = 3
1136
+ timestampMs: Date.now(),
1137
+ extraGuestCount: 0
1138
+ }
1139
+ });
1140
+ ```
1141
+
1142
+ ##### Status Mention Messages
1143
+
1144
+ Mention a status in another status.
1145
+
1146
+ ```typescript
1147
+ await conn.sendMessage('status@broadcast', {
1148
+ statusMention: {
1149
+ quotedStatus: {
1150
+ key: {
1151
+ remoteJid: 'status@broadcast',
1152
+ fromMe: false,
1153
+ id: 'statusId123'
1154
+ },
1155
+ message: {
1156
+ conversation: 'Original status message'
1157
+ }
1158
+ }
1159
+ }
1160
+ }, {
1161
+ statusJidList: [jid]
1162
+ });
1163
+ ```
1164
+
1165
+ ##### Group Status Messages
1166
+
1167
+ Send a status message specific to a group.
1168
+
1169
+ ```typescript
1170
+ await conn.sendMessage(jid, {
1171
+ groupStatus: {
1172
+ message: {
1173
+ conversation: 'Group status update!'
1174
+ }
1175
+ }
1176
+ });
1177
+ ```
1178
+
1179
+ ##### Bot Task Messages
1180
+
1181
+ Send a message related to a bot task.
1182
+
1183
+ ```typescript
1184
+ await conn.sendMessage(jid, {
1185
+ botTask: {
1186
+ message: {
1187
+ conversation: 'Bot task completed.'
1188
+ }
1189
+ }
1190
+ });
1191
+ ```
1192
+
1193
+ ##### Limit Sharing Messages
1194
+
1195
+ Send a message to limit sharing.
1196
+
1197
+ ```typescript
1198
+ await conn.sendMessage(jid, {
1199
+ limitSharing: {
1200
+ message: {
1201
+ conversation: 'Sharing limited for this message.'
1202
+ }
1203
+ }
1204
+ });
1205
+ ```
1206
+
1207
+ ##### Status Add Yours Messages
1208
+
1209
+ Send a "Add Yours" status message.
1210
+
1211
+ ```typescript
1212
+ await conn.sendMessage('status@broadcast', {
1213
+ statusAddYours: {
1214
+ message: {
1215
+ conversation: 'Add yours to this trend!'
1216
+ }
1217
+ }
1218
+ }, {
1219
+ statusJidList: [jid]
1220
+ });
1221
+ ```
1222
+
1223
+ ##### Bot Forwarded Messages
1224
+
1225
+ Send a message that was forwarded by a bot.
1226
+
1227
+ ```typescript
1228
+ await conn.sendMessage(jid, {
1229
+ botForwarded: {
1230
+ message: {
1231
+ conversation: 'This message was forwarded by a bot.'
1232
+ }
1233
+ }
1234
+ });
1235
+ ```
1236
+
1237
+ ##### Event Cover Image Messages
1238
+
1239
+ Send a cover image for an event.
1240
+
1241
+ ```typescript
1242
+ await conn.sendMessage(jid, {
1243
+ eventCoverImage: {
1244
+ message: {
1245
+ imageMessage: {
1246
+ url: 'https://example.com/event_cover.jpg',
1247
+ mimetype: 'image/jpeg'
1248
+ }
1249
+ }
1250
+ }
1251
+ });
1252
+ ```
1253
+
1254
+ ##### Poll Creation Message V4
1255
+
1256
+ Create a poll with additional options (version 4).
1257
+
1258
+ ```typescript
1259
+ await conn.sendMessage(jid, {
1260
+ pollV4: {
1261
+ name: 'Favorite color (V4)?',
1262
+ selectableCount: 1,
1263
+ values: ['Red', 'Green', 'Blue'],
1264
+ pollType: 0 // Default poll type
1265
+ }
1266
+ });
1267
+ ```
1268
+
1269
+ ##### Poll Creation Message V5
1270
+
1271
+ Create a poll with additional options (version 5).
1272
+
1273
+ ```typescript
1274
+ await conn.sendMessage(jid, {
1275
+ pollV5: {
1276
+ name: 'Favorite food (V5)?',
1277
+ selectableCount: 2,
1278
+ values: ['Pizza', 'Pasta', 'Sushi'],
1279
+ pollType: 1 // Quiz poll type
1280
+ }
1281
+ });
1282
+ ```
1283
+
1284
+ ##### Poll Result Snapshot Message V3
1285
+
1286
+ Send a snapshot of poll results (version 3).
1287
+
1288
+ ```typescript
1289
+ await conn.sendMessage(jid, {
1290
+ pollResultSnapshotV3: {
1291
+ pollCreationMessageKey: {
1292
+ remoteJid: jid,
1293
+ fromMe: true,
1294
+ id: 'pollMessageId123'
1295
+ },
1296
+ pollResult: {
1297
+ vote: {
1298
+ selectedOptions: [Buffer.from('Red')]
1299
+ },
1300
+ senderTimestampMs: Date.now()
1301
+ },
1302
+ contextInfo: {
1303
+ mentionedJid: [jid]
1304
+ },
1305
+ pollType: 0 // Default poll type
1306
+ }
1307
+ });
1308
+ ```
1309
+
1310
+ ##### Encrypted Comment Messages
1311
+
1312
+ Send encrypted comments on messages.
1313
+
1314
+ ```typescript
1315
+ await conn.sendMessage(jid, {
1316
+ encComment: {
1317
+ targetMessageKey: {
1318
+ remoteJid: jid,
1319
+ fromMe: false,
1320
+ id: 'messageId123'
1321
+ },
1322
+ encPayload: Buffer.from('encrypted_payload'),
1323
+ encIv: Buffer.from('encryption_iv')
1324
+ }
1325
+ });
1326
+ ```
1327
+
1328
+ ##### Encrypted Event Response Messages
1329
+
1330
+ Send encrypted event responses.
1331
+
1332
+ ```typescript
1333
+ await conn.sendMessage(jid, {
1334
+ encEventResponse: {
1335
+ eventCreationMessageKey: {
1336
+ remoteJid: jid,
1337
+ fromMe: false,
1338
+ id: 'eventMessageId123'
1339
+ },
1340
+ encPayload: Buffer.from('encrypted_payload'),
1341
+ encIv: Buffer.from('encryption_iv')
1342
+ }
1343
+ });
1344
+ ```
1345
+
1346
+ ##### Message History Bundle
1347
+
1348
+ Send a bundle of message history.
1349
+
1350
+ ```typescript
1351
+ await conn.sendMessage(jid, {
1352
+ messageHistoryBundle: {
1353
+ mimetype: 'application/octet-stream',
1354
+ media: { url: './history.bundle' },
1355
+ messageHistoryMetadata: {
1356
+ historyReceivers: ['user1@s.whatsapp.net', 'user2@s.whatsapp.net'],
1357
+ oldestMessageTimestamp: Date.now() - 86400000,
1358
+ messageCount: 100
1359
+ },
1360
+ contextInfo: {
1361
+ mentionedJid: [jid]
1362
+ }
1363
+ }
1364
+ });
1365
+ ```
1366
+
1367
+ ##### Message History Notice
1368
+
1369
+ Send a notice about message history.
1370
+
1371
+ ```typescript
1372
+ await conn.sendMessage(jid, {
1373
+ messageHistoryNotice: {
1374
+ messageHistoryMetadata: {
1375
+ historyReceivers: ['user1@s.whatsapp.net'],
1376
+ oldestMessageTimestamp: Date.now() - 86400000,
1377
+ messageCount: 50
1378
+ },
1379
+ contextInfo: {
1380
+ mentionedJid: [jid]
1381
+ }
1382
+ }
1383
+ });
1384
+ ```
1385
+
1386
+ ##### Newsletter Follower Invite
1387
+
1388
+ Invite followers to a newsletter.
1389
+
1390
+ ```typescript
1391
+ await conn.sendMessage(jid, {
1392
+ inviteFollower: {
1393
+ newsletterJid: '120363418582531215@newsletter',
1394
+ newsletterName: 'My Newsletter',
1395
+ thumbnail: buffer, // Optional thumbnail
1396
+ caption: 'Join our newsletter!',
1397
+ contextInfo: {
1398
+ mentionedJid: [jid]
1399
+ }
1400
+ }
1401
+ });
1402
+ ```
1403
+
1404
+ ##### Placeholder Messages
1405
+
1406
+ Send placeholder messages (e.g., to mask linked devices).
1407
+
1408
+ ```typescript
1409
+ await conn.sendMessage(jid, {
1410
+ placeholder: {
1411
+ type: 0 // MASK_LINKED_DEVICES = 0
1412
+ }
1413
+ });
1414
+ ```
1415
+
1416
+ ##### Secret Encrypted Messages
1417
+
1418
+ Send secret encrypted messages (for event or message edits).
1419
+
1420
+ ```typescript
1421
+ await conn.sendMessage(jid, {
1422
+ secretEncrypted: {
1423
+ targetMessageKey: {
1424
+ remoteJid: jid,
1425
+ fromMe: false,
1426
+ id: 'targetMessageId123'
1427
+ },
1428
+ encPayload: Buffer.from('encrypted_payload'),
1429
+ encIv: Buffer.from('encryption_iv'),
1430
+ secretEncType: 2 // 0 = UNKNOWN, 1 = EVENT_EDIT, 2 = MESSAGE_EDIT
1431
+ }
1432
+ });
1433
+ ```
1434
+
1435
+ ##### Status Notification Messages
1436
+
1437
+ Send status notification messages (for status interactions).
1438
+
1439
+ ```typescript
1440
+ await conn.sendMessage('status@broadcast', {
1441
+ statusNotification: {
1442
+ responseMessageKey: {
1443
+ remoteJid: 'status@broadcast',
1444
+ fromMe: false,
1445
+ id: 'responseId123'
1446
+ },
1447
+ originalMessageKey: {
1448
+ remoteJid: 'status@broadcast',
1449
+ fromMe: false,
1450
+ id: 'originalId123'
1451
+ },
1452
+ type: 1 // 0 = UNKNOWN, 1 = STATUS_ADD_YOURS, 2 = STATUS_RESHARE, 3 = STATUS_QUESTION_ANSWER_RESHARE
1453
+ }
1454
+ }, {
1455
+ statusJidList: [jid]
1456
+ });
1457
+ ```
1458
+
1459
+ ##### Sticker Sync RMR Messages
1460
+
1461
+ Sync stickers via RMR (Recent Media Request).
1462
+
1463
+ ```typescript
1464
+ await conn.sendMessage(jid, {
1465
+ stickerSyncRMR: {
1466
+ filehash: ['hash1', 'hash2', 'hash3'],
1467
+ rmrSource: 'source_identifier',
1468
+ requestTimestamp: Date.now()
1469
+ }
1470
+ });
1471
+ ```
1472
+
1473
+ // Payment Messages
1474
+
1475
+ ##### Request Payment
1476
+ ```typescript
1477
+ await conn.sendMessage(jid, {
1478
+ requestPayment: {
1479
+ currency: 'EUR',
1480
+ amount1000: 5000,
1481
+ requestFrom: '393514357738@s.whatsapp.net',
1482
+ note: 'js gimme my money' // https://paypal.me/samakavare
1483
+ }
1484
+ });
1485
+ ```
1486
+
1487
+ ##### Send Payment
1488
+ ```typescript
1489
+ await conn.sendMessage(jid, {
1490
+ sendPayment: {
1491
+ requestMessageKey: {
1492
+ remoteJid: jid,
1493
+ fromMe: false,
1494
+ id: 'paymentRequestId123'
1495
+ },
1496
+ noteMessage: { text: 'Payment sent' },
1497
+ background: {
1498
+ id: 'payment_bg_id',
1499
+ type: 1 // DEFAULT = 1
1500
+ },
1501
+ transactionData: 'transaction_data_string'
1502
+ }
1503
+ });
1504
+ ```
1505
+
1506
+ ##### Decline Payment Request
1507
+ ```typescript
1508
+ await conn.sendMessage(jid, {
1509
+ declinePayment: {
1510
+ key: {
1511
+ remoteJid: jid,
1512
+ fromMe: false,
1513
+ id: 'paymentRequestId123'
1514
+ }
1515
+ }
1516
+ });
1517
+ ```
1518
+
1519
+ ##### Cancel Payment Request
1520
+ ```typescript
1521
+ await conn.sendMessage(jid, {
1522
+ cancelPayment: {
1523
+ key: {
1524
+ remoteJid: jid,
1525
+ fromMe: true,
1526
+ id: 'paymentRequestId123'
1527
+ }
1528
+ }
1529
+ });
1530
+ ```
1531
+
1532
+ ##### Scheduled Call Creation
1533
+ ```typescript
1534
+ await conn.sendMessage(jid, {
1535
+ call: {
1536
+ callKey: {
1537
+ fromMe: true,
1538
+ id: Date.now().toString(),
1539
+ remoteJid: jid
1540
+ },
1541
+ type: 'ACCEPT', // 'MISSED', 'OFFER', 'ACCEPT', 'REJECT'..
1542
+ time: Date.now() + 3600000, // Scheduled time (optional)
1543
+ title: 'Team Meeting' // Optional title
1544
+ }
1545
+ });
1546
+ ```
1547
+
1548
+ ##### Scheduled Call Edit
1549
+ ```typescript
1550
+ await conn.sendMessage(jid, {
1551
+ scheduledCallEdit: {
1552
+ key: {
1553
+ remoteJid: jid,
1554
+ fromMe: true,
1555
+ id: 'scheduledCallId123'
1556
+ },
1557
+ editType: 1 // 0 = UNKNOWN, 1 = CANCEL
1558
+ }
1559
+ });
1560
+ ```
1561
+
1562
+ ##### Pin/Unpin Messages
1563
+
1564
+ Pin or unpin a message in a chat.
1565
+
1566
+ ```typescript
1567
+ // Pin a message (type 1 = PIN_FOR_ALL)
1568
+ await conn.sendMessage(jid, {
1569
+ pin: {
1570
+ key: {
1571
+ remoteJid: jid,
1572
+ fromMe: false,
1573
+ id: 'messageId123'
1574
+ },
1575
+ type: 1, // 1 = PIN_FOR_ALL, 2 = UNPIN_FOR_ALL
1576
+ time: 86400 // Duration in seconds (24 hours = 86400, 7 days = 604800, 30 days = 2592000)
1577
+ }
1578
+ });
1579
+
1580
+ // Or use simplified syntax
1581
+ await conn.sendMessage(jid, {
1582
+ pin: {
1583
+ remoteJid: jid,
1584
+ fromMe: false,
1585
+ id: 'messageId123'
1586
+ },
1587
+ type: 1, // 1 = PIN_FOR_ALL, 2 = UNPIN_FOR_ALL
1588
+ time: 86400 // Optional: duration in seconds
1589
+ });
1590
+
1591
+ // Unpin a message (type 2 = UNPIN_FOR_ALL)
1592
+ await conn.sendMessage(jid, {
1593
+ pin: {
1594
+ key: {
1595
+ remoteJid: jid,
1596
+ fromMe: false,
1597
+ id: 'messageId123'
1598
+ },
1599
+ type: 2 // UNPIN_FOR_ALL
1600
+ }
1601
+ });
1602
+ ```
1603
+
1604
+ ### Response Management
1605
+
1606
+ To manage responses to interactive messages, use the `messages.upsert` listener and check the response type:
1607
+
1608
+ ```typescript
1609
+ conn.ev.on('messages.upsert', async ({ messages }) => {
1610
+ const msg = messages[0];
1611
+
1612
+ // Button response
1613
+ if (msg.message?.buttonsResponseMessage) {
1614
+ const selectedId = msg.message.buttonsResponseMessage.selectedButtonId;
1615
+ console.log(`Selected button: ${selectedId}`);
1616
+ }
1617
+
1618
+ // List response
1619
+ if (msg.message?.listResponseMessage) {
1620
+ const selectedId = msg.message.listResponseMessage.singleSelectReply.selectedRowId;
1621
+ console.log(`Selected option: ${selectedId}`);
1622
+ }
1623
+
1624
+ // Poll response
1625
+ if (msg.message?.pollResponseMessage) {
1626
+ const selectedOptions = msg.message.pollResponseMessage.selectedOptions;
1627
+ console.log('Selected options:', selectedOptions);
1628
+ }
1629
+
1630
+ // Comment response
1631
+ if (msg.message?.commentMessage) {
1632
+ const comment = msg.message.commentMessage;
1633
+ console.log('Comment on message:', comment.targetMessageKey?.id);
1634
+ console.log('Comment content:', comment.message);
1635
+ }
1636
+
1637
+ // Question response
1638
+ if (msg.message?.questionResponseMessage) {
1639
+ const response = msg.message.questionResponseMessage;
1640
+ console.log('Response to question:', response.key?.id);
1641
+ console.log('Answer:', response.text);
1642
+ }
1643
+
1644
+ // Status question answer
1645
+ if (msg.message?.statusQuestionAnswerMessage) {
1646
+ const answer = msg.message.statusQuestionAnswerMessage;
1647
+ console.log('Status question answer:', answer.text);
1648
+ }
1649
+
1650
+ // AI Rich Response
1651
+ if (msg.message?.richResponseMessage) {
1652
+ const richResponse = msg.message.richResponseMessage;
1653
+ console.log('AI Rich Response type:', richResponse.messageType);
1654
+ console.log('Submessages:', richResponse.submessages);
1655
+ }
1656
+
1657
+ // Interactive Response (Native Flow Response)
1658
+ if (msg.message?.interactiveResponseMessage) {
1659
+ const response = msg.message.interactiveResponseMessage;
1660
+ console.log('Interactive response body:', response.body?.text);
1661
+ if (response.nativeFlowResponseMessage) {
1662
+ console.log('Native flow response:', response.nativeFlowResponseMessage.name);
1663
+ console.log('Params:', response.nativeFlowResponseMessage.paramsJson);
1664
+ }
1665
+ }
1666
+
1667
+ // Sticker Pack
1668
+ if (msg.message?.stickerPackMessage) {
1669
+ const pack = msg.message.stickerPackMessage;
1670
+ console.log('Sticker pack:', pack.name);
1671
+ console.log('Publisher:', pack.publisher);
1672
+ console.log('Stickers count:', pack.stickers?.length);
1673
+ console.log('Pack ID:', pack.stickerPackId);
1674
+ console.log('Origin:', pack.stickerPackOrigin);
1675
+ }
1676
+
1677
+ // Collection/Catalog response
1678
+ if (msg.message?.interactiveMessage?.collectionMessage) {
1679
+ const collection = msg.message.interactiveMessage.collectionMessage;
1680
+ console.log('Collection opened:', collection.id);
1681
+ console.log('Business JID:', collection.bizJid);
1682
+ }
1683
+
1684
+ // Invoice response
1685
+ if (msg.message?.invoiceMessage) {
1686
+ const invoice = msg.message.invoiceMessage;
1687
+ console.log('Invoice token:', invoice.token);
1688
+ console.log('Invoice note:', invoice.note);
1689
+ console.log('Attachment type:', invoice.attachmentType === 0 ? 'IMAGE' : 'PDF');
1690
+ }
1691
+
1692
+ // Business Call
1693
+ if (msg.message?.bcallMessage) {
1694
+ const bcall = msg.message.bcallMessage;
1695
+ console.log('Business call session:', bcall.sessionId);
1696
+ console.log('Media type:', bcall.mediaType === 1 ? 'AUDIO' : 'VIDEO');
1697
+ }
1698
+
1699
+ // Call Log
1700
+ if (msg.message?.callLogMesssage) {
1701
+ const callLog = msg.message.callLogMesssage;
1702
+ console.log('Call outcome:', callLog.callOutcome);
1703
+ console.log('Duration:', callLog.durationSecs, 'seconds');
1704
+ console.log('Participants:', callLog.participants);
1705
+ }
1706
+
1707
+ // Encrypted Comment
1708
+ if (msg.message?.encCommentMessage) {
1709
+ const encComment = msg.message.encCommentMessage;
1710
+ console.log('Encrypted comment on message:', encComment.targetMessageKey?.id);
1711
+ }
1712
+
1713
+ // Encrypted Event Response
1714
+ if (msg.message?.encEventResponseMessage) {
1715
+ const encEvent = msg.message.encEventResponseMessage;
1716
+ console.log('Encrypted event response for:', encEvent.eventCreationMessageKey?.id);
1717
+ }
1718
+
1719
+ // Message History Bundle
1720
+ if (msg.message?.messageHistoryBundle) {
1721
+ const bundle = msg.message.messageHistoryBundle;
1722
+ console.log('History bundle receivers:', bundle.messageHistoryMetadata?.historyReceivers);
1723
+ console.log('Message count:', bundle.messageHistoryMetadata?.messageCount);
1724
+ }
1725
+
1726
+ // Message History Notice
1727
+ if (msg.message?.messageHistoryNotice) {
1728
+ const notice = msg.message.messageHistoryNotice;
1729
+ console.log('History notice receivers:', notice.messageHistoryMetadata?.historyReceivers);
1730
+ }
1731
+
1732
+ // Newsletter Follower Invite
1733
+ if (msg.message?.newsletterFollowerInviteMessageV2) {
1734
+ const invite = msg.message.newsletterFollowerInviteMessageV2;
1735
+ console.log('Newsletter invite:', invite.newsletterName);
1736
+ console.log('Newsletter JID:', invite.newsletterJid);
1737
+ }
1738
+
1739
+ // Placeholder
1740
+ if (msg.message?.placeholderMessage) {
1741
+ const placeholder = msg.message.placeholderMessage;
1742
+ console.log('Placeholder type:', placeholder.type);
1743
+ }
1744
+
1745
+ // Secret Encrypted
1746
+ if (msg.message?.secretEncryptedMessage) {
1747
+ const secret = msg.message.secretEncryptedMessage;
1748
+ console.log('Secret encrypted type:', secret.secretEncType);
1749
+ console.log('Target message:', secret.targetMessageKey?.id);
1750
+ }
1751
+
1752
+ // Status Notification
1753
+ if (msg.message?.statusNotificationMessage) {
1754
+ const notification = msg.message.statusNotificationMessage;
1755
+ console.log('Status notification type:', notification.type);
1756
+ console.log('Original message:', notification.originalMessageKey?.id);
1757
+ }
1758
+
1759
+ // Sticker Sync RMR
1760
+ if (msg.message?.stickerSyncRmrMessage) {
1761
+ const sync = msg.message.stickerSyncRmrMessage;
1762
+ console.log('Sticker sync filehashes:', sync.filehash);
1763
+ console.log('RMR source:', sync.rmrSource);
1764
+ }
1765
+
1766
+ // Send Payment
1767
+ if (msg.message?.sendPaymentMessage) {
1768
+ const payment = msg.message.sendPaymentMessage;
1769
+ console.log('Payment sent for request:', payment.requestMessageKey?.id);
1770
+ console.log('Transaction data:', payment.transactionData);
1771
+ }
1772
+
1773
+ // Decline Payment
1774
+ if (msg.message?.declinePaymentRequestMessage) {
1775
+ const decline = msg.message.declinePaymentRequestMessage;
1776
+ console.log('Payment declined for:', decline.key?.id);
1777
+ }
1778
+
1779
+ // Cancel Payment
1780
+ if (msg.message?.cancelPaymentRequestMessage) {
1781
+ const cancel = msg.message.cancelPaymentRequestMessage;
1782
+ console.log('Payment cancelled for:', cancel.key?.id);
1783
+ }
1784
+
1785
+ // Scheduled Call Edit
1786
+ if (msg.message?.scheduledCallEditMessage) {
1787
+ const edit = msg.message.scheduledCallEditMessage;
1788
+ console.log('Scheduled call edited:', edit.key?.id);
1789
+ console.log('Edit type:', edit.editType === 1 ? 'CANCEL' : 'UNKNOWN');
1790
+ }
1791
+
1792
+ // Poll Result Snapshot
1793
+ if (msg.message?.pollResultSnapshotMessage) {
1794
+ const snapshot = msg.message.pollResultSnapshotMessage;
1795
+ console.log('Poll snapshot:', snapshot.name);
1796
+ console.log('Votes:', snapshot.pollVotes);
1797
+ }
1798
+
1799
+ // Poll Update
1800
+ if (msg.message?.pollUpdateMessage) {
1801
+ const update = msg.message.pollUpdateMessage;
1802
+ console.log('Poll update for:', update.pollCreationMessageKey?.id);
1803
+ }
1804
+
1805
+ // Pin/Unpin
1806
+ if (msg.message?.pinInChatMessage) {
1807
+ const pin = msg.message.pinInChatMessage;
1808
+ console.log('Pin action:', pin.type === 1 ? 'PIN_FOR_ALL' : 'UNPIN_FOR_ALL');
1809
+ console.log('Pinned message:', pin.key?.id);
1810
+ }
1811
+ });
1812
+ ```
1813
+
1814
+ ### 🎭 Group Features
1815
+
1816
+ #### Basic Group Management
1817
+
1818
+ ```typescript
1819
+ // Group creation - the jid is for adding participants
1820
+ const group = await conn.groupCreate('Angels 🩸🕊️', ['user@s.whatsapp.net']);
1821
+
1822
+ // Get group info
1823
+ const metadata = await conn.groupMetadata(jid);
1824
+
1825
+ // Get invite code
1826
+ const code = await conn.groupInviteCode(jid);
1827
+
1828
+ // Revoke invite link
1829
+ await conn.groupRevokeInvite(jid);
1830
+
1831
+ // Leave group
1832
+ await conn.groupLeave(jid);
1833
+ ```
1834
+
1835
+ #### Participant Management
1836
+
1837
+ ```typescript
1838
+ // Add participants
1839
+ await conn.groupParticipantsUpdate(
1840
+ jid,
1841
+ ['user@s.whatsapp.net'],
1842
+ 'add'
1843
+ );
1844
+
1845
+ // Remove participants
1846
+ await conn.groupParticipantsUpdate(
1847
+ jid,
1848
+ ['user@s.whatsapp.net'],
1849
+ 'remove'
1850
+ );
1851
+
1852
+ // Promote to admin
1853
+ await conn.groupParticipantsUpdate(
1854
+ jid,
1855
+ ['user@s.whatsapp.net'],
1856
+ 'promote'
1857
+ );
1858
+
1859
+ // Demote from admin
1860
+ await conn.groupParticipantsUpdate(
1861
+ jid,
1862
+ ['user@s.whatsapp.net'],
1863
+ 'demote'
1864
+ );
1865
+ ```
1866
+
1867
+ #### Group Settings
1868
+
1869
+ ```typescript
1870
+ // Change group name
1871
+ await conn.groupUpdateSubject(jid, 'New Name');
1872
+
1873
+ // Change description
1874
+ await conn.groupUpdateDescription(jid, 'New description');
1875
+
1876
+ // Change group photo
1877
+ await conn.updateProfilePicture(jid, { url: './img/group.jpg' });
1878
+
1879
+ // Remove group photo
1880
+ await conn.removeProfilePicture(jid);
1881
+
1882
+ // Set group as admin only
1883
+ await conn.groupSettingUpdate(jid, 'announcement');
1884
+
1885
+ // Set group as open to all
1886
+ await conn.groupSettingUpdate(jid, 'not_announcement');
1887
+
1888
+ // Set who can edit info - admin only
1889
+ await conn.groupSettingUpdate(jid, 'locked');
1890
+
1891
+ // Set who can edit info - all
1892
+ await conn.groupSettingUpdate(jid, 'unlocked');
1893
+
1894
+ // Set who can add members - admin only
1895
+ await conn.groupMemberAddMode(jid, 'admin_add');
1896
+
1897
+ // Set who can add members - all
1898
+ await conn.groupMemberAddMode(jid, 'all_member_add');
1899
+
1900
+ // Enable/disable temporary messages (24 hours)
1901
+ await conn.groupToggleEphemeral(jid, 86400); // seconds
1902
+
1903
+ // Disable temporary messages
1904
+ await conn.groupToggleEphemeral(jid, 0);
1905
+
1906
+ // Enable/disable membership approval mode
1907
+ await conn.groupJoinApprovalMode(jid, 'on'); // requires approval
1908
+ await conn.groupJoinApprovalMode(jid, 'off'); // open
1909
+
1910
+ // Get all groups
1911
+ const groups = await conn.groupFetchAllParticipating();
1912
+
1913
+ // Get pending invites
1914
+ const invites = await conn.groupGetInviteInfo(code);
1915
+
1916
+ // Accept group invite
1917
+ await conn.groupAcceptInvite(code);
1918
+
1919
+ // Get group info from link
1920
+ const groupInfo = await conn.groupGetInviteInfo('https://chat.whatsapp.com/ABC123');
1921
+
1922
+ // Listen to settings changes
1923
+ conn.ev.on('group-settings.update', async ({ id, announce, restrict }) => {
1924
+ if (announce !== undefined) {
1925
+ await conn.sendMessage(id, { text: `The group has been set to ${announce ? 'admin only' : 'all'}` });
1926
+ }
1927
+ if (restrict !== undefined) {
1928
+ await conn.sendMessage(id, { text: `Group info can be edited by ${restrict ? 'admin only' : 'all'}` });
1929
+ }
1930
+ });
1931
+ ```
1932
+
1933
+ #### Advanced Group Messages
1934
+
1935
+ ```typescript
1936
+ // Message with multiple mentions
1937
+ await conn.sendMessage(jid, {
1938
+ text: '@user1 @user2 @user3',
1939
+ mentions: [user1, user2, user3],
1940
+ contextInfo: {
1941
+ mentionedJid: [user1, user2, user3]
1942
+ }
1943
+ });
1944
+
1945
+ // Message with Google search
1946
+ await conn.sendMessage(jid, {
1947
+ text: 'ZWAG',
1948
+ contextInfo: {
1949
+ forwardingScore: 999,
1950
+ isForwarded: true
1951
+ }
1952
+ });
1953
+ ```
1954
+
1955
+ ---
1956
+
1957
+ ## 🔧 Fix LID/JID in Your Own Main and Handler
1958
+
1959
+ *The LID/JID support is a strength of this library, solving common problems like sender identification in groups and private chats. Here's how to integrate it into your main code and handler.*
1960
+
1961
+ ### Best Practices for LID/JID
1962
+
1963
+ - **JID Normalization**: The library automatically handles JID/LID normalization in most cases.
1964
+ - **Use Built-in Functions**: Prefer `toJid()`, `normalizeJid()`, and `validateJid()` from the library.
1965
+ - **Cache Management**: The library includes automatic caching for LID/JID conversions.
1966
+
1967
+ **Common Use Cases:**
1968
+ - **Group Participants**: Use `toJid()` to normalize participant IDs before operations.
1969
+ - **Message Sender**: Extract sender info with `getSenderLid()` for reliable identification.
1970
+ - **Validation**: Always validate JIDs with `validateJid()` before critical operations.
1971
+
1972
+ ### Integrated Example
1973
+
1974
+ ```typescript
1975
+ import makeWASocket, { getSenderLid, toJid, validateJid } from '@realvare/baileys';
1976
+
1977
+ conn.ev.on('messages.upsert', async ({ messages }) => {
1978
+ const msg = messages[0];
1979
+ if (!msg.message) return;
1980
+
1981
+ const info = getSenderLid(msg);
1982
+ const senderJid = toJid(info.lid);
1983
+
1984
+ // Validate before using
1985
+ const validation = validateJid(senderJid);
1986
+ if (validation.isValid) {
1987
+ await conn.sendMessage(senderJid, { text: 'Message received!' }, { quoted: msg });
1988
+ }
1989
+ });
1990
+ ```
1991
+
1992
+ ---
1993
+
1994
+ ### 🚀 Smart LID/JID Cache
1995
+
1996
+ The library now includes an advanced cache system to optimize LID/JID conversions:
1997
+
1998
+ ```typescript
1999
+ import { getCacheStats, clearCache, setPerformanceConfig } from '@realvare/baileys';
2000
+
2001
+ // Configure custom cache
2002
+ setPerformanceConfig({
2003
+ cache: {
2004
+ lidCache: {
2005
+ ttl: 10 * 60 * 1000, // 10 minutes
2006
+ maxSize: 15000
2007
+ }
2008
+ }
2009
+ });
2010
+
2011
+ // Monitor performance
2012
+ const stats = getCacheStats();
2013
+ console.log('LID Cache:', stats.lidCache.size, '/', stats.lidCache.maxSize);
2014
+
2015
+ // Clear cache if necessary
2016
+ clearCache();
2017
+ ```
2018
+
2019
+ ### 🛡️ Advanced JID Validation
2020
+
2021
+ ```typescript
2022
+ import { validateJid, Logger } from '@realvare/baileys';
2023
+
2024
+ const jid = '1234567890@s.whatsapp.net';
2025
+ const validation = validateJid(jid);
2026
+
2027
+ if (validation.isValid) {
2028
+ Logger.info('Valid JID:', jid);
2029
+ } else {
2030
+ Logger.error('Invalid JID:', validation.error);
2031
+ }
2032
+ ```
2033
+
2034
+ ### 📊 Conditional Logging
2035
+
2036
+ ```typescript
2037
+ import { Logger, setPerformanceConfig } from '@realvare/baileys';
2038
+
2039
+ // Configure logging
2040
+ setPerformanceConfig({
2041
+ debug: {
2042
+ enableLidLogging: true,
2043
+ enablePerformanceLogging: true,
2044
+ logLevel: 'debug' // 'error', 'warn', 'info', 'debug'
2045
+ }
2046
+ });
2047
+
2048
+ // Use conditional logger
2049
+ Logger.debug('Debug info');
2050
+ Logger.performance('Performance metrics');
2051
+ Logger.error('Error occurred');
2052
+ ```
2053
+
2054
+ ### 🔧 Performance Configuration
2055
+
2056
+ ```typescript
2057
+ import { setPerformanceConfig, getPerformanceConfig } from '@realvare/baileys';
2058
+
2059
+ // Complete configuration
2060
+ setPerformanceConfig({
2061
+ performance: {
2062
+ enableCache: true,
2063
+ enableMetrics: true,
2064
+ batchSize: 100,
2065
+ maxRetries: 3
2066
+ },
2067
+ cache: {
2068
+ lidCache: { ttl: 5 * 60 * 1000, maxSize: 10000 },
2069
+ jidCache: { ttl: 5 * 60 * 1000, maxSize: 10000 }
2070
+ },
2071
+ debug: {
2072
+ enableLidLogging: false,
2073
+ logLevel: 'warn'
2074
+ }
2075
+ });
2076
+
2077
+ // Get current configuration
2078
+ const config = getPerformanceConfig();
2079
+ console.log('Cache enabled:', config.performance.enableCache);
2080
+ ```
2081
+
2082
+ ---
2083
+
2084
+ ## 🧩 Events: LID and JID Management
2085
+
2086
+ The library enriches event payloads to provide both JID and LID, eliminating ambiguity in multi-device and group contexts.
2087
+
2088
+ **Key Features:**
2089
+ - Automatic JID/LID normalization in events
2090
+ - Pre-normalized fields in `msg.key` (`remoteJidNormalized`, `remoteLid`, `participantLid`)
2091
+ - Seamless conversion with `toJid()` and `normalizeJid()`
2092
+
2093
+ Refer to the examples in the **Quick Guide** and **API Documentation** sections for practical usage.
2094
+
2095
+ ---
2096
+
2097
+ ## ⚙️ Advanced Configuration
2098
+
2099
+ Customize the socket for performance and behavior.
2100
+
2101
+ ### 🔧 Complete Options for makeWASocket
2102
+
2103
+ ```typescript
2104
+ const sock = makeWASocket({
2105
+ // 🔐 Authentication
2106
+ auth: state,
2107
+
2108
+ // 🖥️ UI and Debug
2109
+ printQRInTerminal: true,
2110
+ logger: console,
2111
+ browser: ['VareBot', 'Chrome', '4.0.0'],
2112
+
2113
+ // ⏱️ Timeout and Connection
2114
+ defaultQueryTimeoutMs: 60000,
2115
+ keepAliveIntervalMs: 30000,
2116
+ connectTimeoutMs: 60000,
2117
+ retryRequestDelayMs: 250,
2118
+ maxMsgRetryCount: 5,
2119
+
2120
+ // 🎛️ Behavior
2121
+ markOnlineOnConnect: false, // Recommended: false to reduce ban risk
2122
+ syncFullHistory: false, // Keep false to prevent slowdowns
2123
+ fireInitQueries: true,
2124
+ generateHighQualityLinkPreview: true,
2125
+ });
2126
+ ```
2127
+ <div align="center">
2128
+
2129
+ ### 🛡️ Security and Encryption
2130
+
2131
+ | Feature | Description |
2132
+ |---------------------------|------------------------------------------|
2133
+ | 🔐 End-to-End Encryption | Signal protocol for secure messages |
2134
+ | 🔑 Key Management | Automatic key generation/rotation |
2135
+ | 🔍 Authentication | Security via QR code or pairing code |
2136
+ | 🛡️ Data Protection | Secure local credentials storage |
2137
+
2138
+ ---
2139
+
2140
+ ## 🌐 Support and Community
2141
+
2142
+ Join the community for help and contributions.
2143
+
2144
+ ### 📞 Contacts and Resources
2145
+
2146
+ | Channel | Link/Info |
2147
+ |------------------|------------------------------------------|
2148
+ | **Email** | [samakavare1@gmail.com](mailto:samakavare1@gmail.com) |
2149
+ | **GitHub Issues**| [Report Bug](https://github.com/realvare/based/issues) |
2150
+ | **PayPal** | [Donate](https://www.paypal.me/samakavare) |
2151
+ | **WhatsApp Channel**| [Channel](https://www.whatsapp.com/channel/0029VbB41Sa1Hsq1JhsC1Z1z) |
2152
+
2153
+ ---
2154
+
2155
+ ## 🙏 Acknowledgments
2156
+
2157
+ Thanks to the projects that inspire Based:
2158
+
2159
+ | Project | Contribution |
2160
+ |---------------------------|------------------------------------------|
2161
+ | [Baileys](https://github.com/WhiskeySockets/Baileys) | Original WhatsApp Web API |
2162
+ | [Yupra](https://www.npmjs.com/package/@yupra/baileys) | LID/JID Fix |
2163
+ | [Signal Protocol](https://signal.org/) | End-to-end encryption |
2164
+
2165
+ ---
2166
+
2167
+ ## ⚠️ Disclaimer & License
2168
+
2169
+ ### 📋 Legal Note
2170
+
2171
+ ⚠️ **Important**: Not affiliated with WhatsApp Inc. or Meta. Educational/development use only.
2172
+
2173
+ 🛡️ **Responsible Use**: Avoid spam, WhatsApp ToS violations. Risk of account ban.
2174
+
2175
+ ### 📜 MIT License
2176
+
2177
+ MIT License © 2025 [realvare](https://github.com/realvare)
2178
+
2179
+ See [LICENSE](LICENSE) for details.
2180
+
2181
+ ---
2182
+
2183
+ <div align="center">
2184
+ <table align="center">
2185
+ <tr>
2186
+ <td align="center">
2187
+ <img src="https://i.ibb.co/Cp0SQznC/sam2.png" width="120" height="120" alt="pfp" style="bysamakavare"/>
2188
+ <br><br>
2189
+ <h2>👨‍💻 Created by <a href="https://github.com/realvare" style="color: #8a2be2; text-decoration: none;">realvare</a></h2>
2190
+ <p><em>sam aka vare</em></p>
2191
+ </td>
2192
+ </tr>
2193
+ </table>
2194
+
2195
+ <br>
2196
+ <p align="center">
2197
+ <a href="https://github.com/realvare/based">
2198
+ <img src="https://img.shields.io/badge/⭐_Star_the_Project-8a2be2?style=for-the-badge&logo=github&logoColor=white&labelColor=2d1b69"/>
2199
+ </a>&nbsp;&nbsp;
2200
+ <a href="https://github.com/realvare/based/fork">
2201
+ <img src="https://img.shields.io/badge/🔄_Fork_Repository-8a2be2?style=for-the-badge&logo=github&logoColor=white&labelColor=2d1b69"/>
2202
+ </a>&nbsp;&nbsp;
2203
+ <a href="https://paypal.me/samakavare">
2204
+ <img src="https://img.shields.io/badge/💰_Donate-8a2be2?style=for-the-badge&logo=paypal&logoColor=white&labelColor=2d1b69"/>
2205
+ </a>
2206
+ </p>
2207
+ <p align="center">
2208
+ <a href="https://github.com/realvare">
2209
+ <img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white&color=8a2be2"/>
2210
+ </a>&nbsp;
2211
+ <a href="https://wa.me/393476686131">
2212
+ <img src="https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white&color=8a2be2"/>
2213
+ </a>&nbsp;
2214
+ <a href="https://instagram.com/samakavare">
2215
+ <img src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white&color=8a2be2"/>
2216
+ </a>&nbsp;
2217
+ <a href="mailto:samakavare1@gmail.com">
2218
+ <img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white&color=8a2be2"/>
2219
+ </a>
2220
+ </p>
2221
+ <div align="center">
2222
+ <p><strong>If it was useful to you, leave a star and/or consider a donation! ✧</strong></p>
2223
+
2224
+ <br>
2225
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&customColorList=24&height=120&section=footer&text=&fontSize=30&fontColor=ffffff&animation=fadeIn&fontAlignY=35"/>
2226
+
2227
+ </div>