@alannxd/baileys 2.1.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -12
- package/WAProto/index.js +56886 -17506
- package/lib/Defaults/index.js +19 -2
- package/lib/Socket/chats.d.ts +215 -28
- package/lib/Socket/chats.js +155 -49
- package/lib/Socket/dugong.d.ts +92 -13
- package/lib/Socket/dugong.js +206 -64
- package/lib/Socket/groups.js +1 -0
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/messages-send.js +16 -8
- package/lib/Socket/newsletter.js +114 -21
- package/lib/Socket/socket.js +66 -31
- package/lib/Types/Newsletter.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Utils/generics.js +62 -34
- package/lib/Utils/messages-media.js +145 -57
- package/lib/Utils/messages.js +26 -14
- package/lib/Utils/use-multi-file-auth-state.js +45 -6
- package/lib/Utils/validate-connection.js +89 -65
- package/lib/index.js +6 -3
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -106,6 +106,7 @@ Send basic interactive messages with copy button functionality:
|
|
|
106
106
|
```javascript
|
|
107
107
|
await sock.sendMessage(jid, {
|
|
108
108
|
interactiveMessage: {
|
|
109
|
+
header: "Hello World",
|
|
109
110
|
title: "Hello World",
|
|
110
111
|
footer: "telegram: @alannxd ",
|
|
111
112
|
buttons: [
|
|
@@ -128,22 +129,23 @@ Send interactive messages with buttons, copy actions, and native flow features:
|
|
|
128
129
|
```javascript
|
|
129
130
|
await sock.sendMessage(jid, {
|
|
130
131
|
interactiveMessage: {
|
|
132
|
+
header: "Hello World",
|
|
131
133
|
title: "Hello World",
|
|
132
134
|
footer: "telegram: @alannxd",
|
|
133
|
-
|
|
135
|
+
image: { url: "https://example.com/image.jpg" },
|
|
134
136
|
nativeFlowMessage: {
|
|
135
137
|
messageParamsJson: JSON.stringify({
|
|
136
138
|
limited_time_offer: {
|
|
137
139
|
text: "idk hummmm?",
|
|
138
|
-
url: "t.me/alannxd",
|
|
139
|
-
copy_code: "
|
|
140
|
+
url: "https://t.me/alannxd",
|
|
141
|
+
copy_code: "alan",
|
|
140
142
|
expiration_time: Date.now() * 999
|
|
141
143
|
},
|
|
142
144
|
bottom_sheet: {
|
|
143
145
|
in_thread_buttons_limit: 2,
|
|
144
146
|
divider_indices: [1, 2, 3, 4, 5, 999],
|
|
145
|
-
list_title: "
|
|
146
|
-
button_title: "
|
|
147
|
+
list_title: "alan is here",
|
|
148
|
+
button_title: "alan is here"
|
|
147
149
|
},
|
|
148
150
|
tap_target_configuration: {
|
|
149
151
|
title: " X ",
|
|
@@ -206,9 +208,10 @@ Send interactive messages with thumbnail image and copy button:
|
|
|
206
208
|
```javascript
|
|
207
209
|
await sock.sendMessage(jid, {
|
|
208
210
|
interactiveMessage: {
|
|
211
|
+
header: "Hello World",
|
|
209
212
|
title: "Hello World",
|
|
210
213
|
footer: "telegram: @alannxd",
|
|
211
|
-
|
|
214
|
+
image: { url: "https://example.com/image.jpg" },
|
|
212
215
|
buttons: [
|
|
213
216
|
{
|
|
214
217
|
name: "cta_copy",
|
|
@@ -229,18 +232,89 @@ Send product catalog messages with buttons and merchant information:
|
|
|
229
232
|
```javascript
|
|
230
233
|
await sock.sendMessage(jid, {
|
|
231
234
|
productMessage: {
|
|
235
|
+
title: "Produk Contoh",
|
|
236
|
+
description: "Ini adalah deskripsi produk",
|
|
237
|
+
thumbnail: { url: "https://example.com/image.jpg" },
|
|
238
|
+
productId: "PROD001",
|
|
239
|
+
retailerId: "RETAIL001",
|
|
240
|
+
url: "https://example.com/product",
|
|
241
|
+
body: "Detail produk",
|
|
242
|
+
footer: "Harga spesial",
|
|
243
|
+
priceAmount1000: 50000,
|
|
244
|
+
currencyCode: "USD",
|
|
245
|
+
buttons: [
|
|
246
|
+
{
|
|
247
|
+
name: "cta_url",
|
|
248
|
+
buttonParamsJson: JSON.stringify({
|
|
249
|
+
display_text: "Beli Sekarang",
|
|
250
|
+
url: "https://example.com/buy"
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
}, { quoted: m });
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Interactive Message with Document Buffer
|
|
259
|
+
Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
await sock.sendMessage(jid, {
|
|
263
|
+
interactiveMessage: {
|
|
264
|
+
header: "Hello World",
|
|
232
265
|
title: "Hello World",
|
|
233
|
-
description: "productMessage?",
|
|
234
|
-
thumbnail: "URL IMAGE",
|
|
235
|
-
productId: "123456789",
|
|
236
|
-
retailerId: "TOKOKU",
|
|
237
|
-
body: "Hello Wolrd",
|
|
238
266
|
footer: "telegram: @alannxd",
|
|
267
|
+
document: fs.readFileSync("./package.json"),
|
|
268
|
+
mimetype: "application/pdf",
|
|
269
|
+
fileName: "alan.pdf",
|
|
270
|
+
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
271
|
+
contextInfo: {
|
|
272
|
+
mentionedJid: [jid],
|
|
273
|
+
forwardingScore: 777,
|
|
274
|
+
isForwarded: false
|
|
275
|
+
},
|
|
276
|
+
externalAdReply: {
|
|
277
|
+
title: "Holow",
|
|
278
|
+
body: "anu team",
|
|
279
|
+
mediaType: 3,
|
|
280
|
+
thumbnailUrl: "https://example.com/image.jpg",
|
|
281
|
+
mediaUrl: " X ",
|
|
282
|
+
sourceUrl: "https://t.me/alannxd",
|
|
283
|
+
showAdAttribution: true,
|
|
284
|
+
renderLargerThumbnail: false
|
|
285
|
+
},
|
|
239
286
|
buttons: [
|
|
240
287
|
{
|
|
241
288
|
name: "cta_url",
|
|
242
289
|
buttonParamsJson: JSON.stringify({
|
|
243
|
-
display_text: "
|
|
290
|
+
display_text: "Telegram",
|
|
291
|
+
url: "https://t.me/alannxd",
|
|
292
|
+
merchant_url: "https://t.me/alannxd"
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
}, { quoted: m });
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Interactive Message with Document Buffer (Simple)
|
|
301
|
+
Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
|
|
302
|
+
|
|
303
|
+
```javascript
|
|
304
|
+
await sock.sendMessage(jid, {
|
|
305
|
+
interactiveMessage: {
|
|
306
|
+
header: "Hello World",
|
|
307
|
+
title: "Hello World",
|
|
308
|
+
footer: "telegram: @alannxd",
|
|
309
|
+
document: fs.readFileSync("./package.json"),
|
|
310
|
+
mimetype: "application/pdf",
|
|
311
|
+
fileName: "alan.pdf",
|
|
312
|
+
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
313
|
+
buttons: [
|
|
314
|
+
{
|
|
315
|
+
name: "cta_url",
|
|
316
|
+
buttonParamsJson: JSON.stringify({
|
|
317
|
+
display_text: "Telegram",
|
|
244
318
|
url: "https://t.me/alannxd",
|
|
245
319
|
merchant_url: "https://t.me/alannxd"
|
|
246
320
|
})
|