@synacwave/baileys 0.4.0 → 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.
package/README.md CHANGED
@@ -1,494 +1,300 @@
1
- # @synacwave/baileys
2
-
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
1
+ # 🌊 @synacwave/baileys
2
+
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
46
50
 
47
51
  ```bash
48
52
  npm install @synacwave/baileys
49
53
  ```
50
54
 
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
- });
55
+ ```json
56
+ "dependencies": {
57
+ "@synacwave/baileys": "latest"
58
+ }
71
59
  ```
72
60
 
73
- All convenience methods added by this fork are attached to the socket returned by `makeWASocket`.
74
-
75
- ## 3. Connection and authentication
61
+ Optional peers: `sharp` / `jimp` / `@napi-rs/image`, `link-preview-js`, `audio-decode`, `better-sqlite3`.
76
62
 
77
- Same as upstream. Multi-file and single-file auth states are supported.
63
+ #### 🧩 Import
78
64
 
79
65
  ```js
80
- import { useMultiFileAuthState, useSingleFileAuthState } from '@synacwave/baileys';
66
+ import makeWASocket, {
67
+ useMultiFileAuthState,
68
+ generateLocationButtonCard,
69
+ buildLocationButtonCardPayload
70
+ } from '@synacwave/baileys'
81
71
  ```
82
72
 
83
- ## 4. Browser configuration
73
+ ### 🌐 Connect
84
74
 
85
75
  ```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.
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
+ }
97
98
 
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 });
99
+ connect()
102
100
  ```
103
101
 
104
- ## 6. Media APIs
102
+ All Synacwave helpers are attached to the socket returned by `makeWASocket`.
105
103
 
106
- Standard media sending (image, video, audio, document, sticker) works as upstream. Use `prepareWAMessageMedia` / `generateWAMessageFromContent` when you need lower-level control.
104
+ ### 🔗 Link Preview
107
105
 
108
- ## 7. Sound stickers
106
+ Works on normal text messages through `sock.sendMessage`.
109
107
 
110
- Send a sticker that also carries an audio track in a single message (StickerMessage field 26).
108
+ #### Force preview
111
109
 
112
110
  ```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 });
111
+ await sock.sendMessage(jid, {
112
+ text: 'Check this out https://github.com/Synacwave/baileys',
113
+ linkPreview: true
114
+ })
119
115
  ```
120
116
 
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
117
+ #### Disable preview
127
118
 
128
119
  ```js
129
- await sock.sendPremiumSticker(jid, {
130
- sticker: bufferOrPath,
131
- // additional premium sticker metadata accepted by the protobuf
132
- }, options);
120
+ await sock.sendMessage(jid, {
121
+ text: 'https://example.com',
122
+ linkPreview: false
123
+ })
133
124
  ```
134
125
 
135
- ## 9. View-once messages
136
-
137
- ### View-once text
126
+ #### Custom preview object
138
127
 
139
128
  ```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);
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
+ })
146
139
  ```
147
140
 
148
- Strategies tried in order (first that the local pipeline accepts is used):
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 |
149
147
 
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
148
+ > High-quality thumbnails use `waUploadToServer` when `generateHighQualityLinkPreview` is enabled in socket config (same as upstream).
155
149
 
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.
150
+ ### 📍 Location Button Card
157
151
 
158
- ### Detection
159
-
160
- ```js
161
- import { isViewOnce } from '@synacwave/baileys';
162
- if (isViewOnce(msg)) { /* ... */ }
163
- ```
152
+ Sends the exact `buttonsMessage` + `locationMessage` (headerType `6`) structure used by WhatsApp interactive location cards, including the required `biz` / `native_flow` additional nodes.
164
153
 
165
- ## 10. Chat themes and wallpapers
154
+ #### Send
166
155
 
167
156
  ```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();
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
+ })
175
173
  ```
176
174
 
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
175
+ #### Generate only (no send)
182
176
 
183
177
  ```js
184
- await sock.addMetaAI(groupJid);
185
- await sock.removeMetaAI(groupJid);
186
- const present = await sock.hasMetaAI(groupJid);
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
187
185
  ```
188
186
 
189
- ### Message helpers
187
+ #### Payload shape (internal)
190
188
 
191
189
  ```js
192
- import { isFromBot, getBotJid, isMetaAiParticipant } from '@synacwave/baileys';
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
+ }
193
206
  ```
194
207
 
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.
208
+ Private chats also receive `{ tag: 'bot', attrs: { biz_bot: '1' } }`. Groups do not.
198
209
 
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
- ```
210
+ ### 🧩 Synacwave APIs
217
211
 
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
212
+ #### Sound stickers
221
213
 
222
214
  ```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.
215
+ await sock.sendSoundSticker(jid, {
216
+ sticker: { url: './sticker.webp' },
217
+ audio: audioBuffer,
218
+ mimetype: 'audio/ogg; codecs=opus',
219
+ seconds: 3
220
+ })
243
221
  ```
244
222
 
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
223
+ #### Chat themes
248
224
 
249
225
  ```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
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)
258
231
  ```
259
232
 
260
- ## 16. Social and entity cards
233
+ #### Group / broadcast status
261
234
 
262
235
  ```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: '...' });
236
+ await sock.sendGroupStatusMessage(groupJid, { image: { url }, caption: 'hi' })
237
+ await sock.sendStatus({ text: 'story' }, { statusJidList: [jid] })
269
238
  ```
270
239
 
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
240
+ #### Sticker reaction
281
241
 
282
242
  ```js
283
- await sock.sendMessage('status@broadcast', {
284
- text: 'status update',
285
- statusJidList: [/* contacts who can see it */],
286
- });
243
+ await sock.sendStickerReaction(jid, {
244
+ key: message.key,
245
+ sticker: { url: './react.webp' }
246
+ })
287
247
  ```
288
248
 
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
249
+ #### View-once text
294
250
 
295
251
  ```js
296
- await sock.addToFavorites(jidOrJids, { current: existingList });
297
- await sock.removeFromFavorites(jidOrJids, { current: existingList });
252
+ await sock.sendViewOnceText(jid, 'secret')
253
+ // aliases: sendViewOnceTextMessage, sendVotext
298
254
  ```
299
255
 
300
- ## 21. Message context and utility helpers
256
+ #### Bot helpers
301
257
 
302
258
  ```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
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')
410
264
  ```
411
265
 
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
266
+ #### Meta AI in groups
420
267
 
421
268
  ```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
- );
269
+ await sock.addMetaAI(groupJid)
270
+ await sock.removeMetaAI(groupJid)
271
+ const has = await sock.hasMetaAI(groupJid)
426
272
  ```
427
273
 
428
- `statusJidList` is required (contacts who may see the status).
429
-
430
- ### Group status
274
+ #### Favorites
431
275
 
432
276
  ```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' });
277
+ await sock.addToFavorites(jid)
278
+ await sock.removeFromFavorites(jid)
456
279
  ```
457
280
 
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
281
+ Core `sock.sendMessage`, media, interactive, newsletter, groups, communities, business and privacy APIs follow upstream Baileys / @itsliaaa/baileys behaviour.
461
282
 
462
- Send a sticker as a reaction attached to a parent message via `messageAssociation` (`associationType: 11`).
283
+ ### 📦 Fork base
463
284
 
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
- ```
285
+ - Base: [@itsliaaa/baileys](https://github.com/itsliaaa/baileys)
286
+ - Upstream: [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)
473
287
 
474
- Helpers:
475
-
476
- ```js
477
- import {
478
- buildStickerReactionPayload,
479
- extractStickerMessage,
480
- isStickerReactionMessage
481
- } from '@synacwave/baileys';
482
- ```
288
+ ### 📣 Credits
483
289
 
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.
290
+ Protocol definitions via [wppconnect-team/wa-proto](https://github.com/wppconnect-team/wa-proto).
485
291
 
486
- ## 27. Attribution and license
292
+ Original Baileys maintainers and contributors:
487
293
 
488
- MIT. See `LICENSE` and `ATTRIBUTION.md`.
294
+ - [purpshell](https://github.com/purpshell)
295
+ - [jlucaso1](https://github.com/jlucaso1)
296
+ - [adiwajshing](https://github.com/adiwajshing)
489
297
 
490
- Upstream:
491
- - [itsliaaa/baileys](https://github.com/itsliaaa/baileys) (Lia Wynn)
492
- - [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) (Rajeh Taher and contributors)
298
+ Fork lineage and additional work by [Lia Wynn / itsliaaa](https://github.com/itsliaaa).
493
299
 
494
- This project is not affiliated with or endorsed by WhatsApp or Meta.
300
+ Synacwave-specific APIs and packaging by [Synacwave](https://github.com/Synacwave).