@kyyinfinite/baileys 1.0.0 → 2.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 +408 -64
- package/WAProto/WAProto.proto +360 -916
- package/WAProto/fix-imports.js +22 -18
- package/WAProto/index.d.ts +14015 -0
- package/WAProto/index.js +47122 -81757
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +15 -14
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +99 -107
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Kyyinfinite/AIRich.js +2041 -0
- package/lib/Kyyinfinite/BaseBuilder.js +64 -0
- package/lib/Kyyinfinite/Button.js +341 -0
- package/lib/Kyyinfinite/ButtonV2.js +175 -0
- package/lib/Kyyinfinite/Carousel.js +125 -0
- package/lib/Kyyinfinite/Foad.js +542 -0
- package/lib/Kyyinfinite/Foad2.js +466 -0
- package/lib/Kyyinfinite/Simple/AIBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/BuilderFactories.js +17 -0
- package/lib/Kyyinfinite/Simple/ButtonBuilder.js +107 -0
- package/lib/Kyyinfinite/Simple/CardBuilder.js +179 -0
- package/lib/Kyyinfinite/Simple/CarouselBuilder.js +97 -0
- package/lib/Kyyinfinite/Simple/FoadBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/MediaBuilder.js +35 -0
- package/lib/Kyyinfinite/Simple/MessageBuilder.js +41 -0
- package/lib/Kyyinfinite/Simple/MessageTypesBuilder.js +3 -0
- package/lib/Kyyinfinite/Simple/SimpleBuilder.js +28 -0
- package/lib/Kyyinfinite/Simple/SimpleClient.js +83 -0
- package/lib/Kyyinfinite/Simple/TextBuilder.js +22 -0
- package/lib/Kyyinfinite/Simple/index.d.ts +141 -0
- package/lib/Kyyinfinite/Simple/index.js +31 -0
- package/lib/Kyyinfinite/Toolkit.js +453 -0
- package/lib/Kyyinfinite/constants.js +1 -0
- package/lib/Kyyinfinite/errors.js +39 -0
- package/lib/Kyyinfinite/index.d.ts +2 -0
- package/lib/Kyyinfinite/index.js +2 -0
- package/lib/Kyyinfinite/wrapper.d.ts +2 -0
- package/lib/Kyyinfinite/wrapper.js +10 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js +45 -17
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +4 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js +6 -0
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/business.d.ts +213 -532
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +358 -401
- package/lib/Socket/chats.d.ts +16 -2
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +247 -40
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +269 -641
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/groups.d.ts +13 -2
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +21 -1
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +255 -631
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +9 -10
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +23 -58
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +645 -181
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +195 -575
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +1099 -1549
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +2 -8
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +11 -18
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +167 -302
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +6 -2
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +59 -25
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +22 -34
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Contact.d.ts +2 -0
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +20 -1
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +4 -1
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +239 -341
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/{Newsletter.d.ts → Mex.d.ts} +11 -5
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/{Newsletter.js → Mex.js} +9 -3
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Signal.d.ts +12 -1
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Socket.d.ts +126 -148
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/State.d.ts +58 -0
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +43 -0
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +23 -30
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +5 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +12 -0
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js +1 -0
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts +34 -4
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +80 -20
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +18 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js +34 -0
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +2 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +49 -1
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +3 -2
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +10 -1
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +2 -0
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js +12 -9
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +7 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js +1 -0
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +22 -25
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +2 -4
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/logger.d.ts +1 -2
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +5 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +40 -0
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +16 -13
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +85 -79
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +1 -1
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +751 -1096
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +103 -1
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/signal.d.ts +13 -0
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js +42 -0
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js +1 -0
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +26 -1
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js +151 -5
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +12 -2
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +1 -3
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +0 -78
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +26 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +1 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +1 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +6 -2
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +4 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +8 -0
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -12
- package/lib/index.js.map +1 -1
- package/package.json +93 -23
- package/LICENSE +0 -21
- package/lib/Socket/dugong.d.ts +0 -130
- package/lib/Socket/dugong.d.ts.map +0 -1
- package/lib/Socket/dugong.js +0 -768
- package/lib/Socket/dugong.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Utils/kyy-features.d.ts +0 -158
- package/lib/Utils/kyy-features.js +0 -365
- package/lib/Utils/rich-messages.d.ts +0 -277
- package/lib/Utils/rich-messages.d.ts.map +0 -1
- package/lib/Utils/rich-messages.js +0 -1144
- package/lib/Utils/rich-messages.js.map +0 -1
- package/lib/Utils/sticker-pack.d.ts +0 -10
- package/lib/Utils/sticker-pack.js +0 -111
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=15&duration=2500&pause=800&color=00B4D8¢er=true&vCenter=true&width=750&lines=@kyyinfinite%2Fbaileys+%E2%80%94+
|
|
3
|
+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=15&duration=2500&pause=800&color=00B4D8¢er=true&vCenter=true&width=750&lines=@kyyinfinite%2Fbaileys+%E2%80%94+v2.0.0;Interactive+Messages+%7C+Flow+Buttons+%7C+List+Menus;AI+Rich+Response+%7C+Table+%7C+Code+Block+%7C+Link;Album+Messages+%7C+Multi-media+Grouped+Delivery;Based+on+WhiskeySockets%2FBaileys+v7.0.0-rc14;ESM-only+%7C+TypeScript+%7C+Signal+Protocol" alt="Typing SVG" />
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@kyyinfinite/baileys)
|
|
8
|
+
[](https://github.com/WhiskeySockets/Baileys/releases/tag/v7.0.0-rc14)
|
|
8
9
|
[](https://www.npmjs.com/package/@kyyinfinite/baileys)
|
|
9
10
|
[](LICENSE)
|
|
10
11
|
[](https://nodejs.org)
|
|
@@ -14,15 +15,16 @@
|
|
|
14
15
|
|
|
15
16
|
<br/>
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
**newsletter helpers**, **status mentions**, and additional **business / community utilities**.
|
|
18
|
+
**`@kyyinfinite/baileys`** is built on top of the official **[WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc14** release.
|
|
19
|
+
It keeps the native Baileys socket API intact while adding a cleaner **Kyyinfinite Simple API** for message building, media, buttons, carousels, and other helpers.
|
|
20
20
|
|
|
21
21
|
<br/>
|
|
22
22
|
|
|
23
23
|
> [!IMPORTANT]
|
|
24
24
|
> **`@kyyinfinite/baileys`** is **ESM-only**. You must set `"type": "module"` in your `package.json`.
|
|
25
25
|
> CommonJS projects must migrate or use dynamic `import()` wrappers.
|
|
26
|
+
>
|
|
27
|
+
> **Base:** `@whiskeysockets/baileys@7.0.0-rc14`
|
|
26
28
|
|
|
27
29
|
<br/>
|
|
28
30
|
|
|
@@ -36,12 +38,16 @@ with native support for **interactive messages**, **album messages**, **unified
|
|
|
36
38
|
- [✅ Requirements](#-requirements)
|
|
37
39
|
- [📦 Installation](#-installation)
|
|
38
40
|
- [🚀 Quick Start](#-quick-start)
|
|
39
|
-
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
41
|
+
- [✨ Simple API](#-simple-api)
|
|
42
|
+
- [Setup](#setup)
|
|
43
|
+
- [Text](#text-1)
|
|
44
|
+
- [Media](#media)
|
|
45
|
+
- [Message Builder](#message-builder)
|
|
46
|
+
- [Buttons](#buttons)
|
|
47
|
+
- [Carousel](#carousel-1)
|
|
48
|
+
- [Generic Message Helpers](#generic-message-helpers)
|
|
49
|
+
- [Non-mutating API](#non-mutating-api)
|
|
50
|
+
- [Native Baileys Still Works](#native-baileys-still-works)
|
|
45
51
|
- [💬 Message Examples](#-message-examples)
|
|
46
52
|
- [Text](#text)
|
|
47
53
|
- [Image](#image)
|
|
@@ -92,11 +98,11 @@ with native support for **interactive messages**, **album messages**, **unified
|
|
|
92
98
|
|
|
93
99
|
| Feature | Description | Status |
|
|
94
100
|
|---|---|:---:|
|
|
95
|
-
| **Interactive Messages** | Native flow buttons, list/select menus,
|
|
101
|
+
| **Interactive Messages** | Native Baileys interactive messages, native flow buttons, list/select menus, and carousel structures | ✅ |
|
|
96
102
|
| **Flow Buttons** | `quick_reply`, `cta_url`, `cta_copy` and more button types | ✅ |
|
|
97
103
|
| **Native Button** | Native WhatsApp button structures | ✅ |
|
|
98
|
-
| **Carousel** | Multi-card carousel messages
|
|
99
|
-
| **AI Rich Response** | `sendTable`, `sendList`, `sendCodeBlock`,
|
|
104
|
+
| **Carousel** | Multi-card carousel messages using Baileys `interactiveMessage` / `carouselMessage` structures | ✅ |
|
|
105
|
+
| **AI Rich Response** | Rich-response message structures plus Kyyinfinite helper methods such as `sendTable`, `sendList`, `sendCodeBlock`, and `sendUnifiedResponse` | ✅ |
|
|
100
106
|
| **Album Messages** | Multi-image/video album relay with count metadata and grouped delivery | ✅ |
|
|
101
107
|
| **Link Messages** | Rich inline links with citations, proofs, and forwarded bot context | ✅ |
|
|
102
108
|
| **Table Message** | `sendTable()` / `sendTableV2()` styled as Meta AI tables | ✅ |
|
|
@@ -124,6 +130,7 @@ with native support for **interactive messages**, **album messages**, **unified
|
|
|
124
130
|
| Requirement | Version / Detail |
|
|
125
131
|
|---|---|
|
|
126
132
|
| **Node.js** | `>= 20.0.0` |
|
|
133
|
+
| **Baileys base** | `7.0.0-rc14` |
|
|
127
134
|
| **Module system** | ESM only — `"type": "module"` in `package.json` |
|
|
128
135
|
| **Auth store** | Persistent auth required for production use |
|
|
129
136
|
|
|
@@ -364,6 +371,320 @@ sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
|
|
|
364
371
|
|
|
365
372
|
---
|
|
366
373
|
|
|
374
|
+
## ✨ Simple API
|
|
375
|
+
|
|
376
|
+
> [!NOTE]
|
|
377
|
+
> **v2.0.0** introduces the `@kyyinfinite/baileys` Simple API — a fluent wrapper on top of the native socket.
|
|
378
|
+
> Native Baileys methods remain available and unchanged.
|
|
379
|
+
|
|
380
|
+
### Setup
|
|
381
|
+
|
|
382
|
+
```js
|
|
383
|
+
import makeWASocket, {
|
|
384
|
+
useMultiFileAuthState,
|
|
385
|
+
attachKyyinfinite,
|
|
386
|
+
} from "@kyyinfinite/baileys";
|
|
387
|
+
|
|
388
|
+
const { state, saveCreds } = await useMultiFileAuthState("./session");
|
|
389
|
+
|
|
390
|
+
const sock = makeWASocket({
|
|
391
|
+
auth: state,
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
sock.ev.on("creds.update", saveCreds);
|
|
395
|
+
|
|
396
|
+
attachKyyinfinite(sock);
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
After attaching the wrapper, the socket can use both the original Baileys API and the simpler fluent API.
|
|
400
|
+
|
|
401
|
+
### Text
|
|
402
|
+
|
|
403
|
+
```js
|
|
404
|
+
await sock.text("Hello")
|
|
405
|
+
.send(jid);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Media
|
|
409
|
+
|
|
410
|
+
```js
|
|
411
|
+
await sock.image({ url: "./image.jpg" })
|
|
412
|
+
.caption("Hello")
|
|
413
|
+
.send(jid);
|
|
414
|
+
|
|
415
|
+
await sock.video({ url: "./video.mp4" })
|
|
416
|
+
.caption("Video")
|
|
417
|
+
.send(jid);
|
|
418
|
+
|
|
419
|
+
await sock.audio({ url: "./audio.mp3" })
|
|
420
|
+
.send(jid);
|
|
421
|
+
|
|
422
|
+
await sock.voice({ url: "./voice.ogg" })
|
|
423
|
+
.send(jid);
|
|
424
|
+
|
|
425
|
+
await sock.sticker({ url: "./sticker.webp" })
|
|
426
|
+
.send(jid);
|
|
427
|
+
|
|
428
|
+
await sock.document({ url: "./file.pdf" })
|
|
429
|
+
.fileName("document.pdf")
|
|
430
|
+
.send(jid);
|
|
431
|
+
|
|
432
|
+
await sock.ptv({ url: "./video.mp4" })
|
|
433
|
+
.send(jid);
|
|
434
|
+
|
|
435
|
+
await sock.gif({ url: "./video.mp4" })
|
|
436
|
+
.send(jid);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Message Builder
|
|
440
|
+
|
|
441
|
+
```js
|
|
442
|
+
await sock.text("Hello")
|
|
443
|
+
.footer("Powered by @kyyinfinite/baileys")
|
|
444
|
+
.mentions(["6281234567890@s.whatsapp.net"])
|
|
445
|
+
.send(jid);
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Supported fluent options include:
|
|
449
|
+
|
|
450
|
+
```text
|
|
451
|
+
text()
|
|
452
|
+
footer()
|
|
453
|
+
context()
|
|
454
|
+
mentions()
|
|
455
|
+
viewOnce()
|
|
456
|
+
edit()
|
|
457
|
+
payload()
|
|
458
|
+
build()
|
|
459
|
+
send()
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Buttons
|
|
463
|
+
|
|
464
|
+
```js
|
|
465
|
+
await sock.button()
|
|
466
|
+
.title("Welcome")
|
|
467
|
+
.body("Choose an option")
|
|
468
|
+
.footer("Powered by @kyyinfinite/baileys")
|
|
469
|
+
.addButton("Menu", "menu")
|
|
470
|
+
.send(jid);
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
CTA helpers are also available:
|
|
474
|
+
|
|
475
|
+
```js
|
|
476
|
+
await sock.button()
|
|
477
|
+
.title("Actions")
|
|
478
|
+
.body("Choose an action")
|
|
479
|
+
.reply("Reply", "reply_1")
|
|
480
|
+
.url("Website", "https://example.com")
|
|
481
|
+
.copy("Copy", "KYY-001")
|
|
482
|
+
.call("Call", "628123456789")
|
|
483
|
+
.send(jid);
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
The copy helper also supports the shorthand typo-compatible alias:
|
|
487
|
+
|
|
488
|
+
```js
|
|
489
|
+
.copy("Copy", "KYY-001")
|
|
490
|
+
.coppy("Copy", "KYY-001")
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Additional button helpers:
|
|
494
|
+
|
|
495
|
+
```text
|
|
496
|
+
reply() / quickReply()
|
|
497
|
+
call()
|
|
498
|
+
url()
|
|
499
|
+
copy() / coppy()
|
|
500
|
+
reminder()
|
|
501
|
+
cancelReminder()
|
|
502
|
+
address()
|
|
503
|
+
location()
|
|
504
|
+
select()
|
|
505
|
+
section()
|
|
506
|
+
row()
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### ButtonV2
|
|
510
|
+
|
|
511
|
+
```js
|
|
512
|
+
await sock.buttonV2()
|
|
513
|
+
.title("Button V2")
|
|
514
|
+
.body("Choose an option")
|
|
515
|
+
.send(jid);
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
The raw builder is still available when full low-level control is required.
|
|
519
|
+
|
|
520
|
+
### Carousel
|
|
521
|
+
|
|
522
|
+
The carousel API supports a nested fluent card builder:
|
|
523
|
+
|
|
524
|
+
```js
|
|
525
|
+
await sock.carousel()
|
|
526
|
+
.body("Choose a product")
|
|
527
|
+
.footer("Kyyinfinite")
|
|
528
|
+
.card()
|
|
529
|
+
.image({ url: "./product-1.jpg" })
|
|
530
|
+
.title("Product One")
|
|
531
|
+
.body("Product description")
|
|
532
|
+
.button("Pilih", "product_1")
|
|
533
|
+
.url("Website", "https://example.com")
|
|
534
|
+
.copy("Copy Code", "KYY-001")
|
|
535
|
+
.call("Call", "628123456789")
|
|
536
|
+
.add()
|
|
537
|
+
.card()
|
|
538
|
+
.image({ url: "./product-2.jpg" })
|
|
539
|
+
.title("Product Two")
|
|
540
|
+
.body("Product two")
|
|
541
|
+
.button("Pilih", "product_2")
|
|
542
|
+
.add()
|
|
543
|
+
.send(jid);
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
Card helpers:
|
|
547
|
+
|
|
548
|
+
```text
|
|
549
|
+
title()
|
|
550
|
+
body() / text()
|
|
551
|
+
footer()
|
|
552
|
+
image()
|
|
553
|
+
video()
|
|
554
|
+
media()
|
|
555
|
+
button()
|
|
556
|
+
reply() / quickReply()
|
|
557
|
+
url()
|
|
558
|
+
copy() / coppy()
|
|
559
|
+
call()
|
|
560
|
+
buttons()
|
|
561
|
+
rawButton()
|
|
562
|
+
context()
|
|
563
|
+
payload()
|
|
564
|
+
build()
|
|
565
|
+
add()
|
|
566
|
+
end()
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Carousel helpers:
|
|
570
|
+
|
|
571
|
+
```text
|
|
572
|
+
card()
|
|
573
|
+
addCard()
|
|
574
|
+
cards()
|
|
575
|
+
clear()
|
|
576
|
+
title()
|
|
577
|
+
subtitle()
|
|
578
|
+
body() / text()
|
|
579
|
+
footer()
|
|
580
|
+
context()
|
|
581
|
+
payload()
|
|
582
|
+
loadFrom()
|
|
583
|
+
build()
|
|
584
|
+
send()
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Generic Message Helpers
|
|
588
|
+
|
|
589
|
+
```js
|
|
590
|
+
await sock.message({ text: "Hello" })
|
|
591
|
+
.send(jid);
|
|
592
|
+
|
|
593
|
+
await sock.poll(
|
|
594
|
+
"What's your favorite language?",
|
|
595
|
+
["JavaScript", "TypeScript", "Python"],
|
|
596
|
+
1
|
|
597
|
+
).send(jid);
|
|
598
|
+
|
|
599
|
+
await sock.location({
|
|
600
|
+
degreesLatitude: -6.2088,
|
|
601
|
+
degreesLongitude: 106.8456,
|
|
602
|
+
name: "Jakarta"
|
|
603
|
+
}).send(jid);
|
|
604
|
+
|
|
605
|
+
await sock.react(msg.key, "👍");
|
|
606
|
+
|
|
607
|
+
await sock.delete(msg.key);
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
Available helpers include:
|
|
611
|
+
|
|
612
|
+
```text
|
|
613
|
+
message()
|
|
614
|
+
poll()
|
|
615
|
+
event()
|
|
616
|
+
album()
|
|
617
|
+
contacts()
|
|
618
|
+
location()
|
|
619
|
+
buttonReply()
|
|
620
|
+
listReply()
|
|
621
|
+
react()
|
|
622
|
+
groupInvite()
|
|
623
|
+
product()
|
|
624
|
+
requestPhoneNumber()
|
|
625
|
+
sharePhoneNumber()
|
|
626
|
+
pin()
|
|
627
|
+
forward()
|
|
628
|
+
delete()
|
|
629
|
+
disappearing()
|
|
630
|
+
limitSharing()
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### Non-mutating API
|
|
634
|
+
|
|
635
|
+
If you do not want to modify the socket object, create a separate API facade:
|
|
636
|
+
|
|
637
|
+
```js
|
|
638
|
+
import {
|
|
639
|
+
createKyyinfinite,
|
|
640
|
+
} from "@kyyinfinite/baileys";
|
|
641
|
+
|
|
642
|
+
const api = createKyyinfinite(sock);
|
|
643
|
+
|
|
644
|
+
await api.text("Hello")
|
|
645
|
+
.send(jid);
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
The facade keeps the original socket accessible through `api.raw`:
|
|
649
|
+
|
|
650
|
+
```js
|
|
651
|
+
api.raw
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Raw wrapper classes are available through:
|
|
655
|
+
|
|
656
|
+
```js
|
|
657
|
+
api.raw.Button
|
|
658
|
+
api.raw.ButtonV2
|
|
659
|
+
api.raw.Carousel
|
|
660
|
+
api.raw.AIRich
|
|
661
|
+
api.raw.Toolkit
|
|
662
|
+
api.raw.Foad
|
|
663
|
+
api.raw.Foad2
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Use the Simple API for everyday message construction while keeping the raw builders available whenever lower-level control is needed.
|
|
667
|
+
|
|
668
|
+
### Native Baileys Still Works
|
|
669
|
+
|
|
670
|
+
The Simple API does not replace native socket methods:
|
|
671
|
+
|
|
672
|
+
```js
|
|
673
|
+
await sock.sendMessage(jid, {
|
|
674
|
+
text: "Hello from native Baileys"
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
await sock.sendPresenceUpdate("composing", jid);
|
|
678
|
+
|
|
679
|
+
sock.ev.on("messages.upsert", ({ messages }) => {
|
|
680
|
+
console.log(messages);
|
|
681
|
+
});
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
Use the Simple API when you want shorter, cleaner code. Use the native API or `.raw` builders whenever you need lower-level control.
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
367
688
|
## 💬 Message Examples
|
|
368
689
|
|
|
369
690
|
### Text
|
|
@@ -551,8 +872,8 @@ await sock.sendMessage(jid, {
|
|
|
551
872
|
## ⚡ Interactive Messages
|
|
552
873
|
|
|
553
874
|
> [!NOTE]
|
|
554
|
-
> Interactive messages are
|
|
555
|
-
>
|
|
875
|
+
> Interactive messages are based on the native **Baileys v7.0.0-rc14** message structures.
|
|
876
|
+
> The Kyyinfinite Simple API provides a shorter fluent interface on top of those native structures.
|
|
556
877
|
|
|
557
878
|
### Flow Buttons
|
|
558
879
|
|
|
@@ -657,43 +978,74 @@ await sock.sendMessage(jid, {
|
|
|
657
978
|
|
|
658
979
|
### Carousel
|
|
659
980
|
|
|
981
|
+
For the native Baileys structure, a carousel is represented by an `interactiveMessage` containing a `carouselMessage`. Media headers are prepared before the message is relayed:
|
|
982
|
+
|
|
660
983
|
```js
|
|
661
|
-
import {
|
|
984
|
+
import {
|
|
985
|
+
proto,
|
|
986
|
+
prepareWAMessageMedia,
|
|
987
|
+
generateWAMessageFromContent,
|
|
988
|
+
} from "@kyyinfinite/baileys";
|
|
662
989
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
990
|
+
const cards = [];
|
|
991
|
+
|
|
992
|
+
for (const [index, imageUrl] of [
|
|
993
|
+
"https://example.com/card1.jpg",
|
|
994
|
+
"https://example.com/card2.jpg",
|
|
995
|
+
]) {
|
|
996
|
+
const media = await prepareWAMessageMedia(
|
|
997
|
+
{ image: { url: imageUrl } },
|
|
998
|
+
{ upload: sock.waUploadToServer },
|
|
999
|
+
);
|
|
1000
|
+
|
|
1001
|
+
cards.push(
|
|
1002
|
+
proto.Message.InteractiveMessage.fromObject({
|
|
1003
|
+
header: {
|
|
1004
|
+
title: `Card ${index + 1}`,
|
|
1005
|
+
hasMediaAttachment: true,
|
|
1006
|
+
...media,
|
|
678
1007
|
},
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
},
|
|
683
|
-
title: "Card Two",
|
|
684
|
-
body: "Description for the second card.",
|
|
1008
|
+
body: { text: `Description for card ${index + 1}` },
|
|
1009
|
+
footer: { text: "@kyyinfinite/baileys" },
|
|
1010
|
+
nativeFlowMessage: {
|
|
685
1011
|
buttons: [
|
|
686
1012
|
{
|
|
687
1013
|
name: "quick_reply",
|
|
688
|
-
buttonParamsJson: JSON.stringify({
|
|
1014
|
+
buttonParamsJson: JSON.stringify({
|
|
1015
|
+
display_text: "Select",
|
|
1016
|
+
id: `card_${index + 1}`,
|
|
1017
|
+
}),
|
|
689
1018
|
},
|
|
690
1019
|
],
|
|
691
1020
|
},
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}
|
|
1021
|
+
}),
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
const message = generateWAMessageFromContent(
|
|
1026
|
+
jid,
|
|
1027
|
+
{
|
|
1028
|
+
viewOnceMessage: {
|
|
1029
|
+
message: {
|
|
1030
|
+
interactiveMessage: proto.Message.InteractiveMessage.fromObject({
|
|
1031
|
+
body: { text: "Choose a product" },
|
|
1032
|
+
footer: { text: "Swipe to see more" },
|
|
1033
|
+
carouselMessage: { cards },
|
|
1034
|
+
}),
|
|
1035
|
+
},
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1038
|
+
{},
|
|
1039
|
+
);
|
|
1040
|
+
|
|
1041
|
+
await sock.relayMessage(
|
|
1042
|
+
jid,
|
|
1043
|
+
message.message,
|
|
1044
|
+
{ messageId: message.key.id },
|
|
1045
|
+
);
|
|
695
1046
|
```
|
|
696
1047
|
|
|
1048
|
+
|
|
697
1049
|
### Native Interactive
|
|
698
1050
|
|
|
699
1051
|
Combine multiple button types in a single message:
|
|
@@ -735,7 +1087,7 @@ await sock.sendMessage(jid, {
|
|
|
735
1087
|
|
|
736
1088
|
> [!NOTE]
|
|
737
1089
|
> These message types are styled to match **Meta AI's** WhatsApp response format — tables, code blocks, and rich linked text.
|
|
738
|
-
>
|
|
1090
|
+
> The underlying rich-response message types are part of the Baileys v7 line. The `sendTable()`, `sendList()`, `sendCodeBlock()`, and related convenience methods documented here are exposed by this package.
|
|
739
1091
|
|
|
740
1092
|
### sendTable()
|
|
741
1093
|
|
|
@@ -767,7 +1119,7 @@ await sock.sendList(
|
|
|
767
1119
|
"Bot Information",
|
|
768
1120
|
[
|
|
769
1121
|
["Package", "@kyyinfinite/baileys"],
|
|
770
|
-
["Version", "0.
|
|
1122
|
+
["Version", "2.0.0"],
|
|
771
1123
|
["Developer", "kyyinfinite"],
|
|
772
1124
|
["License", "MIT"],
|
|
773
1125
|
["Node", ">= 20"],
|
|
@@ -1286,8 +1638,6 @@ import {
|
|
|
1286
1638
|
DisconnectReason,
|
|
1287
1639
|
Browsers,
|
|
1288
1640
|
|
|
1289
|
-
//advance
|
|
1290
|
-
Dugong,
|
|
1291
1641
|
|
|
1292
1642
|
} from "@kyyinfinite/baileys";
|
|
1293
1643
|
```
|
|
@@ -1465,30 +1815,24 @@ Then instantiate a separate `makeWASocket` for each session.
|
|
|
1465
1815
|
<details>
|
|
1466
1816
|
<summary><strong>Interactive messages are not rendering. What's wrong?</strong></summary>
|
|
1467
1817
|
|
|
1468
|
-
Interactive messages
|
|
1469
|
-
|
|
1470
|
-
- A **WhatsApp Business API**-capable number, or
|
|
1471
|
-
- A number that has been granted access to the interactive message API by WhatsApp.
|
|
1472
|
-
|
|
1473
|
-
On regular personal numbers, interactive messages may silently fail or show as plain text.
|
|
1818
|
+
Interactive messages depend on the message type, current WhatsApp client behavior, and server-side availability. Rendering can differ between WhatsApp Web, Android, and iOS. Test the specific interactive structure with the account and client versions you target.
|
|
1474
1819
|
|
|
1475
1820
|
</details>
|
|
1476
1821
|
|
|
1477
1822
|
<details>
|
|
1478
1823
|
<summary><strong>What is the difference from official Baileys?</strong></summary>
|
|
1479
1824
|
|
|
1480
|
-
| Area |
|
|
1825
|
+
| Area | Baileys v7.0.0-rc14 | @kyyinfinite/baileys |
|
|
1481
1826
|
|---|---|---|
|
|
1482
|
-
|
|
|
1483
|
-
|
|
|
1484
|
-
|
|
|
1485
|
-
|
|
|
1486
|
-
|
|
|
1487
|
-
|
|
|
1488
|
-
| Newsletter
|
|
1489
|
-
|
|
|
1490
|
-
|
|
|
1491
|
-
| LID support | Basic | ✅ Full LID↔PN mapping + migration |
|
|
1827
|
+
| Native socket API | ✅ | ✅ Preserved |
|
|
1828
|
+
| ESM | ✅ | ✅ |
|
|
1829
|
+
| Interactive messages | ✅ Native structures | ✅ Plus fluent builders |
|
|
1830
|
+
| Carousel messages | ✅ Native `carouselMessage` structures | ✅ Plus nested carousel builder |
|
|
1831
|
+
| Rich responses | ✅ Native rich-response structures | ✅ Plus convenience helpers |
|
|
1832
|
+
| Media messages | ✅ | ✅ Plus fluent media builders |
|
|
1833
|
+
| Newsletter / Group / Business APIs | ✅ | ✅ Native API preserved |
|
|
1834
|
+
| Simple fluent API | — | ✅ `text()`, `image()`, `button()`, `carousel()`, etc. |
|
|
1835
|
+
| Raw escape hatch | ✅ Native socket / proto APIs | ✅ `api.raw` + native socket |
|
|
1492
1836
|
|
|
1493
1837
|
</details>
|
|
1494
1838
|
|
|
@@ -1543,7 +1887,7 @@ copies or substantial portions of the Software.
|
|
|
1543
1887
|
|
|
1544
1888
|
<br/>
|
|
1545
1889
|
|
|
1546
|
-
**© 2026 kyyinfinite — `@kyyinfinite/baileys`
|
|
1890
|
+
**© 2026 kyyinfinite — `@kyyinfinite/baileys` v2.0.0 • MIT License**
|
|
1547
1891
|
|
|
1548
1892
|
*Built on top of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)*
|
|
1549
1893
|
|