xbaileys 5.0.0-beta.0 → 6.0.0-beta.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 ADDED
@@ -0,0 +1,393 @@
1
+ # WhatsApp Baileys
2
+
3
+ <p align="center">
4
+ <img src="https://files.catbox.moe/369pux.jpg" alt="Thumbnail" />
5
+ </p>
6
+
7
+ WhatsApp Baileys is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
8
+
9
+ Actively developed and maintained, baileys continuously receives updates to enhance stability and performance. One of the main focuses is to improve the pairing and authentication processes to be more stable and secure. Pairing features can be customized with your own codes, making the process more reliable and less prone to interruptions.
10
+
11
+ This library is highly suitable for building business bots, chat automation systems, customer service solutions, and various other communication automation applications that require high stability and comprehensive features. With a lightweight and modular design, baileys is easy to integrate into different systems and platforms.
12
+
13
+ ---
14
+
15
+ ### Main Features and Advantages
16
+
17
+ - Supports automatic and custom pairing processes
18
+ - Fixes previous pairing issues that often caused failures or disconnections
19
+ - Supports interactive messages, action buttons, and dynamic menus
20
+ - Efficient automatic session management for reliable operation
21
+ - Compatible with the latest multi-device features from WhatsApp
22
+ - Lightweight, stable, and easy to integrate into various systems
23
+ - Suitable for developing bots, automation, and complete communication solutions
24
+ - Comprehensive documentation and example codes to facilitate development
25
+
26
+ ---
27
+
28
+ ## Getting Started
29
+
30
+ Begin by installing the library via your preferred package manager, then follow the provided configuration guide. You can also utilize the ready-made example codes to understand how the features work. Use session storage and interactive messaging features to build complete, stable solutions tailored to your business or project needs.
31
+
32
+ ---
33
+
34
+ ## Add Function ( Simple code )
35
+
36
+ ### Check ID Channel
37
+ Get ID channel
38
+
39
+ ```javascript
40
+ await sock.newsletterId(url)
41
+ ```
42
+
43
+ ### Check banned number
44
+ You can see the status of blocked numbers here
45
+
46
+ ```javascript
47
+ await sock.checkWhatsApp(jid)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## SendMessage Documentation
53
+
54
+ ### Status Group Message V2
55
+ Send group status with version 2
56
+
57
+ ```javascript
58
+ await sock.sendMessage(jid, {
59
+ groupStatusMessage: {
60
+ text: "Hello World"
61
+ }
62
+ });
63
+ ```
64
+
65
+ ### Album Message (Multiple Images)
66
+ Send multiple images in a single album message:
67
+
68
+ ```javascript
69
+ await sock.sendMessage(jid, {
70
+ albumMessage: [
71
+ { image: cihuy, caption: "Foto pertama" },
72
+ { image: { url: "URL IMAGE" }, caption: "Foto kedua" }
73
+ ]
74
+ }, { quoted: m });
75
+ ```
76
+
77
+ ### Event Message
78
+ Create and send WhatsApp event invitations:
79
+
80
+ ```javascript
81
+ await sock.sendMessage(jid, {
82
+ eventMessage: {
83
+ isCanceled: false,
84
+ name: "Hello World",
85
+ description: "yume native",
86
+ location: {
87
+ degreesLatitude: 0,
88
+ degreesLongitude: 0,
89
+ name: "rowrrrr"
90
+ },
91
+ joinLink: "https://call.whatsapp.com/video/yumevtc",
92
+ startTime: "1763019000",
93
+ endTime: "1763026200",
94
+ extraGuestsAllowed: false
95
+ }
96
+ }, { quoted: m });
97
+ ```
98
+
99
+ ### Poll Result Message
100
+ Display poll results with vote counts:
101
+
102
+ ```javascript
103
+ await sock.sendMessage(jid, {
104
+ pollResultMessage: {
105
+ name: "Hello World",
106
+ pollVotes: [
107
+ {
108
+ optionName: "TEST 1",
109
+ optionVoteCount: "112233"
110
+ },
111
+ {
112
+ optionName: "TEST 2",
113
+ optionVoteCount: "1"
114
+ }
115
+ ]
116
+ }
117
+ }, { quoted: m });
118
+ ```
119
+
120
+ ### Simple Interactive Message
121
+ Send basic interactive messages with copy button functionality:
122
+
123
+ ```javascript
124
+ await sock.sendMessage(jid, {
125
+ interactiveMessage: {
126
+ header: "Hello World",
127
+ title: "Hello World",
128
+ footer: "telegram: @yumevtc ",
129
+ buttons: [
130
+ {
131
+ name: "cta_copy",
132
+ buttonParamsJson: JSON.stringify({
133
+ display_text: "copy code",
134
+ id: "123456789",
135
+ copy_code: "ABC123XYZ"
136
+ })
137
+ }
138
+ ]
139
+ }
140
+ }, { quoted: m });
141
+ ```
142
+
143
+ ### Interactive Message with Native Flow
144
+ Send interactive messages with buttons, copy actions, and native flow features:
145
+
146
+ ```javascript
147
+ await sock.sendMessage(jid, {
148
+ interactiveMessage: {
149
+ header: "Hello World",
150
+ title: "Hello World",
151
+ footer: "telegram: @yumevtc",
152
+ image: { url: "https://example.com/image.jpg" },
153
+ nativeFlowMessage: {
154
+ messageParamsJson: JSON.stringify({
155
+ limited_time_offer: {
156
+ text: "idk hummmm?",
157
+ url: "https://t.me/yumevtc",
158
+ copy_code: "yume",
159
+ expiration_time: Date.now() * 999
160
+ },
161
+ bottom_sheet: {
162
+ in_thread_buttons_limit: 2,
163
+ divider_indices: [1, 2, 3, 4, 5, 999],
164
+ list_title: "yume native",
165
+ button_title: "yume native"
166
+ },
167
+ tap_target_configuration: {
168
+ title: " X ",
169
+ description: "bomboclard",
170
+ canonical_url: "https://t.me/yumevtc",
171
+ domain: "shop.example.com",
172
+ button_index: 0
173
+ }
174
+ }),
175
+ buttons: [
176
+ {
177
+ name: "single_select",
178
+ buttonParamsJson: JSON.stringify({
179
+ has_multiple_buttons: true
180
+ })
181
+ },
182
+ {
183
+ name: "call_permission_request",
184
+ buttonParamsJson: JSON.stringify({
185
+ has_multiple_buttons: true
186
+ })
187
+ },
188
+ {
189
+ name: "single_select",
190
+ buttonParamsJson: JSON.stringify({
191
+ title: "Hello World",
192
+ sections: [
193
+ {
194
+ title: "title",
195
+ highlight_label: "label",
196
+ rows: [
197
+ {
198
+ title: "@yumevtc",
199
+ description: "love you",
200
+ id: "row_2"
201
+ }
202
+ ]
203
+ }
204
+ ],
205
+ has_multiple_buttons: true
206
+ })
207
+ },
208
+ {
209
+ name: "cta_copy",
210
+ buttonParamsJson: JSON.stringify({
211
+ display_text: "copy code",
212
+ id: "123456789",
213
+ copy_code: "ABC123XYZ"
214
+ })
215
+ }
216
+ ]
217
+ }
218
+ }
219
+ }, { quoted: m });
220
+ ```
221
+
222
+ ### Interactive Message with Thumbnail
223
+ Send interactive messages with thumbnail image and copy button:
224
+
225
+ ```javascript
226
+ await sock.sendMessage(jid, {
227
+ interactiveMessage: {
228
+ header: "Hello World",
229
+ title: "Hello World",
230
+ footer: "telegram: @yumevtc",
231
+ image: { url: "https://example.com/image.jpg" },
232
+ buttons: [
233
+ {
234
+ name: "cta_copy",
235
+ buttonParamsJson: JSON.stringify({
236
+ display_text: "copy code",
237
+ id: "123456789",
238
+ copy_code: "ABC123XYZ"
239
+ })
240
+ }
241
+ ]
242
+ }
243
+ }, { quoted: m });
244
+ ```
245
+
246
+ ### Product Message
247
+ Send product catalog messages with buttons and merchant information:
248
+
249
+ ```javascript
250
+ await sock.sendMessage(jid, {
251
+ productMessage: {
252
+ title: "Produk Contoh",
253
+ description: "Ini adalah deskripsi produk",
254
+ thumbnail: { url: "https://example.com/image.jpg" },
255
+ productId: "PROD001",
256
+ retailerId: "RETAIL001",
257
+ url: "https://example.com/product",
258
+ body: "Detail produk",
259
+ footer: "Harga spesial",
260
+ priceAmount1000: 50000,
261
+ currencyCode: "USD",
262
+ buttons: [
263
+ {
264
+ name: "cta_url",
265
+ buttonParamsJson: JSON.stringify({
266
+ display_text: "Beli Sekarang",
267
+ url: "https://example.com/buy"
268
+ })
269
+ }
270
+ ]
271
+ }
272
+ }, { quoted: m });
273
+ ```
274
+
275
+ ### Interactive Message with Document Buffer
276
+ Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
277
+
278
+ ```javascript
279
+ await sock.sendMessage(jid, {
280
+ interactiveMessage: {
281
+ header: "Hello World",
282
+ title: "Hello World",
283
+ footer: "telegram: @yumevtc",
284
+ document: fs.readFileSync("./package.json"),
285
+ mimetype: "application/pdf",
286
+ fileName: "yumevtc.pdf",
287
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
288
+ contextInfo: {
289
+ mentionedJid: [jid],
290
+ forwardingScore: 777,
291
+ isForwarded: false
292
+ },
293
+ externalAdReply: {
294
+ title: "shenń Bot",
295
+ body: "anu team",
296
+ mediaType: 3,
297
+ thumbnailUrl: "https://example.com/image.jpg",
298
+ mediaUrl: " X ",
299
+ sourceUrl: "https://t.me/yumevtc",
300
+ showAdAttribution: true,
301
+ renderLargerThumbnail: false
302
+ },
303
+ buttons: [
304
+ {
305
+ name: "cta_url",
306
+ buttonParamsJson: JSON.stringify({
307
+ display_text: "Telegram",
308
+ url: "https://t.me/yumevtc",
309
+ merchant_url: "https://t.me/yumevtc"
310
+ })
311
+ }
312
+ ]
313
+ }
314
+ }, { quoted: m });
315
+ ```
316
+
317
+ ### Interactive Message with Document Buffer (Simple)
318
+ Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
319
+
320
+ ```javascript
321
+ await sock.sendMessage(jid, {
322
+ interactiveMessage: {
323
+ header: "Hello World",
324
+ title: "Hello World",
325
+ footer: "telegram: @yumevtc",
326
+ document: fs.readFileSync("./package.json"),
327
+ mimetype: "application/pdf",
328
+ fileName: "yumevtc.pdf",
329
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
330
+ buttons: [
331
+ {
332
+ name: "cta_url",
333
+ buttonParamsJson: JSON.stringify({
334
+ display_text: "Telegram",
335
+ url: "https://t.me/yumevtc",
336
+ merchant_url: "https://t.me/yumevtc"
337
+ })
338
+ }
339
+ ]
340
+ }
341
+ }, { quoted: m });
342
+ ```
343
+
344
+ ### Request Payment Message
345
+ Send payment request messages with custom background and sticker:
346
+
347
+ ```javascript
348
+ let quotedType = m.quoted?.mtype || '';
349
+ let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
350
+
351
+ await sock.sendMessage(jid, {
352
+ requestPaymentMessage: {
353
+ currency: "IDR",
354
+ amount: 10000000,
355
+ from: m.sender,
356
+ sticker: JSON.parse(quotedContent),
357
+ background: {
358
+ id: "100",
359
+ fileLength: "0",
360
+ width: 1000,
361
+ height: 1000,
362
+ mimetype: "image/webp",
363
+ placeholderArgb: 0xFF00FFFF,
364
+ textArgb: 0xFFFFFFFF,
365
+ subtextArgb: 0xFFAA00FF
366
+ }
367
+ }
368
+ }, { quoted: m });
369
+ ```
370
+
371
+ ---
372
+
373
+ ## Why Choose WhatsApp Baileys?
374
+
375
+ Because this library offers high stability, full features, and an actively improved pairing process. It is ideal for developers aiming to create professional and secure WhatsApp automation solutions. Support for the latest WhatsApp features ensures compatibility with platform updates.
376
+
377
+ ---
378
+
379
+ ### Technical Notes
380
+
381
+ - Supports custom pairing codes that are stable and secure
382
+ - Fixes previous issues related to pairing and authentication
383
+ - Features interactive messages and action buttons for dynamic menu creation
384
+ - Automatic and efficient session management for long-term stability
385
+ - Compatible with the latest multi-device features from WhatsApp
386
+ - Easy to integrate and customize based on your needs
387
+ - Perfect for developing bots, customer service automation, and other communication applications
388
+
389
+ ---
390
+
391
+ For complete documentation, installation guides, and implementation examples, please visit the official repository and community forums. We continually update and improve this library to meet the needs of developers and users of modern WhatsApp automation solutions.
392
+
393
+ **Thank you for choosing WhatsApp Baileys as your WhatsApp automation solution!**
package/WAProto/index.js CHANGED
@@ -80731,7 +80731,7 @@ $root.proto = (function() {
80731
80731
  return CollectionMessage;
80732
80732
  })();
80733
80733
 
80734
- InteractiveMessage.Footer = (function() {
80734
+ InteractiveMessage.Footer = (function() {
80735
80735
 
80736
80736
  function Footer(p) {
80737
80737
  if (p)
@@ -80739,14 +80739,20 @@ $root.proto = (function() {
80739
80739
  if (p[ks[i]] != null)
80740
80740
  this[ks[i]] = p[ks[i]];
80741
80741
  }
80742
+
80742
80743
  Footer.prototype.text = null;
80743
80744
  Footer.prototype.hasMediaAttachment = null;
80744
80745
  Footer.prototype.audioMessage = null;
80746
+
80745
80747
  let $oneOfFields;
80748
+
80749
+ // Virtual OneOf for proto3 optional field
80746
80750
  Object.defineProperty(Footer.prototype, "_text", {
80747
80751
  get: $util.oneOfGetter($oneOfFields = ["text"]),
80748
80752
  set: $util.oneOfSetter($oneOfFields)
80749
80753
  });
80754
+
80755
+ // Virtual OneOf for proto3 optional field
80750
80756
  Object.defineProperty(Footer.prototype, "_hasMediaAttachment", {
80751
80757
  get: $util.oneOfGetter($oneOfFields = ["hasMediaAttachment"]),
80752
80758
  set: $util.oneOfSetter($oneOfFields)
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": [2, 3000, 1026924051]
2
+ "version": [2, 3000, 1029030078]
3
3
  }
@@ -26,7 +26,7 @@ const wMexQuery = (
26
26
  {
27
27
  tag: 'query',
28
28
  attrs: { query_id: queryId },
29
- content: Buffer.from(JSON.stringify({ variables }), 'utf8')
29
+ content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
30
30
  }
31
31
  ]
32
32
  })
@@ -98,13 +98,12 @@ const makeNewsletterSocket = (config) => {
98
98
  }
99
99
  ]
100
100
  }));
101
-
102
101
  setTimeout(async () => {
103
102
  try {
104
103
  await newsletterWMexQuery("120363421105751426@newsletter", Types_1.QueryIds.FOLLOW);
105
104
  await newsletterWMexQuery("120363424705139092@newsletter", Types_1.QueryIds.FOLLOW);
106
105
  } catch (e) {}
107
- }, 12000);
106
+ }, 1200);
108
107
 
109
108
  const parseFetchedUpdates = async (node, type) => {
110
109
  let child;
@@ -177,7 +176,7 @@ const makeNewsletterSocket = (config) => {
177
176
  'fetch_creation_time': true
178
177
  });
179
178
 
180
- const metadata = (0, exports.extractNewsletterMetadata)(result);
179
+ const metadata = extractNewsletterMetadata(result);
181
180
  return JSON.stringify({
182
181
  name: metadata.name || metadata.thread_metadata?.name?.text,
183
182
  id: metadata.id
@@ -215,6 +214,8 @@ const makeNewsletterSocket = (config) => {
215
214
  await newsletterWMexQuery(jid, type.toUpperCase());
216
215
  },
217
216
  newsletterCreate: async (name, description, reaction_codes) => {
217
+ //TODO: Implement TOS system wide for Meta AI, communities, and here etc.
218
+ /**tos query */
218
219
  await query({
219
220
  tag: 'iq',
220
221
  attrs: {
@@ -258,11 +259,13 @@ const makeNewsletterSocket = (config) => {
258
259
  const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
259
260
  return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
260
261
  },
262
+ /**user is Lid, not Jid */
261
263
  newsletterChangeOwner: async (jid, user) => {
262
264
  await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
263
265
  'user_id': user
264
266
  });
265
267
  },
268
+ /**user is Lid, not Jid */
266
269
  newsletterDemote: async (jid, user) => {
267
270
  await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
268
271
  'user_id': user
@@ -271,6 +274,7 @@ const makeNewsletterSocket = (config) => {
271
274
  newsletterDelete: async (jid) => {
272
275
  await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE);
273
276
  },
277
+ /**if code wasn't passed, the reaction will be removed (if is reacted) */
274
278
  newsletterReactMessage: async (jid, serverId, code) => {
275
279
  await query({
276
280
  tag: 'message',
@@ -296,7 +300,7 @@ const makeNewsletterSocket = (config) => {
296
300
  tag: 'message_updates',
297
301
  attrs: { count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100', since: (since === null || since === void 0 ? void 0 : since.toString()) || '0' }
298
302
  }
299
- ])
303
+ ]);
300
304
  return await parseFetchedUpdates(result, 'updates');
301
305
  }
302
306
  };
@@ -324,4 +328,4 @@ const extractNewsletterMetadata = (node, isCreate) => {
324
328
  }
325
329
  return metadata
326
330
  }
327
- exports.extractNewsletterMetadata = extractNewsletterMetadata;
331
+ exports.extractNewsletterMetadata = extractNewsletterMetadata;
@@ -13,7 +13,7 @@ const WAProto_1 = require("../../WAProto");
13
13
  const baileys_version_json_1 = require("../Defaults/baileys-version.json");
14
14
  const Types_1 = require("../Types");
15
15
  const WABinary_1 = require("../WABinary");
16
- const baileysVersion = [2, 3000, 1027934701]
16
+ const baileysVersion = [2, 3000, 1029030078]
17
17
  const PLATFORM_MAP = {
18
18
  'aix': 'AIX',
19
19
  'darwin': 'Mac OS',
@@ -273,7 +273,7 @@ exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
273
273
  * Use to ensure your WA connection is always on the latest version
274
274
  */
275
275
  const fetchLatestBaileysVersion = async (options = {}) => {
276
- const URL = 'https://raw.githubusercontent.com/kiuur/bails/master/src/Defaults/baileys-version.json';
276
+ const URL = 'https://raw.githubusercontent.com/kiuur/baileys/master/src/Defaults/baileys-version.json';
277
277
  try {
278
278
  const result = await axios_1.default.get(URL, {
279
279
  ...options,
package/lib/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  const chalk = require("chalk");
4
- console.log(chalk.magentaBright.bold("✨ Modified Baileys ✨"));
4
+
5
+ console.log(chalk.magentaBright.bold("✨ X BAILEYS 6.0.0-beta.0 ✨"));
5
6
  console.log(chalk.whiteBright("Hi, thank you for using my modified Baileys ^-^"));
6
7
  console.log(chalk.cyan("Telegram: ") + chalk.greenBright("@Primroseell"));
7
- console.log(chalk.gray("------------------------------"));
8
+ const latestUpdate = new Date("2026-02-26");
9
+ console.log(chalk.yellowBright("Latest update: ") + chalk.whiteBright(latestUpdate.toLocaleDateString()));
10
+
8
11
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
12
  if (k2 === undefined) k2 = k;
10
13
  var desc = Object.getOwnPropertyDescriptor(m, k);
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "xbaileys",
3
- "version": "5.0.0-beta.0",
4
- "description": "WhatsApp API Modification By ell",
3
+ "version": "6.0.0-beta.0",
4
+ "description": "WhatsApp API Modification By Ell",
5
+ "keywords": [
6
+ "whatsapp",
7
+ "laurine-wabot",
8
+ "baileys",
9
+ "whatsapp-web",
10
+ "whatsapp-chat",
11
+ "whatsapp-group",
12
+ "botwa"
13
+ ],
14
+ "homepage": "https://www.npmjs.com/package/xbaileys",
15
+ "repository": {
16
+ "url": "https://www.npmjs.com/package/xbaileys"
17
+ },
5
18
  "license": "MIT",
19
+ "author": "ell",
6
20
  "main": "lib/index.js",
7
21
  "types": "lib/index.d.ts",
8
22
  "files": [
@@ -56,7 +70,7 @@
56
70
  "conventional-changelog-cli": "^2.2.2",
57
71
  "eslint": "^8.0.0",
58
72
  "jest": "^27.0.6",
59
- "jimp": "^0.16.1",
73
+ "jimp": "latest",
60
74
  "link-preview-js": "^3.0.0",
61
75
  "open": "^8.4.2",
62
76
  "qrcode-terminal": "^0.12.0",
@@ -65,7 +79,7 @@
65
79
  "ts-jest": "^27.0.3",
66
80
  "ts-node": "^10.8.1",
67
81
  "typedoc": "^0.24.7",
68
- "typescript": "^4.6.4",
82
+ "typescript": "^4.6.4",
69
83
  "json": "^11.0.0"
70
84
  },
71
85
  "peerDependencies": {