@synacwave/baileys 0.0.0-stage → 0.4.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 (229) hide show
  1. package/ATTRIBUTION.md +14 -0
  2. package/CHANGELOG.md +35 -0
  3. package/LICENSE +23 -0
  4. package/README.md +493 -2
  5. package/README.upstream.md +2077 -0
  6. package/WAProto/index.d.ts +15942 -0
  7. package/WAProto/index.js +115911 -0
  8. package/engine-requirements.js +13 -0
  9. package/lib/Defaults/index.d.ts +145 -0
  10. package/lib/Defaults/index.js +155 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.js +12 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  14. package/lib/Signal/Group/group-session-builder.js +30 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +11 -0
  16. package/lib/Signal/Group/group_cipher.js +82 -0
  17. package/lib/Signal/Group/index.d.ts +12 -0
  18. package/lib/Signal/Group/index.js +12 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  20. package/lib/Signal/Group/keyhelper.js +18 -0
  21. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  22. package/lib/Signal/Group/sender-chain-key.js +26 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  24. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  25. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  26. package/lib/Signal/Group/sender-key-message.js +66 -0
  27. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  28. package/lib/Signal/Group/sender-key-name.js +48 -0
  29. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  30. package/lib/Signal/Group/sender-key-record.js +41 -0
  31. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  32. package/lib/Signal/Group/sender-key-state.js +84 -0
  33. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  34. package/lib/Signal/Group/sender-message-key.js +26 -0
  35. package/lib/Signal/libsignal.d.ts +55 -0
  36. package/lib/Signal/libsignal.js +431 -0
  37. package/lib/Signal/lid-mapping.d.ts +21 -0
  38. package/lib/Signal/lid-mapping.js +277 -0
  39. package/lib/Socket/Client/index.d.ts +3 -0
  40. package/lib/Socket/Client/index.js +3 -0
  41. package/lib/Socket/Client/types.d.ts +6 -0
  42. package/lib/Socket/Client/types.js +11 -0
  43. package/lib/Socket/Client/websocket.d.ts +13 -0
  44. package/lib/Socket/Client/websocket.js +54 -0
  45. package/lib/Socket/business.d.ts +395 -0
  46. package/lib/Socket/business.js +380 -0
  47. package/lib/Socket/chats.d.ts +144 -0
  48. package/lib/Socket/chats.js +1219 -0
  49. package/lib/Socket/communities.d.ts +562 -0
  50. package/lib/Socket/communities.js +432 -0
  51. package/lib/Socket/groups.d.ts +286 -0
  52. package/lib/Socket/groups.js +348 -0
  53. package/lib/Socket/index.d.ts +531 -0
  54. package/lib/Socket/index.js +13 -0
  55. package/lib/Socket/messages-recv.d.ts +334 -0
  56. package/lib/Socket/messages-recv.js +1772 -0
  57. package/lib/Socket/messages-send.d.ts +330 -0
  58. package/lib/Socket/messages-send.js +1372 -0
  59. package/lib/Socket/mex.d.ts +2 -0
  60. package/lib/Socket/mex.js +42 -0
  61. package/lib/Socket/newsletter.d.ts +283 -0
  62. package/lib/Socket/newsletter.js +226 -0
  63. package/lib/Socket/socket.d.ts +61 -0
  64. package/lib/Socket/socket.js +970 -0
  65. package/lib/Store/index.d.ts +4 -0
  66. package/lib/Store/index.js +4 -0
  67. package/lib/Store/make-in-memory-store.d.ts +63 -0
  68. package/lib/Store/make-in-memory-store.js +421 -0
  69. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  70. package/lib/Store/make-ordered-dictionary.js +79 -0
  71. package/lib/Store/object-repository.d.ts +11 -0
  72. package/lib/Store/object-repository.js +24 -0
  73. package/lib/Types/Auth.d.ts +2 -0
  74. package/lib/Types/Auth.js +2 -0
  75. package/lib/Types/Bussines.d.ts +2 -0
  76. package/lib/Types/Bussines.js +2 -0
  77. package/lib/Types/Call.d.ts +2 -0
  78. package/lib/Types/Call.js +2 -0
  79. package/lib/Types/Chat.d.ts +2 -0
  80. package/lib/Types/Chat.js +8 -0
  81. package/lib/Types/Contact.d.ts +2 -0
  82. package/lib/Types/Contact.js +2 -0
  83. package/lib/Types/Events.d.ts +2 -0
  84. package/lib/Types/Events.js +2 -0
  85. package/lib/Types/GroupMetadata.d.ts +2 -0
  86. package/lib/Types/GroupMetadata.js +2 -0
  87. package/lib/Types/Label.d.ts +3 -0
  88. package/lib/Types/Label.js +25 -0
  89. package/lib/Types/LabelAssociation.d.ts +3 -0
  90. package/lib/Types/LabelAssociation.js +7 -0
  91. package/lib/Types/Message.d.ts +12 -0
  92. package/lib/Types/Message.js +18 -0
  93. package/lib/Types/Mex.d.ts +3 -0
  94. package/lib/Types/Mex.js +39 -0
  95. package/lib/Types/Product.d.ts +2 -0
  96. package/lib/Types/Product.js +2 -0
  97. package/lib/Types/RichType.d.ts +3 -0
  98. package/lib/Types/RichType.js +23 -0
  99. package/lib/Types/Signal.d.ts +2 -0
  100. package/lib/Types/Signal.js +2 -0
  101. package/lib/Types/Socket.d.ts +2 -0
  102. package/lib/Types/Socket.js +2 -0
  103. package/lib/Types/State.d.ts +6 -0
  104. package/lib/Types/State.js +56 -0
  105. package/lib/Types/USync.d.ts +2 -0
  106. package/lib/Types/USync.js +2 -0
  107. package/lib/Types/index.d.ts +14 -0
  108. package/lib/Types/index.js +26 -0
  109. package/lib/Utils/api-wrappers.d.ts +70 -0
  110. package/lib/Utils/api-wrappers.js +248 -0
  111. package/lib/Utils/auth-utils.d.ts +58 -0
  112. package/lib/Utils/auth-utils.js +306 -0
  113. package/lib/Utils/browser-utils.d.ts +10 -0
  114. package/lib/Utils/browser-utils.js +29 -0
  115. package/lib/Utils/business.d.ts +50 -0
  116. package/lib/Utils/business.js +231 -0
  117. package/lib/Utils/chat-utils.d.ts +409 -0
  118. package/lib/Utils/chat-utils.js +886 -0
  119. package/lib/Utils/companion-reg-client-utils.d.ts +5 -0
  120. package/lib/Utils/companion-reg-client-utils.js +40 -0
  121. package/lib/Utils/crypto.d.ts +40 -0
  122. package/lib/Utils/crypto.js +118 -0
  123. package/lib/Utils/decode-wa-message.d.ts +84 -0
  124. package/lib/Utils/decode-wa-message.js +317 -0
  125. package/lib/Utils/event-buffer.d.ts +13 -0
  126. package/lib/Utils/event-buffer.js +622 -0
  127. package/lib/Utils/generics.d.ts +64 -0
  128. package/lib/Utils/generics.js +395 -0
  129. package/lib/Utils/history.d.ts +76 -0
  130. package/lib/Utils/history.js +134 -0
  131. package/lib/Utils/identity-change-handler.d.ts +14 -0
  132. package/lib/Utils/identity-change-handler.js +50 -0
  133. package/lib/Utils/index.d.ts +28 -0
  134. package/lib/Utils/index.js +30 -0
  135. package/lib/Utils/link-preview.d.ts +13 -0
  136. package/lib/Utils/link-preview.js +85 -0
  137. package/lib/Utils/logger.d.ts +3 -0
  138. package/lib/Utils/logger.js +3 -0
  139. package/lib/Utils/lt-hash.d.ts +7 -0
  140. package/lib/Utils/lt-hash.js +8 -0
  141. package/lib/Utils/make-mutex.d.ts +7 -0
  142. package/lib/Utils/make-mutex.js +33 -0
  143. package/lib/Utils/message-retry-manager.d.ts +80 -0
  144. package/lib/Utils/message-retry-manager.js +265 -0
  145. package/lib/Utils/messages-media.d.ts +137 -0
  146. package/lib/Utils/messages-media.js +843 -0
  147. package/lib/Utils/messages.d.ts +46 -0
  148. package/lib/Utils/messages.js +1840 -0
  149. package/lib/Utils/noise-handler.d.ts +21 -0
  150. package/lib/Utils/noise-handler.js +201 -0
  151. package/lib/Utils/offline-node-processor.d.ts +10 -0
  152. package/lib/Utils/offline-node-processor.js +40 -0
  153. package/lib/Utils/pre-key-manager.d.ts +26 -0
  154. package/lib/Utils/pre-key-manager.js +106 -0
  155. package/lib/Utils/process-message.d.ts +84 -0
  156. package/lib/Utils/process-message.js +749 -0
  157. package/lib/Utils/reporting-utils.d.ts +13 -0
  158. package/lib/Utils/reporting-utils.js +258 -0
  159. package/lib/Utils/rich-message-utils.d.ts +49 -0
  160. package/lib/Utils/rich-message-utils.js +363 -0
  161. package/lib/Utils/signal.d.ts +83 -0
  162. package/lib/Utils/signal.js +201 -0
  163. package/lib/Utils/stanza-ack.d.ts +17 -0
  164. package/lib/Utils/stanza-ack.js +38 -0
  165. package/lib/Utils/status-utils.js +178 -0
  166. package/lib/Utils/sticker-reaction.js +104 -0
  167. package/lib/Utils/synacwave.d.ts +111 -0
  168. package/lib/Utils/synacwave.js +474 -0
  169. package/lib/Utils/sync-action-utils.d.ts +3 -0
  170. package/lib/Utils/sync-action-utils.js +49 -0
  171. package/lib/Utils/tc-token-utils.d.ts +30 -0
  172. package/lib/Utils/tc-token-utils.js +164 -0
  173. package/lib/Utils/use-multi-file-auth-state.d.ts +11 -0
  174. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  175. package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
  176. package/lib/Utils/use-single-file-auth-state.js +109 -0
  177. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  178. package/lib/Utils/use-sqlite-auth-state.js +109 -0
  179. package/lib/Utils/validate-connection.d.ts +44 -0
  180. package/lib/Utils/validate-connection.js +210 -0
  181. package/lib/Utils/view-once-text.d.ts +32 -0
  182. package/lib/Utils/view-once-text.js +213 -0
  183. package/lib/WABinary/constants.d.ts +62 -0
  184. package/lib/WABinary/constants.js +1467 -0
  185. package/lib/WABinary/decode.d.ts +10 -0
  186. package/lib/WABinary/decode.js +262 -0
  187. package/lib/WABinary/encode.d.ts +3 -0
  188. package/lib/WABinary/encode.js +220 -0
  189. package/lib/WABinary/generic-utils.d.ts +77 -0
  190. package/lib/WABinary/generic-utils.js +226 -0
  191. package/lib/WABinary/index.d.ts +6 -0
  192. package/lib/WABinary/index.js +6 -0
  193. package/lib/WABinary/jid-utils.d.ts +29 -0
  194. package/lib/WABinary/jid-utils.js +96 -0
  195. package/lib/WABinary/types.d.ts +2 -0
  196. package/lib/WABinary/types.js +2 -0
  197. package/lib/WAM/BinaryInfo.d.ts +8 -0
  198. package/lib/WAM/BinaryInfo.js +10 -0
  199. package/lib/WAM/constants.d.ts +34927 -0
  200. package/lib/WAM/constants.js +22853 -0
  201. package/lib/WAM/encode.d.ts +2 -0
  202. package/lib/WAM/encode.js +150 -0
  203. package/lib/WAM/index.d.ts +4 -0
  204. package/lib/WAM/index.js +4 -0
  205. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
  206. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  207. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  208. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  209. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  210. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  211. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  212. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  213. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  214. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  215. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  216. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  217. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
  218. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  219. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  220. package/lib/WAUSync/Protocols/index.js +6 -0
  221. package/lib/WAUSync/USyncQuery.d.ts +21 -0
  222. package/lib/WAUSync/USyncQuery.js +98 -0
  223. package/lib/WAUSync/USyncUser.d.ts +17 -0
  224. package/lib/WAUSync/USyncUser.js +31 -0
  225. package/lib/WAUSync/index.d.ts +4 -0
  226. package/lib/WAUSync/index.js +4 -0
  227. package/lib/index.d.ts +12 -0
  228. package/lib/index.js +12 -0
  229. package/package.json +118 -5
package/ATTRIBUTION.md ADDED
@@ -0,0 +1,14 @@
1
+ # Attribution
2
+
3
+ `@synacwave/baileys` is a derivative work. It is not an original implementation.
4
+
5
+ - **itsliaaa/baileys** (Lia Wynn), https://github.com/itsliaaa/baileys: the direct upstream. This fork starts from version 0.3.18-final.
6
+ - **WhiskeySockets/Baileys** (Rajeh Taher and contributors), https://github.com/WhiskeySockets/Baileys: the Baileys project that itsliaaa/baileys is itself based on.
7
+
8
+ Both are MIT licensed. Their copyright notices are kept in `LICENSE`. The only addition is a line for the modifications made in this fork. The licence is not changed. The original upstream README is kept as `README.upstream.md`.
9
+
10
+ ## Modifications in this fork
11
+
12
+ See `CHANGELOG.md`. Sound stickers, shared chat themes, view-once text helpers, rich message convenience APIs, social profile helpers, album/video-grid wrappers and related utilities were added in this fork.
13
+
14
+ This project is not affiliated with or endorsed by WhatsApp or Meta.
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0
4
+
5
+ Fork of @itsliaaa/baileys 0.3.18-final.
6
+
7
+ ### Added
8
+
9
+ - Group status APIs: `sendGroupStatusMessage`, `sendGroupStatusMessageClosefriends` with configurable ring name/emoji/colour (`statusAudienceMetadata`).
10
+ - Broadcast status helper: `sendStatus` (requires `statusJidList`).
11
+ - Sticker reaction API: `sendStickerReaction` using `messageAssociation.associationType = 11`.
12
+ - Helpers: `buildGroupStatusContextInfo`, `buildStickerReactionPayload`, `extractStickerMessage`, `isStickerReactionMessage`.
13
+
14
+
15
+ - `StickerMessage.audioMessage` (protobuf field 26) for sound stickers.
16
+ - Chat theme / wallpaper support (ProtocolMessage type 34, solid colour ARGB fields, wallpaper media mapping).
17
+ - Socket methods: `sendSoundSticker`, `sendPremiumSticker`, `setChatTheme`, `setChatThemeColor`, `setChatBubbleScheme`, `setChatWallpaper`, `clearChatTheme`, `getChatThemeDiagnostics`.
18
+ - View-once text: `sendViewOnceText`, `sendViewOnceTextMessage`, `sendVotext` with ordered payload strategies.
19
+ - Rich / unified response helpers: `sendUnifiedResponse`, `sendRichMessage`, `sendRichAIResponse`, `sendRichText`, `sendMarkdownQuote`, `sendRichImage`, `sendRichLink`, `sendTable`, `sendList`, `sendCodeBlock`, `sendLatex`, `sendButtons`, `sendNativeFlow`, and related.
20
+ - Album and video-grid helpers: `sendAlbumMessage`, `sendVideoGridMessage`.
21
+ - Social profile cards: `sendInstagramProfile`, `sendFacebookProfile`, `sendTikTokProfile`, `sendYouTubeProfile`, `sendXProfile`, `sendSocialProfile`.
22
+ - Favorites: `addToFavorites`, `removeFromFavorites`.
23
+ - Meta AI group helpers: `addMetaAI`, `removeMetaAI`, `hasMetaAI`.
24
+ - Message / bot helpers: `getMessageContext`, `getMessageText`, `getMessageType`, `getMentions`, `getQuotedMessage`, `getMediaBuffer`, `isViewOnce`, `isFromBot`, `getBotJid`, `isGroupAdmin`, `formatMention`.
25
+ - TypeScript declarations for the new surface.
26
+ - Local tests under `test/`.
27
+
28
+ ### Changed
29
+
30
+ - Package name `@synacwave/baileys`.
31
+ - README rewritten as a full API reference.
32
+
33
+ ### Notes
34
+
35
+ - Client-side rendering of new message types is not verified by the test suite.
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Rajeh Taher/WhiskeySockets
4
+ Copyright (c) 2026 Lia Wynn
5
+ Copyright (c) 2026 synacwave (modifications in @synacwave/baileys)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,494 @@
1
- # Temporary Holding Version
1
+ # @synacwave/baileys
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Fork of [itsliaaa/baileys](https://github.com/itsliaaa/baileys), itself based on [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys).
4
+
5
+ ESM, Node.js 20+. Upstream connection, auth, Signal, group, newsletter, community and core message APIs are unchanged. See `README.upstream.md` for the full upstream reference.
6
+
7
+ This fork adds native sound stickers, shared chat themes, view-once text, rich/unified response helpers, social profile cards, album helpers and a set of bot/message utility methods.
8
+
9
+ **Status labels**
10
+ - **local** — encoding and control flow covered by tests in `test/`
11
+ - **unverified** — not checked against a live WhatsApp client
12
+
13
+ Nothing in the fork has been run against live WhatsApp by its tests.
14
+
15
+ ## Contents
16
+
17
+ 1. [Installation](#1-installation)
18
+ 2. [Quick start](#2-quick-start)
19
+ 3. [Connection and authentication](#3-connection-and-authentication)
20
+ 4. [Browser configuration](#4-browser-configuration)
21
+ 5. [Sending messages](#5-sending-messages)
22
+ 6. [Media APIs](#6-media-apis)
23
+ 7. [Sound stickers](#7-sound-stickers)
24
+ 8. [Premium stickers](#8-premium-stickers)
25
+ 9. [View-once messages](#9-view-once-messages)
26
+ 10. [Chat themes and wallpapers](#10-chat-themes-and-wallpapers)
27
+ 11. [AI and Meta AI](#11-ai-and-meta-ai)
28
+ 12. [AIRich and unified responses](#12-airich-and-unified-responses)
29
+ 13. [Tables, lists, code and LaTeX](#13-tables-lists-code-and-latex)
30
+ 14. [Interactive messages](#14-interactive-messages)
31
+ 15. [Carousels, albums and grids](#15-carousels-albums-and-grids)
32
+ 16. [Social and entity cards](#16-social-and-entity-cards)
33
+ 17. [Channels, groups and communities](#17-channels-groups-and-communities)
34
+ 18. [Status and stories](#18-status-and-stories)
35
+ 19. [Account, profile and privacy](#19-account-profile-and-privacy)
36
+ 20. [Favorites](#20-favorites)
37
+ 21. [Message context and utility helpers](#21-message-context-and-utility-helpers)
38
+ 22. [Events](#22-events)
39
+ 23. [Complete public API reference](#23-complete-public-api-reference)
40
+ 24. [TypeScript](#24-typescript)
41
+ 25. [Troubleshooting](#25-troubleshooting)
42
+ 26. [Development and testing](#26-development-and-testing)
43
+ 27. [Attribution and license](#27-attribution-and-license)
44
+
45
+ ## 1. Installation
46
+
47
+ ```bash
48
+ npm install @synacwave/baileys
49
+ ```
50
+
51
+ Optional peers (same as upstream): `sharp` or `jimp`, `link-preview-js`, `audio-decode`, `better-sqlite3`.
52
+
53
+ ## 2. Quick start
54
+
55
+ ```js
56
+ import makeWASocket, { useMultiFileAuthState } from '@synacwave/baileys';
57
+
58
+ const { state, saveCreds } = await useMultiFileAuthState('auth');
59
+ const sock = makeWASocket({ auth: state });
60
+ sock.ev.on('creds.update', saveCreds);
61
+
62
+ sock.ev.on('messages.upsert', async ({ messages }) => {
63
+ for (const msg of messages) {
64
+ if (!msg.message || msg.key.fromMe) continue;
65
+ const text = sock.getMessageText(msg);
66
+ if (text === 'ping') {
67
+ await sock.sendMessage(msg.key.remoteJid, { text: 'pong' });
68
+ }
69
+ }
70
+ });
71
+ ```
72
+
73
+ All convenience methods added by this fork are attached to the socket returned by `makeWASocket`.
74
+
75
+ ## 3. Connection and authentication
76
+
77
+ Same as upstream. Multi-file and single-file auth states are supported.
78
+
79
+ ```js
80
+ import { useMultiFileAuthState, useSingleFileAuthState } from '@synacwave/baileys';
81
+ ```
82
+
83
+ ## 4. Browser configuration
84
+
85
+ ```js
86
+ import { Browsers } from '@synacwave/baileys';
87
+
88
+ const sock = makeWASocket({
89
+ auth: state,
90
+ browser: Browsers.macOS('Desktop'), // or Browsers.ubuntu, Browsers.windows, Browsers.android, etc.
91
+ });
92
+ ```
93
+
94
+ ## 5. Sending messages
95
+
96
+ Core `sock.sendMessage(jid, content, options)` is unchanged from upstream. Content can be text, media, interactive, rich, etc.
97
+
98
+ ```js
99
+ await sock.sendMessage(jid, { text: 'hello' });
100
+ await sock.sendMessage(jid, { text: 'hello', mentions: [userJid] });
101
+ await sock.sendMessage(jid, { text: 'reply' }, { quoted: msg });
102
+ ```
103
+
104
+ ## 6. Media APIs
105
+
106
+ Standard media sending (image, video, audio, document, sticker) works as upstream. Use `prepareWAMessageMedia` / `generateWAMessageFromContent` when you need lower-level control.
107
+
108
+ ## 7. Sound stickers
109
+
110
+ Send a sticker that also carries an audio track in a single message (StickerMessage field 26).
111
+
112
+ ```js
113
+ await sock.sendSoundSticker(jid, {
114
+ sticker: './sticker.webp', // Buffer | path | URL
115
+ audio: './sound.ogg', // Buffer | path | URL (Ogg Opus recommended)
116
+ mimetype: 'audio/ogg; codecs=opus',
117
+ seconds: 3,
118
+ }, { quoted: msg });
119
+ ```
120
+
121
+ Requirements:
122
+ - Sticker and audio are embedded in one message.
123
+ - Animated stickers are supported.
124
+ - Ogg Opus is the preferred audio format.
125
+
126
+ ## 8. Premium stickers
127
+
128
+ ```js
129
+ await sock.sendPremiumSticker(jid, {
130
+ sticker: bufferOrPath,
131
+ // additional premium sticker metadata accepted by the protobuf
132
+ }, options);
133
+ ```
134
+
135
+ ## 9. View-once messages
136
+
137
+ ### View-once text
138
+
139
+ ```js
140
+ await sock.sendViewOnceText(jid, 'This message disappears after viewing');
141
+ await sock.sendViewOnceText(jid, 'Secret', { quoted: msg, messageId: 'CUSTOM_ID' });
142
+
143
+ // aliases
144
+ await sock.sendViewOnceTextMessage(jid, text);
145
+ await sock.sendVotext(jid, text);
146
+ ```
147
+
148
+ Strategies tried in order (first that the local pipeline accepts is used):
149
+
150
+ 1. Inline `ExtendedTextMessage.viewOnce = true`
151
+ 2. Lia-compatible `{ text, viewOnce: true }`
152
+ 3. Outer `viewOnceMessage` wrapper
153
+ 4. `viewOnceMessageV2`
154
+ 5. Fallback: 1×1 transparent PNG with the text as caption + view-once
155
+
156
+ The method returns the generated message. Pure text-only view-once is not guaranteed to be supported by every client; the image fallback is explicit.
157
+
158
+ ### Detection
159
+
160
+ ```js
161
+ import { isViewOnce } from '@synacwave/baileys';
162
+ if (isViewOnce(msg)) { /* ... */ }
163
+ ```
164
+
165
+ ## 10. Chat themes and wallpapers
166
+
167
+ ```js
168
+ await sock.setChatTheme(jid, 'red'); // preset colour name
169
+ await sock.setChatThemeColor(jid, 'FF0000'); // custom hex
170
+ await sock.setChatBubbleScheme(jid, 'emerald');
171
+ await sock.setChatWallpaper(jid, { /* wallpaper media */ });
172
+ await sock.clearChatTheme(jid);
173
+
174
+ const diag = await sock.getChatThemeDiagnostics();
175
+ ```
176
+
177
+ Presets and bubble schemes are defined in the library. ProtocolMessage type 34 is used. Client acceptance is **unverified**.
178
+
179
+ ## 11. AI and Meta AI
180
+
181
+ ### Group helpers
182
+
183
+ ```js
184
+ await sock.addMetaAI(groupJid);
185
+ await sock.removeMetaAI(groupJid);
186
+ const present = await sock.hasMetaAI(groupJid);
187
+ ```
188
+
189
+ ### Message helpers
190
+
191
+ ```js
192
+ import { isFromBot, getBotJid, isMetaAiParticipant } from '@synacwave/baileys';
193
+ ```
194
+
195
+ ## 12. AIRich and unified responses
196
+
197
+ High-level builders that produce rich / unified response payloads and send them via the normal message pipeline.
198
+
199
+ ```js
200
+ await sock.sendUnifiedResponse(jid, {
201
+ headerText: 'Status',
202
+ contentText: 'Everything is online',
203
+ code: 'console.log("ok")',
204
+ language: 'javascript',
205
+ });
206
+
207
+ await sock.sendRichMessage(jid, {
208
+ sections: [ /* raw section objects */ ],
209
+ });
210
+
211
+ await sock.sendRichAIResponse(jid, { richResponse: [ /* ... */ ] });
212
+ await sock.sendRichText(jid, 'Hello **world**');
213
+ await sock.sendMarkdownQuote(jid, 'quoted\nlines');
214
+ await sock.sendRichImage(jid, 'https://example.com/img.png', { caption: '...' });
215
+ await sock.sendRichLink(jid, { text: 'Open', url: 'https://example.com' });
216
+ ```
217
+
218
+ Optional sections (tables, lists, code, sources, product cards, etc.) can be mixed in one response depending on the payload shape accepted by `sendMessage`.
219
+
220
+ ## 13. Tables, lists, code and LaTeX
221
+
222
+ ```js
223
+ await sock.sendTable(jid, [
224
+ ['Name', 'Value'],
225
+ ['uptime', '99.9%'],
226
+ ], { title: 'Metrics' });
227
+
228
+ await sock.sendList(jid, ['item 1', 'item 2'], { title: 'Options' });
229
+ await sock.sendCodeBlock(jid, 'const x = 1;', { language: 'javascript' });
230
+ await sock.sendLatex(jid, 'Formula', [{ latexExpression: 'E = mc^2' }]);
231
+ ```
232
+
233
+ ## 14. Interactive messages
234
+
235
+ ```js
236
+ await sock.sendButtons(jid, 'Choose', [
237
+ { buttonId: 'yes', buttonText: { displayText: 'Yes' }, type: 1 },
238
+ { buttonId: 'no', buttonText: { displayText: 'No' }, type: 1 },
239
+ ]);
240
+
241
+ await sock.sendNativeFlow(jid, { /* native flow content */ });
242
+ // Also supported via plain sendMessage with interactiveMessage / nativeFlowMessage / etc.
243
+ ```
244
+
245
+ Copy buttons, call actions, URL actions and hydrated templates can be sent through the normal content shapes.
246
+
247
+ ## 15. Carousels, albums and grids
248
+
249
+ ```js
250
+ await sock.sendAlbumMessage(jid, [
251
+ { image: buffer1 },
252
+ { image: buffer2 },
253
+ { video: buffer3 },
254
+ ]);
255
+
256
+ await sock.sendVideoGridMessage(jid, [video1, video2, video3]);
257
+ // Carousel cards can be built and sent via interactive / native-flow payloads
258
+ ```
259
+
260
+ ## 16. Social and entity cards
261
+
262
+ ```js
263
+ await sock.sendInstagramProfile(jid, { username: 'user', /* optional profile pic, bio, url */ });
264
+ await sock.sendFacebookProfile(jid, { username: 'user' });
265
+ await sock.sendTikTokProfile(jid, { username: 'user' });
266
+ await sock.sendYouTubeProfile(jid, { username: 'channel' });
267
+ await sock.sendXProfile(jid, { username: 'handle' });
268
+ await sock.sendSocialProfile(jid, { platform: 'instagram', username: 'user', url: '...' });
269
+ ```
270
+
271
+ ## 17. Channels, groups and communities
272
+
273
+ All upstream newsletter, group and community methods are available:
274
+
275
+ - `groupCreate`, `groupMetadata`, `groupParticipantsUpdate`, `groupUpdateSubject`, `groupUpdateDescription`, `groupSettingUpdate`, `groupLeave`, ...
276
+ - Newsletter / channel create, metadata, follow, mute, picture, etc.
277
+ - Community create, link, unlink, etc.
278
+ - `updateMemberLabel` (member labels)
279
+
280
+ ## 18. Status and stories
281
+
282
+ ```js
283
+ await sock.sendMessage('status@broadcast', {
284
+ text: 'status update',
285
+ statusJidList: [/* contacts who can see it */],
286
+ });
287
+ ```
288
+
289
+ ## 19. Account, profile and privacy
290
+
291
+ Upstream methods for profile name/about, business profile, privacy settings, disappearing messages, LID mapping, bot list, call links, app-state sync and dirty-bit utilities remain available.
292
+
293
+ ## 20. Favorites
294
+
295
+ ```js
296
+ await sock.addToFavorites(jidOrJids, { current: existingList });
297
+ await sock.removeFromFavorites(jidOrJids, { current: existingList });
298
+ ```
299
+
300
+ ## 21. Message context and utility helpers
301
+
302
+ ```js
303
+ const ctx = sock.getMessageContext(msg);
304
+ const text = sock.getMessageText(msg);
305
+ const type = sock.getMessageType(msg);
306
+ const mentions = sock.getMentions(msg);
307
+ const quoted = sock.getQuotedMessage(msg);
308
+ const isVO = sock.isViewOnce(msg);
309
+ const isBot = sock.isFromBot(msg);
310
+ const botJid = sock.getBotJid(msg);
311
+ const admin = await sock.isGroupAdmin(groupJid, userJid);
312
+ const mention = sock.formatMention(jid);
313
+
314
+ // also available as named exports for use outside the socket
315
+ import {
316
+ getMessageText, getMessageType, getMentions, getQuotedMessage,
317
+ isViewOnce, isFromBot, formatMention, buildMessageContext
318
+ } from '@synacwave/baileys';
319
+ ```
320
+
321
+ ## 22. Events
322
+
323
+ Standard Baileys events (`connection.update`, `creds.update`, `messages.upsert`, `messages.update`, `groups.update`, `group-participants.update`, `contacts.update`, etc.) are unchanged.
324
+
325
+ ## 23. Complete public API reference
326
+
327
+ ### Socket methods (added or extended by this fork)
328
+
329
+ | Method | Description |
330
+ |--------|-------------|
331
+ | `sendSoundSticker(jid, { sticker, audio, mimetype?, seconds? }, options?)` | Send sticker + audio in one message |
332
+ | `sendPremiumSticker(jid, content, options?)` | Send premium sticker |
333
+ | `sendViewOnceText(jid, text, options?)` | View-once text (multi-strategy) |
334
+ | `sendViewOnceTextMessage(jid, text, options?)` | Alias |
335
+ | `sendVotext(jid, text, options?)` | Alias |
336
+ | `sendStatus(content, options)` | Broadcast status to status@broadcast |
337
+ | `sendGroupStatusMessage(groupJid, content, options?)` | Group status / story |
338
+ | `sendGroupStatusMessageClosefriends(groupJid, content, options?)` | Group status with Close Friends-style ring |
339
+ | `sendStickerReaction(jid, parentKey, sticker, options?)` | Sticker reaction (associationType 11) |
340
+ | `setChatTheme(jid, presetName)` | Apply colour preset theme |
341
+ | `setChatThemeColor(jid, hex)` | Apply custom hex colour |
342
+ | `setChatBubbleScheme(jid, scheme)` | Set bubble scheme |
343
+ | `setChatWallpaper(jid, wallpaper)` | Set wallpaper |
344
+ | `clearChatTheme(jid)` | Reset theme |
345
+ | `getChatThemeDiagnostics()` | Diagnostic info |
346
+ | `sendUnifiedResponse(jid, content, options?)` | High-level unified / rich response |
347
+ | `sendRichMessage(jid, content, options?)` | Convenience rich message |
348
+ | `sendRichAIResponse(jid, content, options?)` | Rich AI response array |
349
+ | `sendRichText(jid, text, extra?, options?)` | Rich text |
350
+ | `sendMarkdownQuote(jid, text, extra?, options?)` | Markdown-style quote |
351
+ | `sendRichImage(jid, url, extra?, options?)` | Rich image card |
352
+ | `sendRichLink(jid, link\|links, options?)` | Link card(s) |
353
+ | `sendTable(jid, rows, extra?, options?)` | Table |
354
+ | `sendList(jid, items, extra?, options?)` | List |
355
+ | `sendCodeBlock(jid, code, extra?, options?)` | Code block |
356
+ | `sendLatex(jid, text, expressions, options?)` | LaTeX expressions |
357
+ | `sendButtons(jid, text, buttons, extra?, options?)` | Buttons |
358
+ | `sendNativeFlow(jid, content, options?)` | Native flow |
359
+ | `sendAlbumMessage(jid, items, options?)` | Album |
360
+ | `sendVideoGridMessage(jid, videos, options?)` | Video grid / album of videos |
361
+ | `sendInstagramProfile(jid, opts)` | Instagram profile card |
362
+ | `sendFacebookProfile(jid, opts)` | Facebook profile card |
363
+ | `sendTikTokProfile(jid, opts)` | TikTok profile card |
364
+ | `sendYouTubeProfile(jid, opts)` | YouTube profile card |
365
+ | `sendXProfile(jid, opts)` | X / Twitter profile card |
366
+ | `sendSocialProfile(jid, opts)` | Generic social profile |
367
+ | `addMetaAI(groupJid)` | Add Meta AI to group |
368
+ | `removeMetaAI(groupJid)` | Remove Meta AI from group |
369
+ | `hasMetaAI(groupJid)` | Check whether Meta AI is present |
370
+ | `addToFavorites(jids, { current })` | Add to favorites |
371
+ | `removeFromFavorites(jids, { current })` | Remove from favorites |
372
+ | `getMessageContext(msg)` | Build context object |
373
+ | `getMessageText(msg)` | Extract text |
374
+ | `getMessageType(msg)` | Content type |
375
+ | `getMentions(msg)` | Mentioned JIDs |
376
+ | `getQuotedMessage(msg)` | Quoted message |
377
+ | `getMediaBuffer(msg)` | Download media to Buffer |
378
+ | `isViewOnce(msg)` | Detect view-once |
379
+ | `isFromBot(msg)` | Detect bot origin |
380
+ | `getBotJid(msg)` | Bot JID if any |
381
+ | `isGroupAdmin(groupJid, userJid)` | Admin check |
382
+ | `formatMention(jid)` | `@number` string |
383
+
384
+ ### Named exports (selection)
385
+
386
+ `makeWASocket`, `useMultiFileAuthState`, `useSingleFileAuthState`, `Browsers`, `proto`, `DownloadableMessage`, media helpers, `isViewOnce`, `getMessageText`, `getMessageType`, `formatMention`, `buildMessageContext`, `CHAT_THEME_COLORS`, `CHAT_BUBBLE_SCHEMES`, `CHAT_THEME_PRESETS`, `VIEW_ONCE_TEXT_STRATEGIES`, and the rest of the upstream public surface.
387
+
388
+ ## 24. TypeScript
389
+
390
+ The package ships TypeScript declarations (`lib/index.d.ts` and per-module `.d.ts` files). Methods added by the fork are typed.
391
+
392
+ ```ts
393
+ import makeWASocket, { WASocket } from '@synacwave/baileys';
394
+ const sock: WASocket = makeWASocket({ auth: state });
395
+ await sock.sendViewOnceText(jid, 'secret');
396
+ ```
397
+
398
+ ## 25. Troubleshooting
399
+
400
+ - **Module not found / ESM errors** — ensure `"type": "module"` and Node ≥ 20.
401
+ - **Sound sticker silent** — verify the audio is valid Ogg Opus and that the sticker was prepared with the audio field populated.
402
+ - **Theme not applied** — client support for ProtocolMessage type 34 is not guaranteed; use diagnostics.
403
+ - **View-once text not disappearing** — the library tries multiple wire formats; some clients only honour media view-once.
404
+
405
+ ## 26. Development and testing
406
+
407
+ ```bash
408
+ npm install
409
+ npm test
410
+ ```
411
+
412
+ Tests cover local encoding, payload shape and control flow only. They do not prove live client behaviour.
413
+
414
+
415
+ ## Status and group status
416
+
417
+ Broadcast status (stories) and group status messages.
418
+
419
+ ### Broadcast status
420
+
421
+ ```js
422
+ await sock.sendStatus(
423
+ { text: 'Hello from Synacwave', backgroundColor: '#9C27B0', font: 1 },
424
+ { statusJidList: ['123@s.whatsapp.net', '456@s.whatsapp.net'] }
425
+ );
426
+ ```
427
+
428
+ `statusJidList` is required (contacts who may see the status).
429
+
430
+ ### Group status
431
+
432
+ ```js
433
+ await sock.sendGroupStatusMessage(groupJid, {
434
+ text: 'Group story',
435
+ backgroundColor: '#000000',
436
+ font: 1
437
+ }, {
438
+ ringName: 'Synacwave',
439
+ ringEmoji: '🪼',
440
+ ringColor: 'purple' // red | pink | blue | yellow | purple | green | orange | cyan
441
+ });
442
+
443
+ // Close Friends-style audience metadata
444
+ await sock.sendGroupStatusMessageClosefriends(groupJid, {
445
+ text: 'Close friends only'
446
+ }, {
447
+ ringName: 'Close Friends',
448
+ ringEmoji: '💜'
449
+ });
450
+
451
+ // Media group status
452
+ await sock.sendGroupStatusMessage(groupJid, {
453
+ image: bufferOrPath,
454
+ caption: 'Look'
455
+ }, { ringColor: 'blue' });
456
+ ```
457
+
458
+ **Notes:** Group status rendering and custom ring identity are **client-dependent**. The library sets the documented protocol fields (`isGroupStatus`, `statusAudienceMetadata`, `statusAttributions`, `groupStatusMessageV2`). Live client acceptance is not verified by the test suite.
459
+
460
+ ## Sticker reactions
461
+
462
+ Send a sticker as a reaction attached to a parent message via `messageAssociation` (`associationType: 11`).
463
+
464
+ ```js
465
+ // stickerMessage can be a previously received stickerMessage object, or { stickerMessage: {...} }
466
+ await sock.sendStickerReaction(
467
+ jid,
468
+ parentMessage.key, // WAMessageKey of the message being reacted to
469
+ parentOrQuoted.stickerMessage,
470
+ { count: 1, delayMs: 250 }
471
+ );
472
+ ```
473
+
474
+ Helpers:
475
+
476
+ ```js
477
+ import {
478
+ buildStickerReactionPayload,
479
+ extractStickerMessage,
480
+ isStickerReactionMessage
481
+ } from '@synacwave/baileys';
482
+ ```
483
+
484
+ **Notes:** Requires a valid sticker payload (usually taken from a received sticker). Association type 11 is the community-observed sticker-reaction association. Client rendering is **unverified** by automated tests.
485
+
486
+ ## 27. Attribution and license
487
+
488
+ MIT. See `LICENSE` and `ATTRIBUTION.md`.
489
+
490
+ Upstream:
491
+ - [itsliaaa/baileys](https://github.com/itsliaaa/baileys) (Lia Wynn)
492
+ - [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) (Rajeh Taher and contributors)
493
+
494
+ This project is not affiliated with or endorsed by WhatsApp or Meta.