@bufferstudio/baileys-natsu 1.2.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 +180 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +97691 -0
- package/lib/Defaults/index.d.ts +6 -0
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +42 -0
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/index.d.ts +48 -0
- package/lib/Signal/index.d.ts.map +1 -0
- package/lib/Signal/index.js +171 -0
- package/lib/Signal/index.js.map +1 -0
- package/lib/Socket/auth.d.ts +3 -0
- package/lib/Socket/auth.d.ts.map +1 -0
- package/lib/Socket/auth.js +110 -0
- package/lib/Socket/auth.js.map +1 -0
- package/lib/Socket/index.d.ts +3 -0
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +606 -0
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +4 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +18 -0
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Store/index.d.ts +8 -0
- package/lib/Store/index.d.ts.map +1 -0
- package/lib/Store/index.js +39 -0
- package/lib/Store/index.js.map +1 -0
- package/lib/Types/Chat.d.ts +43 -0
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +2 -0
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Message.d.ts +57 -0
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +2 -0
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Socket.d.ts +169 -0
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/index.d.ts +4 -0
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +4 -0
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +12 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +83 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/crypto.js +48 -0
- package/lib/Utils/decode-wa-message.d.ts +15 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +174 -0
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/generics.d.ts +11 -0
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +46 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/index.d.ts +5 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +5 -0
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/logger.d.ts +5 -0
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +17 -0
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/message-features.js +206 -0
- package/lib/Utils/messages-media.d.ts +3 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +62 -0
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +2 -0
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +6 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.js +194 -0
- package/lib/Utils/process-message.d.ts +9 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +63 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/signal.js +7 -0
- package/lib/Utils/validate-connection.js +197 -0
- package/lib/WABinary/binary-constants.d.ts +34 -0
- package/lib/WABinary/binary-constants.d.ts.map +1 -0
- package/lib/WABinary/binary-constants.js +538 -0
- package/lib/WABinary/binary-constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +19 -0
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +176 -0
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +142 -0
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +24 -0
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +74 -0
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +16 -0
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +33 -0
- package/lib/WABinary/types.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# baileys-natsu-v1
|
|
2
|
+
|
|
3
|
+
WhatsApp Web API — lightweight, modern, interactive.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install baileys-natsu-v1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import makeWASocket from 'baileys-natsu-v1'
|
|
15
|
+
|
|
16
|
+
const sock = makeWASocket({
|
|
17
|
+
printQRInTerminal: true,
|
|
18
|
+
auth: { creds, keys },
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
22
|
+
for (const msg of messages) {
|
|
23
|
+
if (msg.isSystemNotification) continue
|
|
24
|
+
console.log(msg.key.remoteJid, msg.message?.conversation)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- Interactive Messages (buttons, lists, native flow)
|
|
32
|
+
- Native Flow buttons: `cta_reminder`, `call_button`, `otp_button`, `authentication_button`, `voice_call`, `video_call_button`, `send_location`, `catalog_message`, `address_message`, `order_details`, `order_status`, `review_and_pay`, `payment_status`, `payment_method`, `track_order`, `reordenar`, `cancel_order`, `clear_chat`, `navegaToPantalla`, `flow_action`, `mpm`, `card_message`, `reply_button`, `url_button`
|
|
33
|
+
- Commerce: catalog, orders, payments
|
|
34
|
+
- System notification filter (`msg.isSystemNotification`)
|
|
35
|
+
- ExternalAdReply helper
|
|
36
|
+
- Audio group status fix
|
|
37
|
+
- Lottie stickers, newsletters, group mentions
|
|
38
|
+
- Rich text formatting
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Send Native Flow buttons
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import makeWASocket, { buildNativeFlowButton } from 'baileys-natsu-v1'
|
|
46
|
+
|
|
47
|
+
const sock = makeWASocket({ printQRInTerminal: true, auth })
|
|
48
|
+
|
|
49
|
+
const nativeFlow = buildNativeFlowButton(
|
|
50
|
+
'Recarga completada',
|
|
51
|
+
'Selecciona una opción',
|
|
52
|
+
[
|
|
53
|
+
{ id: 'ver_saldo', text: '💰 Ver saldo' },
|
|
54
|
+
{ id: 'comprar_paquete', text: '📦 Comprar paquete' },
|
|
55
|
+
{ id: 'hablar_agente', text: '👤 Hablar con agente' },
|
|
56
|
+
]
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
await sock.sendMessage('5215512345670@s.whatsapp.net', nativeFlow)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Send List message
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { buildListMessage, buildListSection } from 'baileys-natsu-v1'
|
|
66
|
+
|
|
67
|
+
const listMsg = buildListMessage(
|
|
68
|
+
'Menú principal',
|
|
69
|
+
'Selecciona una categoría',
|
|
70
|
+
'Ver opciones',
|
|
71
|
+
[
|
|
72
|
+
buildListSection('📱 Planes', [
|
|
73
|
+
{ id: 'plan_basico', title: 'Básico', description: '10 GB por $199' },
|
|
74
|
+
{ id: 'plan_premium', title: 'Premium', description: 'Ilimitado por $499' },
|
|
75
|
+
]),
|
|
76
|
+
buildListSection('🎮 Extras', [
|
|
77
|
+
{ id: 'paquete_redes', title: 'Redes sociales', description: '5 GB redes por $99' },
|
|
78
|
+
]),
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
await sock.sendMessage('5215512345670@s.whatsapp.net', listMsg)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Buttons with ExternalAdReply
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
import { buildInteractiveMessage, buildExternalAdReply } from 'baileys-natsu-v1'
|
|
89
|
+
|
|
90
|
+
const msg = buildInteractiveMessage(
|
|
91
|
+
'Ofertas del mes',
|
|
92
|
+
buildExternalAdReply({
|
|
93
|
+
title: '🔥 50% OFF en recargas',
|
|
94
|
+
body: 'Válido hasta el 31 de julio',
|
|
95
|
+
mediaUrl: 'https://ejemplo.com/banner.jpg',
|
|
96
|
+
mediaType: 1,
|
|
97
|
+
thumbnail: someBufferThumbnail,
|
|
98
|
+
sourceUrl: 'https://ejemplo.com/oferta',
|
|
99
|
+
sourceType: 'Banner',
|
|
100
|
+
}),
|
|
101
|
+
[
|
|
102
|
+
{ buttonId: 'recargar', buttonText: { displayText: '🔄 Recargar ahora' } },
|
|
103
|
+
{ buttonId: 'ver_mas', buttonText: { displayText: '📋 Ver ofertas' } },
|
|
104
|
+
]
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
await sock.sendMessage('5215512345670@s.whatsapp.net', msg)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Catalog message
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
import { buildCatalogMessage } from 'baileys-natsu-v1'
|
|
114
|
+
|
|
115
|
+
const catalog = buildCatalogMessage(
|
|
116
|
+
'Tienda Online',
|
|
117
|
+
'Productos disponibles',
|
|
118
|
+
[
|
|
119
|
+
{
|
|
120
|
+
id: 'prod_001',
|
|
121
|
+
title: 'Zapatos Nike Air',
|
|
122
|
+
description: 'Talla única, color negro',
|
|
123
|
+
imageUrl: 'https://ejemplo.com/nike.jpg',
|
|
124
|
+
priceAmount: '1599000',
|
|
125
|
+
priceCurrency: 'COP',
|
|
126
|
+
salePriceAmount: '1299000',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
'Ver catálogo completo'
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
await sock.sendMessage('5215512345670@s.whatsapp.net', catalog)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Filter system notifications
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
import makeWASocket from 'baileys-natsu-v1'
|
|
139
|
+
|
|
140
|
+
const sock = makeWASocket({ printQRInTerminal: true, auth })
|
|
141
|
+
|
|
142
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
143
|
+
messages.forEach(msg => {
|
|
144
|
+
if (msg.isSystemNotification) return
|
|
145
|
+
console.log('Mensaje real:', msg.key.remoteJid, msg.message?.conversation)
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## API
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
import {
|
|
154
|
+
makeWASocket,
|
|
155
|
+
useMultiFileAuthState,
|
|
156
|
+
makeInMemoryStore,
|
|
157
|
+
downloadMediaMessage,
|
|
158
|
+
proto,
|
|
159
|
+
isSystemNotification,
|
|
160
|
+
buildExternalAdReply,
|
|
161
|
+
buildInteractiveMessage,
|
|
162
|
+
buildNativeFlowButton,
|
|
163
|
+
buildListMessage,
|
|
164
|
+
buildCatalogMessage,
|
|
165
|
+
buildOrderDetails,
|
|
166
|
+
buildPaymentStatus,
|
|
167
|
+
NATIVE_FLOW_BUTTONS,
|
|
168
|
+
formatRichText,
|
|
169
|
+
fixAudioStatusUpload,
|
|
170
|
+
} from 'baileys-natsu-v1'
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Colaboradores
|
|
174
|
+
|
|
175
|
+
- [@manuelvgx](https://github.com/manuelvgx) — Creador, compilación, readme, tests
|
|
176
|
+
- [@WhiskeySockets](https://github.com/WhiskeySockets) — Baileys original (WAProto)
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
MIT
|