@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/CHANGELOG.md +12 -0
- package/README.md +210 -404
- package/lib/Utils/messages.js +11 -3
- package/lib/Utils/synacwave.js +93 -3
- package/package.json +1 -1
- package/README.upstream.md +0 -2077
package/README.md
CHANGED
|
@@ -1,494 +1,300 @@
|
|
|
1
|
-
# @synacwave/baileys
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
# 🌊 @synacwave/baileys
|
|
2
|
+
|
|
3
|
+
[](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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
## 3. Connection and authentication
|
|
61
|
+
Optional peers: `sharp` / `jimp` / `@napi-rs/image`, `link-preview-js`, `audio-decode`, `better-sqlite3`.
|
|
76
62
|
|
|
77
|
-
|
|
63
|
+
#### 🧩 Import
|
|
78
64
|
|
|
79
65
|
```js
|
|
80
|
-
import
|
|
66
|
+
import makeWASocket, {
|
|
67
|
+
useMultiFileAuthState,
|
|
68
|
+
generateLocationButtonCard,
|
|
69
|
+
buildLocationButtonCardPayload
|
|
70
|
+
} from '@synacwave/baileys'
|
|
81
71
|
```
|
|
82
72
|
|
|
83
|
-
|
|
73
|
+
### 🌐 Connect
|
|
84
74
|
|
|
85
75
|
```js
|
|
86
|
-
import {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
+
All Synacwave helpers are attached to the socket returned by `makeWASocket`.
|
|
105
103
|
|
|
106
|
-
|
|
104
|
+
### 🔗 Link Preview
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
Works on normal text messages through `sock.sendMessage`.
|
|
109
107
|
|
|
110
|
-
|
|
108
|
+
#### Force preview
|
|
111
109
|
|
|
112
110
|
```js
|
|
113
|
-
await sock.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
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.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
120
|
+
await sock.sendMessage(jid, {
|
|
121
|
+
text: 'https://example.com',
|
|
122
|
+
linkPreview: false
|
|
123
|
+
})
|
|
133
124
|
```
|
|
134
125
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
### View-once text
|
|
126
|
+
#### Custom preview object
|
|
138
127
|
|
|
139
128
|
```js
|
|
140
|
-
await sock.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
150
|
+
### 📍 Location Button Card
|
|
157
151
|
|
|
158
|
-
|
|
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
|
-
|
|
154
|
+
#### Send
|
|
166
155
|
|
|
167
156
|
```js
|
|
168
|
-
await sock.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
## 11. AI and Meta AI
|
|
180
|
-
|
|
181
|
-
### Group helpers
|
|
175
|
+
#### Generate only (no send)
|
|
182
176
|
|
|
183
177
|
```js
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
187
|
+
#### Payload shape (internal)
|
|
190
188
|
|
|
191
189
|
```js
|
|
192
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
## 13. Tables, lists, code and LaTeX
|
|
212
|
+
#### Sound stickers
|
|
221
213
|
|
|
222
214
|
```js
|
|
223
|
-
await sock.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
## 15. Carousels, albums and grids
|
|
223
|
+
#### Chat themes
|
|
248
224
|
|
|
249
225
|
```js
|
|
250
|
-
await sock.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
233
|
+
#### Group / broadcast status
|
|
261
234
|
|
|
262
235
|
```js
|
|
263
|
-
await sock.
|
|
264
|
-
await sock.
|
|
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
|
-
|
|
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.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
})
|
|
243
|
+
await sock.sendStickerReaction(jid, {
|
|
244
|
+
key: message.key,
|
|
245
|
+
sticker: { url: './react.webp' }
|
|
246
|
+
})
|
|
287
247
|
```
|
|
288
248
|
|
|
289
|
-
|
|
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.
|
|
297
|
-
|
|
252
|
+
await sock.sendViewOnceText(jid, 'secret')
|
|
253
|
+
// aliases: sendViewOnceTextMessage, sendVotext
|
|
298
254
|
```
|
|
299
255
|
|
|
300
|
-
|
|
256
|
+
#### Bot helpers
|
|
301
257
|
|
|
302
258
|
```js
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
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
|
-
|
|
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.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
);
|
|
269
|
+
await sock.addMetaAI(groupJid)
|
|
270
|
+
await sock.removeMetaAI(groupJid)
|
|
271
|
+
const has = await sock.hasMetaAI(groupJid)
|
|
426
272
|
```
|
|
427
273
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
### Group status
|
|
274
|
+
#### Favorites
|
|
431
275
|
|
|
432
276
|
```js
|
|
433
|
-
await sock.
|
|
434
|
-
|
|
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
|
-
|
|
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
|
-
|
|
283
|
+
### 📦 Fork base
|
|
463
284
|
|
|
464
|
-
|
|
465
|
-
|
|
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
|
-
|
|
475
|
-
|
|
476
|
-
```js
|
|
477
|
-
import {
|
|
478
|
-
buildStickerReactionPayload,
|
|
479
|
-
extractStickerMessage,
|
|
480
|
-
isStickerReactionMessage
|
|
481
|
-
} from '@synacwave/baileys';
|
|
482
|
-
```
|
|
288
|
+
### 📣 Credits
|
|
483
289
|
|
|
484
|
-
|
|
290
|
+
Protocol definitions via [wppconnect-team/wa-proto](https://github.com/wppconnect-team/wa-proto).
|
|
485
291
|
|
|
486
|
-
|
|
292
|
+
Original Baileys maintainers and contributors:
|
|
487
293
|
|
|
488
|
-
|
|
294
|
+
- [purpshell](https://github.com/purpshell)
|
|
295
|
+
- [jlucaso1](https://github.com/jlucaso1)
|
|
296
|
+
- [adiwajshing](https://github.com/adiwajshing)
|
|
489
297
|
|
|
490
|
-
|
|
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
|
-
|
|
300
|
+
Synacwave-specific APIs and packaging by [Synacwave](https://github.com/Synacwave).
|