@synacwave/baileys 0.0.0-stage → 0.4.2

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 (228) hide show
  1. package/ATTRIBUTION.md +14 -0
  2. package/CHANGELOG.md +47 -0
  3. package/LICENSE +23 -0
  4. package/README.md +299 -2
  5. package/WAProto/index.d.ts +15942 -0
  6. package/WAProto/index.js +115911 -0
  7. package/engine-requirements.js +13 -0
  8. package/lib/Defaults/index.d.ts +145 -0
  9. package/lib/Defaults/index.js +155 -0
  10. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  11. package/lib/Signal/Group/ciphertext-message.js +12 -0
  12. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  13. package/lib/Signal/Group/group-session-builder.js +30 -0
  14. package/lib/Signal/Group/group_cipher.d.ts +11 -0
  15. package/lib/Signal/Group/group_cipher.js +82 -0
  16. package/lib/Signal/Group/index.d.ts +12 -0
  17. package/lib/Signal/Group/index.js +12 -0
  18. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  19. package/lib/Signal/Group/keyhelper.js +18 -0
  20. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  21. package/lib/Signal/Group/sender-chain-key.js +26 -0
  22. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  24. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  25. package/lib/Signal/Group/sender-key-message.js +66 -0
  26. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  27. package/lib/Signal/Group/sender-key-name.js +48 -0
  28. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  29. package/lib/Signal/Group/sender-key-record.js +41 -0
  30. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  31. package/lib/Signal/Group/sender-key-state.js +84 -0
  32. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  33. package/lib/Signal/Group/sender-message-key.js +26 -0
  34. package/lib/Signal/libsignal.d.ts +55 -0
  35. package/lib/Signal/libsignal.js +431 -0
  36. package/lib/Signal/lid-mapping.d.ts +21 -0
  37. package/lib/Signal/lid-mapping.js +277 -0
  38. package/lib/Socket/Client/index.d.ts +3 -0
  39. package/lib/Socket/Client/index.js +3 -0
  40. package/lib/Socket/Client/types.d.ts +6 -0
  41. package/lib/Socket/Client/types.js +11 -0
  42. package/lib/Socket/Client/websocket.d.ts +13 -0
  43. package/lib/Socket/Client/websocket.js +54 -0
  44. package/lib/Socket/business.d.ts +395 -0
  45. package/lib/Socket/business.js +380 -0
  46. package/lib/Socket/chats.d.ts +144 -0
  47. package/lib/Socket/chats.js +1219 -0
  48. package/lib/Socket/communities.d.ts +562 -0
  49. package/lib/Socket/communities.js +432 -0
  50. package/lib/Socket/groups.d.ts +286 -0
  51. package/lib/Socket/groups.js +348 -0
  52. package/lib/Socket/index.d.ts +531 -0
  53. package/lib/Socket/index.js +13 -0
  54. package/lib/Socket/messages-recv.d.ts +334 -0
  55. package/lib/Socket/messages-recv.js +1772 -0
  56. package/lib/Socket/messages-send.d.ts +330 -0
  57. package/lib/Socket/messages-send.js +1372 -0
  58. package/lib/Socket/mex.d.ts +2 -0
  59. package/lib/Socket/mex.js +42 -0
  60. package/lib/Socket/newsletter.d.ts +283 -0
  61. package/lib/Socket/newsletter.js +226 -0
  62. package/lib/Socket/socket.d.ts +61 -0
  63. package/lib/Socket/socket.js +970 -0
  64. package/lib/Store/index.d.ts +4 -0
  65. package/lib/Store/index.js +4 -0
  66. package/lib/Store/make-in-memory-store.d.ts +63 -0
  67. package/lib/Store/make-in-memory-store.js +421 -0
  68. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  69. package/lib/Store/make-ordered-dictionary.js +79 -0
  70. package/lib/Store/object-repository.d.ts +11 -0
  71. package/lib/Store/object-repository.js +24 -0
  72. package/lib/Types/Auth.d.ts +2 -0
  73. package/lib/Types/Auth.js +2 -0
  74. package/lib/Types/Bussines.d.ts +2 -0
  75. package/lib/Types/Bussines.js +2 -0
  76. package/lib/Types/Call.d.ts +2 -0
  77. package/lib/Types/Call.js +2 -0
  78. package/lib/Types/Chat.d.ts +2 -0
  79. package/lib/Types/Chat.js +8 -0
  80. package/lib/Types/Contact.d.ts +2 -0
  81. package/lib/Types/Contact.js +2 -0
  82. package/lib/Types/Events.d.ts +2 -0
  83. package/lib/Types/Events.js +2 -0
  84. package/lib/Types/GroupMetadata.d.ts +2 -0
  85. package/lib/Types/GroupMetadata.js +2 -0
  86. package/lib/Types/Label.d.ts +3 -0
  87. package/lib/Types/Label.js +25 -0
  88. package/lib/Types/LabelAssociation.d.ts +3 -0
  89. package/lib/Types/LabelAssociation.js +7 -0
  90. package/lib/Types/Message.d.ts +12 -0
  91. package/lib/Types/Message.js +18 -0
  92. package/lib/Types/Mex.d.ts +3 -0
  93. package/lib/Types/Mex.js +39 -0
  94. package/lib/Types/Product.d.ts +2 -0
  95. package/lib/Types/Product.js +2 -0
  96. package/lib/Types/RichType.d.ts +3 -0
  97. package/lib/Types/RichType.js +23 -0
  98. package/lib/Types/Signal.d.ts +2 -0
  99. package/lib/Types/Signal.js +2 -0
  100. package/lib/Types/Socket.d.ts +2 -0
  101. package/lib/Types/Socket.js +2 -0
  102. package/lib/Types/State.d.ts +6 -0
  103. package/lib/Types/State.js +56 -0
  104. package/lib/Types/USync.d.ts +2 -0
  105. package/lib/Types/USync.js +2 -0
  106. package/lib/Types/index.d.ts +14 -0
  107. package/lib/Types/index.js +26 -0
  108. package/lib/Utils/api-wrappers.d.ts +70 -0
  109. package/lib/Utils/api-wrappers.js +248 -0
  110. package/lib/Utils/auth-utils.d.ts +58 -0
  111. package/lib/Utils/auth-utils.js +306 -0
  112. package/lib/Utils/browser-utils.d.ts +10 -0
  113. package/lib/Utils/browser-utils.js +29 -0
  114. package/lib/Utils/business.d.ts +50 -0
  115. package/lib/Utils/business.js +231 -0
  116. package/lib/Utils/chat-utils.d.ts +409 -0
  117. package/lib/Utils/chat-utils.js +886 -0
  118. package/lib/Utils/companion-reg-client-utils.d.ts +5 -0
  119. package/lib/Utils/companion-reg-client-utils.js +40 -0
  120. package/lib/Utils/crypto.d.ts +40 -0
  121. package/lib/Utils/crypto.js +118 -0
  122. package/lib/Utils/decode-wa-message.d.ts +84 -0
  123. package/lib/Utils/decode-wa-message.js +317 -0
  124. package/lib/Utils/event-buffer.d.ts +13 -0
  125. package/lib/Utils/event-buffer.js +622 -0
  126. package/lib/Utils/generics.d.ts +64 -0
  127. package/lib/Utils/generics.js +395 -0
  128. package/lib/Utils/history.d.ts +76 -0
  129. package/lib/Utils/history.js +134 -0
  130. package/lib/Utils/identity-change-handler.d.ts +14 -0
  131. package/lib/Utils/identity-change-handler.js +50 -0
  132. package/lib/Utils/index.d.ts +28 -0
  133. package/lib/Utils/index.js +30 -0
  134. package/lib/Utils/link-preview.d.ts +13 -0
  135. package/lib/Utils/link-preview.js +85 -0
  136. package/lib/Utils/logger.d.ts +3 -0
  137. package/lib/Utils/logger.js +3 -0
  138. package/lib/Utils/lt-hash.d.ts +7 -0
  139. package/lib/Utils/lt-hash.js +8 -0
  140. package/lib/Utils/make-mutex.d.ts +7 -0
  141. package/lib/Utils/make-mutex.js +33 -0
  142. package/lib/Utils/message-retry-manager.d.ts +80 -0
  143. package/lib/Utils/message-retry-manager.js +265 -0
  144. package/lib/Utils/messages-media.d.ts +137 -0
  145. package/lib/Utils/messages-media.js +843 -0
  146. package/lib/Utils/messages.d.ts +46 -0
  147. package/lib/Utils/messages.js +1848 -0
  148. package/lib/Utils/noise-handler.d.ts +21 -0
  149. package/lib/Utils/noise-handler.js +201 -0
  150. package/lib/Utils/offline-node-processor.d.ts +10 -0
  151. package/lib/Utils/offline-node-processor.js +40 -0
  152. package/lib/Utils/pre-key-manager.d.ts +26 -0
  153. package/lib/Utils/pre-key-manager.js +106 -0
  154. package/lib/Utils/process-message.d.ts +84 -0
  155. package/lib/Utils/process-message.js +749 -0
  156. package/lib/Utils/reporting-utils.d.ts +13 -0
  157. package/lib/Utils/reporting-utils.js +258 -0
  158. package/lib/Utils/rich-message-utils.d.ts +49 -0
  159. package/lib/Utils/rich-message-utils.js +363 -0
  160. package/lib/Utils/signal.d.ts +83 -0
  161. package/lib/Utils/signal.js +201 -0
  162. package/lib/Utils/stanza-ack.d.ts +17 -0
  163. package/lib/Utils/stanza-ack.js +38 -0
  164. package/lib/Utils/status-utils.js +178 -0
  165. package/lib/Utils/sticker-reaction.js +104 -0
  166. package/lib/Utils/synacwave.d.ts +111 -0
  167. package/lib/Utils/synacwave.js +564 -0
  168. package/lib/Utils/sync-action-utils.d.ts +3 -0
  169. package/lib/Utils/sync-action-utils.js +49 -0
  170. package/lib/Utils/tc-token-utils.d.ts +30 -0
  171. package/lib/Utils/tc-token-utils.js +164 -0
  172. package/lib/Utils/use-multi-file-auth-state.d.ts +11 -0
  173. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  174. package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
  175. package/lib/Utils/use-single-file-auth-state.js +109 -0
  176. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  177. package/lib/Utils/use-sqlite-auth-state.js +109 -0
  178. package/lib/Utils/validate-connection.d.ts +44 -0
  179. package/lib/Utils/validate-connection.js +210 -0
  180. package/lib/Utils/view-once-text.d.ts +32 -0
  181. package/lib/Utils/view-once-text.js +213 -0
  182. package/lib/WABinary/constants.d.ts +62 -0
  183. package/lib/WABinary/constants.js +1467 -0
  184. package/lib/WABinary/decode.d.ts +10 -0
  185. package/lib/WABinary/decode.js +262 -0
  186. package/lib/WABinary/encode.d.ts +3 -0
  187. package/lib/WABinary/encode.js +220 -0
  188. package/lib/WABinary/generic-utils.d.ts +77 -0
  189. package/lib/WABinary/generic-utils.js +226 -0
  190. package/lib/WABinary/index.d.ts +6 -0
  191. package/lib/WABinary/index.js +6 -0
  192. package/lib/WABinary/jid-utils.d.ts +29 -0
  193. package/lib/WABinary/jid-utils.js +96 -0
  194. package/lib/WABinary/types.d.ts +2 -0
  195. package/lib/WABinary/types.js +2 -0
  196. package/lib/WAM/BinaryInfo.d.ts +8 -0
  197. package/lib/WAM/BinaryInfo.js +10 -0
  198. package/lib/WAM/constants.d.ts +34927 -0
  199. package/lib/WAM/constants.js +22853 -0
  200. package/lib/WAM/encode.d.ts +2 -0
  201. package/lib/WAM/encode.js +150 -0
  202. package/lib/WAM/index.d.ts +4 -0
  203. package/lib/WAM/index.js +4 -0
  204. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
  205. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  206. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  207. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  208. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  209. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  210. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  211. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  212. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  213. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  214. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  215. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  216. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
  217. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  218. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  219. package/lib/WAUSync/Protocols/index.js +6 -0
  220. package/lib/WAUSync/USyncQuery.d.ts +21 -0
  221. package/lib/WAUSync/USyncQuery.js +98 -0
  222. package/lib/WAUSync/USyncUser.d.ts +17 -0
  223. package/lib/WAUSync/USyncUser.js +31 -0
  224. package/lib/WAUSync/index.d.ts +4 -0
  225. package/lib/WAUSync/index.js +4 -0
  226. package/lib/index.d.ts +12 -0
  227. package/lib/index.js +12 -0
  228. 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,47 @@
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.
36
+
37
+ ## 0.4.2
38
+
39
+ ### Added
40
+
41
+ - `sendLocationButtonCard` / `generateLocationButtonCard` — buttonsMessage + locationMessage (headerType 6) with biz/native_flow additional nodes.
42
+ - Boolean `linkPreview: true | false` support on text `sendMessage` (object and auto behaviour unchanged).
43
+
44
+ ### Docs
45
+
46
+ - README rewritten in badge / section style with package image and API examples.
47
+ - Removed upstream dump README and migration notes from package root.
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,300 @@
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
+ [![Logo](https://i.ibb.co/gbjjJDmL/photo-2026-10-05-10-49-04-7693134064701669408.jpg)](https://www.npmjs.com/package/@synacwave/baileys)
4
+
5
+ <p align="center">
6
+ Baileys fork with sound stickers, chat themes, group status, location button cards, link preview controls, and production-oriented bot helpers.
7
+ <br><br>
8
+ <a href="https://www.npmjs.com/package/@synacwave/baileys">
9
+ <img src="https://img.shields.io/npm/v/@synacwave/baileys?style=for-the-badge&logo=npm"/>
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/@synacwave/baileys">
12
+ <img src="https://img.shields.io/npm/dm/@synacwave/baileys?style=for-the-badge&logo=npm"/>
13
+ </a>
14
+ <a href="https://github.com/Synacwave/baileys">
15
+ <img src="https://img.shields.io/github/stars/Synacwave/baileys?style=for-the-badge&logo=github"/>
16
+ </a>
17
+ <a href="LICENSE">
18
+ <img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge"/>
19
+ </a>
20
+ <a href="https://nodejs.org">
21
+ <img src="https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&labelColor=green&logoColor=white&style=for-the-badge"/>
22
+ </a>
23
+ <a href="#">
24
+ <img src="https://img.shields.io/badge/ESM-only?logo=javascript&labelColor=yellow&logoColor=black&style=for-the-badge"/>
25
+ </a>
26
+ </p>
27
+
28
+ ### ✨ Highlights
29
+
30
+ - 🚫 No obfuscation. Readable and auditable.
31
+ - 🧩 Sound stickers, chat themes / wallpapers, group status, sticker reactions.
32
+ - 📍 Location button cards (`sendLocationButtonCard`).
33
+ - 🔗 Explicit `linkPreview: true | false | object` on `sendMessage`.
34
+ - 🤖 Convenience helpers for bots (context, mentions, Meta AI, favorites, rich responses).
35
+
36
+ > [!NOTE]
37
+ > This is a fork. Upstream credit belongs to [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) and [@itsliaaa/baileys](https://github.com/itsliaaa/baileys).
38
+
39
+ ### 📋 Table of Contents
40
+
41
+ - [📥 Installation](#-installation)
42
+ - [🌐 Connect](#-connect)
43
+ - [🔗 Link Preview](#-link-preview)
44
+ - [📍 Location Button Card](#-location-button-card)
45
+ - [🧩 Synacwave APIs](#-synacwave-apis)
46
+ - [📦 Fork base](#-fork-base)
47
+ - [📣 Credits](#-credits)
48
+
49
+ ### 📥 Installation
50
+
51
+ ```bash
52
+ npm install @synacwave/baileys
53
+ ```
54
+
55
+ ```json
56
+ "dependencies": {
57
+ "@synacwave/baileys": "latest"
58
+ }
59
+ ```
60
+
61
+ Optional peers: `sharp` / `jimp` / `@napi-rs/image`, `link-preview-js`, `audio-decode`, `better-sqlite3`.
62
+
63
+ #### 🧩 Import
64
+
65
+ ```js
66
+ import makeWASocket, {
67
+ useMultiFileAuthState,
68
+ generateLocationButtonCard,
69
+ buildLocationButtonCardPayload
70
+ } from '@synacwave/baileys'
71
+ ```
72
+
73
+ ### 🌐 Connect
74
+
75
+ ```js
76
+ import makeWASocket, { useMultiFileAuthState, DisconnectReason } from '@synacwave/baileys'
77
+ import { Boom } from '@hapi/boom'
78
+ import pino from 'pino'
79
+
80
+ const logger = pino({ level: 'silent' })
81
+
82
+ const connect = async () => {
83
+ const { state, saveCreds } = await useMultiFileAuthState('session')
84
+ const sock = makeWASocket({ logger, auth: state })
85
+
86
+ sock.ev.on('creds.update', saveCreds)
87
+ sock.ev.on('connection.update', async (update) => {
88
+ const { connection, lastDisconnect } = update
89
+ if (connection === 'close') {
90
+ const shouldReconnect =
91
+ new Boom(lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
92
+ if (shouldReconnect) connect()
93
+ } else if (connection === 'open') {
94
+ console.log('connected')
95
+ }
96
+ })
97
+ }
98
+
99
+ connect()
100
+ ```
101
+
102
+ All Synacwave helpers are attached to the socket returned by `makeWASocket`.
103
+
104
+ ### 🔗 Link Preview
105
+
106
+ Works on normal text messages through `sock.sendMessage`.
107
+
108
+ #### Force preview
109
+
110
+ ```js
111
+ await sock.sendMessage(jid, {
112
+ text: 'Check this out https://github.com/Synacwave/baileys',
113
+ linkPreview: true
114
+ })
115
+ ```
116
+
117
+ #### Disable preview
118
+
119
+ ```js
120
+ await sock.sendMessage(jid, {
121
+ text: 'https://example.com',
122
+ linkPreview: false
123
+ })
124
+ ```
125
+
126
+ #### Custom preview object
127
+
128
+ ```js
129
+ await sock.sendMessage(jid, {
130
+ text: 'https://example.com',
131
+ linkPreview: {
132
+ 'matched-text': 'https://example.com',
133
+ title: 'Example',
134
+ description: 'Custom description',
135
+ jpegThumbnail: imageBuffer,
136
+ previewType: 0
137
+ }
138
+ })
139
+ ```
140
+
141
+ | Value | Behaviour |
142
+ | --- | --- |
143
+ | `undefined` | Upstream auto-preview when `link-preview-js` is available |
144
+ | `true` | Force generation via `getUrlInfo` |
145
+ | `false` / `null` | No preview |
146
+ | `object` | Use the provided metadata as-is |
147
+
148
+ > High-quality thumbnails use `waUploadToServer` when `generateHighQualityLinkPreview` is enabled in socket config (same as upstream).
149
+
150
+ ### 📍 Location Button Card
151
+
152
+ Sends the exact `buttonsMessage` + `locationMessage` (headerType `6`) structure used by WhatsApp interactive location cards, including the required `biz` / `native_flow` additional nodes.
153
+
154
+ #### Send
155
+
156
+ ```js
157
+ await sock.sendLocationButtonCard(jid, {
158
+ text: 'Hello 👋\n\nWelcome to *SYNACWAVE*\n\nTap a button below to continue.',
159
+ footer: '© SYNACWAVE • FREE',
160
+ location: {
161
+ latitude: 0,
162
+ longitude: 0,
163
+ name: 'SYNACWAVE',
164
+ address: '© SYNACWAVE',
165
+ thumbnail: thumbnailBuffer
166
+ },
167
+ buttons: [
168
+ { id: '.menu', text: '📂 Full Menu' },
169
+ { id: '.ping', text: '🏓 Ping' },
170
+ { id: '.owner', text: '👑 Owner' }
171
+ ]
172
+ })
173
+ ```
174
+
175
+ #### Generate only (no send)
176
+
177
+ ```js
178
+ const msg = sock.generateLocationButtonCard(jid, {
179
+ text: 'Hello',
180
+ footer: 'footer',
181
+ location: { latitude: 0, longitude: 0, name: 'X', address: 'Y', thumbnail },
182
+ buttons: [{ id: '.menu', text: 'Menu' }]
183
+ })
184
+ // msg.key, msg.message, msg.additionalNodes
185
+ ```
186
+
187
+ #### Payload shape (internal)
188
+
189
+ ```js
190
+ {
191
+ buttonsMessage: {
192
+ buttons: [{ buttonId, buttonText: { displayText }, type: 1 }],
193
+ locationMessage: {
194
+ degreesLatitude,
195
+ degreesLongitude,
196
+ name,
197
+ address,
198
+ jpegThumbnail
199
+ },
200
+ header: 'locationMessage',
201
+ contentText,
202
+ footerText,
203
+ headerType: 6
204
+ }
205
+ }
206
+ ```
207
+
208
+ Private chats also receive `{ tag: 'bot', attrs: { biz_bot: '1' } }`. Groups do not.
209
+
210
+ ### 🧩 Synacwave APIs
211
+
212
+ #### Sound stickers
213
+
214
+ ```js
215
+ await sock.sendSoundSticker(jid, {
216
+ sticker: { url: './sticker.webp' },
217
+ audio: audioBuffer,
218
+ mimetype: 'audio/ogg; codecs=opus',
219
+ seconds: 3
220
+ })
221
+ ```
222
+
223
+ #### Chat themes
224
+
225
+ ```js
226
+ await sock.setChatTheme(jid, 'red')
227
+ await sock.setChatThemeColor(jid, '#FF0000')
228
+ await sock.setChatBubbleScheme(jid, 'Emerald@Minimal')
229
+ await sock.setChatWallpaper(jid, imageBuffer)
230
+ await sock.clearChatTheme(jid)
231
+ ```
232
+
233
+ #### Group / broadcast status
234
+
235
+ ```js
236
+ await sock.sendGroupStatusMessage(groupJid, { image: { url }, caption: 'hi' })
237
+ await sock.sendStatus({ text: 'story' }, { statusJidList: [jid] })
238
+ ```
239
+
240
+ #### Sticker reaction
241
+
242
+ ```js
243
+ await sock.sendStickerReaction(jid, {
244
+ key: message.key,
245
+ sticker: { url: './react.webp' }
246
+ })
247
+ ```
248
+
249
+ #### View-once text
250
+
251
+ ```js
252
+ await sock.sendViewOnceText(jid, 'secret')
253
+ // aliases: sendViewOnceTextMessage, sendVotext
254
+ ```
255
+
256
+ #### Bot helpers
257
+
258
+ ```js
259
+ const text = sock.getMessageText(msg)
260
+ const ctx = await sock.getMessageContext(msg)
261
+ const buf = await sock.getMediaBuffer(msg)
262
+ await sock.reply(msg, 'pong')
263
+ await sock.sendText(jid, 'hello')
264
+ ```
265
+
266
+ #### Meta AI in groups
267
+
268
+ ```js
269
+ await sock.addMetaAI(groupJid)
270
+ await sock.removeMetaAI(groupJid)
271
+ const has = await sock.hasMetaAI(groupJid)
272
+ ```
273
+
274
+ #### Favorites
275
+
276
+ ```js
277
+ await sock.addToFavorites(jid)
278
+ await sock.removeFromFavorites(jid)
279
+ ```
280
+
281
+ Core `sock.sendMessage`, media, interactive, newsletter, groups, communities, business and privacy APIs follow upstream Baileys / @itsliaaa/baileys behaviour.
282
+
283
+ ### 📦 Fork base
284
+
285
+ - Base: [@itsliaaa/baileys](https://github.com/itsliaaa/baileys)
286
+ - Upstream: [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)
287
+
288
+ ### 📣 Credits
289
+
290
+ Protocol definitions via [wppconnect-team/wa-proto](https://github.com/wppconnect-team/wa-proto).
291
+
292
+ Original Baileys maintainers and contributors:
293
+
294
+ - [purpshell](https://github.com/purpshell)
295
+ - [jlucaso1](https://github.com/jlucaso1)
296
+ - [adiwajshing](https://github.com/adiwajshing)
297
+
298
+ Fork lineage and additional work by [Lia Wynn / itsliaaa](https://github.com/itsliaaa).
299
+
300
+ Synacwave-specific APIs and packaging by [Synacwave](https://github.com/Synacwave).