@blurose/baileys 1.1.1 → 1.1.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 +128 -8
- package/lib/Utils/messages.js +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align='center'><img alt="Baileys logo" src="https://veracloud.biz.id/dEPF.jpg" height="auto"/><br/>Baileys Newsletter (blurose/baileys)</h1>
|
|
2
2
|
|
|
3
|
-
<div align='center'>A WebSockets-based TypeScript library for interacting with the WhatsApp Web API, customized for Newsletter/Channel Media support.</div>
|
|
3
|
+
<div align='center'>A WebSockets-based TypeScript library for interacting with the WhatsApp Web API, customized for Newsletter/Channel Media support and built-in Advanced Interactive Message Builders (MessageBuilder v4.6).</div>
|
|
4
4
|
|
|
5
5
|
> [!IMPORTANT]
|
|
6
6
|
> **This is a custom fork and patch of `@whiskeysockets/baileys` (`blurose/baileys`)**
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
> Developed & Maintained by: **Xyraa Team** & **alfavz**.
|
|
9
9
|
>
|
|
10
10
|
> This version introduces stable and native support for sending media (audios, images, videos, and documents) to WhatsApp Channels / Newsletters, bypassing E2E encryption for public channel broadcasts, and properly formatting the output stanzas (`type="media"` and `mediatype` metadata) which is currently unsupported in the official WhiskeySockets repository.
|
|
11
|
+
>
|
|
12
|
+
> In addition, it integrates **MessageBuilder v4.6** directly into the library, allowing you to generate advanced UI components (Buttons, Carousels, Native Flows, and AI Rich Responses) natively and easily.
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
@@ -24,19 +26,14 @@ Use at your own discretion. Do not spam people with this. We discourage any stal
|
|
|
24
26
|
- **No Selenium/Chromium**: Baileys does not require Selenium or any other browser to interface with WhatsApp Web, saving massive amounts of RAM.
|
|
25
27
|
- **Multi-Device Support**: Interacts natively with the multi-device and web versions of WhatsApp.
|
|
26
28
|
- **Newsletter Media Patch**: Automatically maps correct CDN upload endpoints and formats stanzas so media displays perfectly in WhatsApp Channels.
|
|
29
|
+
- **MessageBuilder v4.6 (Built-in)**: Chainable API for creating Buttons, Carousels, Native Flow messages, and AI Rich Response payloads natively from the library.
|
|
27
30
|
|
|
28
31
|
## Install
|
|
29
32
|
|
|
30
33
|
To install this custom patched version into your project, use:
|
|
31
34
|
|
|
32
35
|
```bash
|
|
33
|
-
npm install
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Or when published to npm:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install blurose/baileys
|
|
36
|
+
npm install @blurose/baileys
|
|
40
37
|
```
|
|
41
38
|
|
|
42
39
|
Then import it in your code:
|
|
@@ -63,6 +60,11 @@ import makeWASocket from 'baileys' // (or whichever alias is configured)
|
|
|
63
60
|
- [Whatsapp IDs Explain](#whatsapp-ids-explain)
|
|
64
61
|
- [Utility Functions](#utility-functions)
|
|
65
62
|
- [Sending Messages](#sending-messages)
|
|
63
|
+
- [MessageBuilder Documentation (UI Components)](#messagebuilder-documentation-ui-components)
|
|
64
|
+
- [1. Button Builder (Button V1)](#1-button-builder-button-v1)
|
|
65
|
+
- [2. ButtonV2 Builder (Native Flow)](#2-buttonv2-builder-native-flow)
|
|
66
|
+
- [3. Carousel Builder](#3-carousel-builder)
|
|
67
|
+
- [4. AIRich Builder (AI Rich Response)](#4-airich-builder-ai-rich-response)
|
|
66
68
|
- [Modify Messages](#modify-messages)
|
|
67
69
|
- [Manipulating Media Messages](#manipulating-media-messages)
|
|
68
70
|
- [Reject Call](#reject-call)
|
|
@@ -160,6 +162,124 @@ await sock.sendMessage(channelJid, {
|
|
|
160
162
|
|
|
161
163
|
---
|
|
162
164
|
|
|
165
|
+
## MessageBuilder Documentation (UI Components)
|
|
166
|
+
|
|
167
|
+
You can import the builders directly from the library:
|
|
168
|
+
```javascript
|
|
169
|
+
const { Button, ButtonV2, Carousel, AIRich } = require('@blurose/baileys');
|
|
170
|
+
// or when using ESM:
|
|
171
|
+
// import { Button, ButtonV2, Carousel, AIRich } from 'baileys';
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 1. Button Builder (Button V1)
|
|
175
|
+
Create interactive messages containing a title, subtitle, image, reply buttons, copy code buttons, URL buttons, and drop-down menu lists.
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
await new Button(sock)
|
|
179
|
+
.setTitle('🚀 NIXCODE')
|
|
180
|
+
.setSubtitle('Interactive Message')
|
|
181
|
+
.setBody('Pilih menu di bawah')
|
|
182
|
+
.setFooter('© Nixel')
|
|
183
|
+
.setImage('https://cdn.ornzora.eu.cc/b57c0d1e-d7a6-4277-8739-8f6b1d9894e6-FIORA.jpg')
|
|
184
|
+
.addReply('📦 Menu', '.menu', { icon: 'DEFAULT' })
|
|
185
|
+
.addReply('👤 Profile', '.profile', { icon: 'REVIEW' })
|
|
186
|
+
.addUrl('🌐 Website', 'https://example.com', true, { icon: 'PROMOTION' })
|
|
187
|
+
.addCopy('📋 Copy Code', 'NIX-2026', { icon: 'DOCUMENT' })
|
|
188
|
+
.addSelection('📚 Pilih Kategori')
|
|
189
|
+
.makeSection('Main Menu')
|
|
190
|
+
.makeRow('🔥 HOT', 'Downloader', 'Download social media', '.dl')
|
|
191
|
+
.makeRow('⚡ FAST', 'AI Chat', 'Chat dengan AI', '.ai')
|
|
192
|
+
.send(m.chat, { quoted: m });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 2. ButtonV2 Builder (Native Flow)
|
|
196
|
+
Create clean Native Flow buttons (e.g. quick reply buttons) for professional bots.
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
await new ButtonV2(sock)
|
|
200
|
+
.setTitle('🚀 NIXCODE')
|
|
201
|
+
.setSubtitle('Buttons Message')
|
|
202
|
+
.setBody('Halo dunia')
|
|
203
|
+
.setFooter('Footer Message')
|
|
204
|
+
.setThumbnail('https://cdn.ornzora.eu.cc/4d2905ce-3707-4ec0-998a-68a3d851629f-FIORA.jpg')
|
|
205
|
+
.addButton('👤 Profile', '.profile')
|
|
206
|
+
.addButton('📡 Menu', '.menu')
|
|
207
|
+
.send(m.chat, { quoted: m });
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 3. Carousel Builder
|
|
211
|
+
Create beautiful horizontal sliding cards (swipeable cards) with images and dedicated actions for each card.
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
await new Carousel(sock)
|
|
215
|
+
.setBody('🛍️ Product List')
|
|
216
|
+
.setFooter('Swipe untuk lihat')
|
|
217
|
+
.addCard(
|
|
218
|
+
await new Button(sock)
|
|
219
|
+
.setTitle('🍔 Burger')
|
|
220
|
+
.setBody('Burger terenak')
|
|
221
|
+
.setFooter('$5')
|
|
222
|
+
.setImage('https://cdn.ornzora.eu.cc/36df8c36-c74e-4dc2-bc03-87893f373cb4-FIORA.jpg')
|
|
223
|
+
.addReply('🛒 Buy', '.buy burger')
|
|
224
|
+
.toCard()
|
|
225
|
+
)
|
|
226
|
+
.addCard(
|
|
227
|
+
await new Button(sock)
|
|
228
|
+
.setTitle('🍕 Pizza')
|
|
229
|
+
.setBody('Pizza mozzarella')
|
|
230
|
+
.setFooter('$7')
|
|
231
|
+
.setImage('https://cdn.ornzora.eu.cc/36df8c36-c74e-4dc2-bc03-87893f373cb4-FIORA.jpg')
|
|
232
|
+
.addReply('🛒 Buy', '.buy pizza')
|
|
233
|
+
.toCard()
|
|
234
|
+
)
|
|
235
|
+
.send(m.chat, { quoted: m });
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 4. AIRich Builder (AI Rich Response)
|
|
239
|
+
Generate AI Rich responses, including formatted Markdown text, citation numbers, auto suggestions, tables, products, reels, and video elements.
|
|
240
|
+
|
|
241
|
+
```javascript
|
|
242
|
+
await new AIRich(sock)
|
|
243
|
+
.setTitle('🚀 NIXCODE')
|
|
244
|
+
.setFooter('© Fiora Sylvie')
|
|
245
|
+
.addSuggest("MessageBuilderV4.6")
|
|
246
|
+
.addSuggest(['Nixel', 'NIXCODE', 'Fiora Sylvie', 'AIRich'])
|
|
247
|
+
.addTip('Ini adalah text tip (Metadata Text)')
|
|
248
|
+
.addText(`
|
|
249
|
+
# Halo Dunia
|
|
250
|
+
## NIXCODE
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
=={ Yellow Text }==
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
Ini hyperlink:
|
|
259
|
+
[Google](https://google.com)
|
|
260
|
+
|
|
261
|
+
Ini auto citation:
|
|
262
|
+
[](https://openai.com)
|
|
263
|
+
`)
|
|
264
|
+
.addProduct({
|
|
265
|
+
title: 'Fiora Sylvie',
|
|
266
|
+
brand: 'Nixel',
|
|
267
|
+
price: 'Rp 1000',
|
|
268
|
+
sale_price: 'Rp 0',
|
|
269
|
+
url: 'https://wa.me/6285188349341',
|
|
270
|
+
image: "https://cdn.ornzora.eu.cc/152f4f0b-02fb-4d60-aacc-fc4cfa87ccdb-FIORA.jpg"
|
|
271
|
+
})
|
|
272
|
+
.addCode('javascript', 'console.log("Hello World");')
|
|
273
|
+
.addTable([
|
|
274
|
+
['Nama', 'Role'],
|
|
275
|
+
['[Nixel](https://wa.me/6285188349341)', 'Developer'],
|
|
276
|
+
['Fiora Sylvie', 'Assistant']
|
|
277
|
+
])
|
|
278
|
+
.send(m.chat, { quoted: m });
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
163
283
|
# Credits & Acknowledgements
|
|
164
284
|
- Forked from the official [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) project by **Rajeh Taher** and contributors.
|
|
165
285
|
- Patch ideas and concepts incorporated from **wileys** package.
|
package/lib/Utils/messages.js
CHANGED
|
@@ -485,6 +485,34 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
+
else if (hasNonNullishProperty(message, 'buttons')) {
|
|
489
|
+
const buttonsMessage = {
|
|
490
|
+
contentText: message.text || message.caption || '',
|
|
491
|
+
footerText: message.footer || '',
|
|
492
|
+
buttons: message.buttons,
|
|
493
|
+
headerType: 1
|
|
494
|
+
};
|
|
495
|
+
if (hasNonNullishProperty(message, 'image')) {
|
|
496
|
+
const { imageMessage } = await prepareWAMessageMedia({ image: message.image }, options);
|
|
497
|
+
buttonsMessage.imageMessage = imageMessage;
|
|
498
|
+
buttonsMessage.headerType = 4;
|
|
499
|
+
}
|
|
500
|
+
else if (hasNonNullishProperty(message, 'video')) {
|
|
501
|
+
const { videoMessage } = await prepareWAMessageMedia({ video: message.video }, options);
|
|
502
|
+
buttonsMessage.videoMessage = videoMessage;
|
|
503
|
+
buttonsMessage.headerType = 5;
|
|
504
|
+
}
|
|
505
|
+
else if (hasNonNullishProperty(message, 'document')) {
|
|
506
|
+
const { documentMessage } = await prepareWAMessageMedia({ document: message.document }, options);
|
|
507
|
+
buttonsMessage.documentMessage = documentMessage;
|
|
508
|
+
buttonsMessage.headerType = 3;
|
|
509
|
+
}
|
|
510
|
+
else if (hasNonNullishProperty(message, 'location')) {
|
|
511
|
+
buttonsMessage.locationMessage = message.location;
|
|
512
|
+
buttonsMessage.headerType = 6;
|
|
513
|
+
}
|
|
514
|
+
m.buttonsMessage = buttonsMessage;
|
|
515
|
+
}
|
|
488
516
|
else {
|
|
489
517
|
m = await prepareWAMessageMedia(message, options);
|
|
490
518
|
}
|