@vinzsocket/baileys 3.2.14 → 3.3.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 CHANGED
@@ -5,7 +5,7 @@
5
5
  **Fork WebSocket library WhatsApp Web Multi-Device — dasar dari ekosistem bot Harps-MD**
6
6
 
7
7
  [![GitHub](https://img.shields.io/badge/GitHub-VinzSocket/Baileys-blue?style=for-the-badge&logo=github)](https://github.com/VinzSocket/Baileys)
8
- ![Version](https://img.shields.io/badge/version-3.2.14-blue)
8
+ ![Version](https://img.shields.io/badge/version-3.3.0-blue)
9
9
  ![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-green)
10
10
  ![License](https://img.shields.io/badge/license-MIT-lightgrey)
11
11
  ![Type](https://img.shields.io/badge/type-ESM-yellow)
@@ -1218,7 +1218,7 @@ await conn.sendMessage(groupJid, {
1218
1218
  })
1219
1219
  ```
1220
1220
 
1221
- > ⚠️ **Penting:** sejak v3.2.14, setiap mode `handleGroupStory()` **wajib** menyertakan `additionalNodes` (node `<meta is_vsn2="1">`) di panggilan `relayMessage()`-nya. Tanpa ini, pesan tetap terkirim & ter-enkripsi normal (tidak ada error), tapi klien penerima tidak tahu payload tersebut harus dirender sebagai story grup — sehingga tidak pernah muncul sebagai ring status untuk anggota lain. Detail lengkap bug ini ada di [Changelog v3.2.14](#-changelog-ringkas). Jika Anda memakai versi ≥ 3.2.14, ini sudah otomatis tertangani.
1221
+ > ⚠️ **Penting:** sejak v3.3.0, setiap mode `handleGroupStory()` **wajib** menyertakan `additionalNodes` (node `<meta is_vsn2="1">`) di panggilan `relayMessage()`-nya. Tanpa ini, pesan tetap terkirim & ter-enkripsi normal (tidak ada error), tapi klien penerima tidak tahu payload tersebut harus dirender sebagai story grup — sehingga tidak pernah muncul sebagai ring status untuk anggota lain. Detail lengkap bug ini ada di [Changelog v3.3.0](#-changelog-ringkas). Jika Anda memakai versi ≥ 3.3.0, ini sudah otomatis tertangani.
1222
1222
 
1223
1223
  ### Story Card Generator (`renderStoryCard`)
1224
1224
 
@@ -2318,7 +2318,7 @@ Jika handler lama Anda memiliki logic khusus untuk mem-parsing `buttonsResponseM
2318
2318
 
2319
2319
  ### Q: Bot terkoneksi tapi tombol/list yang saya kirim tidak muncul di HP penerima?
2320
2320
 
2321
- **A:** Ini hampir selalu soal `additionalNodes` binary hint yang hilang. Jika Anda memakai `sock.sendMessage()` biasa, ini seharusnya sudah otomatis. Jika Anda memakai `relayMessage()` secara manual, pastikan menyertakan `buildInteractiveAdditionalNodes(jid, message)` — lihat bagian [`buildInteractiveAdditionalNodes`](#buildinteractiveadditionalnodes--kenapa-wajib-ada). Pastikan juga Anda sedang menjalankan versi ≥ 3.2.14 untuk `groupStatusMessage`, karena bug ini pernah terjadi khusus untuk Group Status V2 sebelum versi tersebut.
2321
+ **A:** Ini hampir selalu soal `additionalNodes` binary hint yang hilang. Jika Anda memakai `sock.sendMessage()` biasa, ini seharusnya sudah otomatis. Jika Anda memakai `relayMessage()` secara manual, pastikan menyertakan `buildInteractiveAdditionalNodes(jid, message)` — lihat bagian [`buildInteractiveAdditionalNodes`](#buildinteractiveadditionalnodes--kenapa-wajib-ada). Pastikan juga Anda sedang menjalankan versi ≥ 3.3.0 untuk `groupStatusMessage`, karena bug ini pernah terjadi khusus untuk Group Status V2 sebelum versi tersebut.
2322
2322
 
2323
2323
  ### Q: Error `ERR_REQUIRE_ESM` saat `require('@vinzsocket/baileys')`?
2324
2324
 
@@ -2348,7 +2348,7 @@ Modul ini sengaja **lazy-imported** (tidak jadi hard dependency) supaya konsumen
2348
2348
 
2349
2349
  ### Q: Apakah Harps-Baileys mendukung WhatsApp Flow (form registrasi multi-field native)?
2350
2350
 
2351
- **A:** Dukungan native multi-field Flow form (`flow_json` dengan banyak field terstruktur, validasi server-side, dsb — fitur "WhatsApp Flows" penuh) **belum diverifikasi tersedia** secara native di fork ini pada versi 3.2.14. Alternatif yang bisa dipakai sekarang adalah **form terpandu bertahap** (guided step-by-step): kirim serangkaian pertanyaan satu per satu memakai `interactiveMessage` biasa (teks/tombol/list) dan simpan progres jawaban di state percakapan bot Anda sendiri, alih-alih mengandalkan satu payload Flow form native. Jika kebutuhan Anda spesifik untuk Flow form penuh, pantau `CHANGELOG.md` untuk update fitur ini di rilis mendatang.
2351
+ **A:** Dukungan native multi-field Flow form (`flow_json` dengan banyak field terstruktur, validasi server-side, dsb — fitur "WhatsApp Flows" penuh) **belum diverifikasi tersedia** secara native di fork ini pada versi 3.3.0. Alternatif yang bisa dipakai sekarang adalah **form terpandu bertahap** (guided step-by-step): kirim serangkaian pertanyaan satu per satu memakai `interactiveMessage` biasa (teks/tombol/list) dan simpan progres jawaban di state percakapan bot Anda sendiri, alih-alih mengandalkan satu payload Flow form native. Jika kebutuhan Anda spesifik untuk Flow form penuh, pantau `CHANGELOG.md` untuk update fitur ini di rilis mendatang.
2352
2352
 
2353
2353
  ### Q: Pesan text saya yang mengandung URL tidak menampilkan link preview?
2354
2354
 
@@ -2870,7 +2870,7 @@ done
2870
2870
 
2871
2871
  Riwayat perubahan lengkap ada di [`CHANGELOG.md`](./CHANGELOG.md). Ringkasan rilis terbaru:
2872
2872
 
2873
- ### v3.2.14 (2026-07-06) — Bug Fix Kritis Group Status
2873
+ ### v3.3.0 (2026-07-06) — Bug Fix Kritis Group Status
2874
2874
 
2875
2875
  **Masalah:** status/story grup (`groupStatusMessage`) tidak pernah muncul sebagai ring status untuk anggota lain, walaupun `relayMessage()` berhasil tanpa error sama sekali.
2876
2876
 
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
2
2
  import { makeLibSignalRepository } from '../Signal/libsignal.js';
3
3
  import { Browsers } from '../Utils/browser-utils.js';
4
4
  import logger from '../Utils/logger.js';
5
- const version = [2, 3000, 1035194821];
5
+ const version = [2, 3000, 1043857760];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
8
8
  export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -11,6 +11,13 @@ import { buildTcTokenFromJid } from '../Utils/tc-token-utils.js';
11
11
  import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
12
12
  import { USyncQuery, USyncUser } from '../WAUSync/index.js';
13
13
  import { makeSocket } from './socket.js';
14
+ export const buildProfilePictureQueryContent = (type, tcTokenContent) => {
15
+ const picture = { tag: 'picture', attrs: { type, query: 'url' } };
16
+ if (tcTokenContent?.length) {
17
+ picture.content = tcTokenContent;
18
+ }
19
+ return [picture];
20
+ };
14
21
  export const makeChatsSocket = (config) => {
15
22
  const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, getMessage } = config;
16
23
  const sock = makeSocket(config);
@@ -546,7 +553,6 @@ export const makeChatsSocket = (config) => {
546
553
  * type = "image for the high res picture"
547
554
  */
548
555
  const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
549
- const baseContent = [{ tag: 'picture', attrs: { type, query: 'url' } }];
550
556
  // WA Web only includes tctoken for user JIDs (not groups/newsletters)
551
557
  // and never for own profile pic (Chat model for self has no tcToken).
552
558
  // Including tctoken for own JID causes the server to never respond.
@@ -554,12 +560,11 @@ export const makeChatsSocket = (config) => {
554
560
  const isUserJid = isPnUser(normalizedJid) || isLidUser(normalizedJid);
555
561
  const me = authState.creds.me;
556
562
  const isSelf = me && (normalizedJid === jidNormalizedUser(me.id) || (me.lid && normalizedJid === jidNormalizedUser(me.lid)));
557
- let content = baseContent;
563
+ let tcTokenContent;
558
564
  if (serverProps.profilePicPrivacyToken && isUserJid && !isSelf) {
559
- content = await buildTcTokenFromJid({
565
+ tcTokenContent = await buildTcTokenFromJid({
560
566
  authState,
561
567
  jid: normalizedJid,
562
- baseContent,
563
568
  getLIDForPN
564
569
  });
565
570
  }
@@ -572,7 +577,7 @@ export const makeChatsSocket = (config) => {
572
577
  type: 'get',
573
578
  xmlns: 'w:profile:picture'
574
579
  },
575
- content
580
+ content: buildProfilePictureQueryContent(type, tcTokenContent)
576
581
  }, timeoutMs);
577
582
  const child = getBinaryNodeChild(result, 'picture');
578
583
  return child?.attrs?.url;
@@ -305,7 +305,7 @@ export declare class ExtendedMessageBuilder {
305
305
 
306
306
  handlePollResult(content: { pollResultMessage: PollResultMessage }, jid: string, quoted?: proto.IWebMessageInfo | null): Promise<any>;
307
307
 
308
- handleGroupStory(content: { groupStatusMessage: GroupStatusMessage }, jid: string): Promise<any>;
308
+ handleGroupStory(content: { groupStatusMessage: GroupStatusMessage }, jid: string, quoted?: proto.IWebMessageInfo | null): Promise<any>;
309
309
 
310
310
  /**
311
311
  * Kirim WhatsApp Status (story) sungguhan ke `status@broadcast`, mendukung
@@ -348,7 +348,7 @@ export class ExtendedMessageBuilder {
348
348
  * dirender sebagai story/status grup — pesan tetap terkirim & ter-enkripsi
349
349
  * normal, tapi tidak pernah muncul sebagai ring status untuk member lain.
350
350
  */
351
- async handleGroupStory(content, jid) {
351
+ async handleGroupStory(content, jid, quoted) {
352
352
  const s = content.groupStatusMessage;
353
353
  const secret = randomBytes(32);
354
354
  const buildNodes = this.utils.buildInteractiveAdditionalNodes;
@@ -385,8 +385,21 @@ export class ExtendedMessageBuilder {
385
385
 
386
386
  // Mode 3: generate dari media/teks
387
387
  let innerMessage = {};
388
- const mentionCtx = (Array.isArray(s.mentions) && s.mentions.length)
389
- ? { contextInfo: { mentionedJid: s.mentions } }
388
+ // PATCH: normalize mentions (terima nomor polos, bukan cuma JID lengkap — biar konsisten
389
+ // sama handleInteractive) dan sisipkan quoted-reply (stanzaId/participant/quotedMessage).
390
+ // Sebelumnya dua-duanya "keisi" secara visual tapi diam-diam gak ke-apply: s.mentions gak
391
+ // pernah dilewatin ke normalizeMentions(), dan param quoted malah belum ada sama sekali di
392
+ // signature function ini padahal messages-send.js (swgc & case 'GROUP_STORY') udah ngoper dia.
393
+ const normalizedMentions = normalizeMentions(s.mentions);
394
+ const quoteCtx = quoted?.key
395
+ ? {
396
+ stanzaId: quoted.key.id,
397
+ participant: quoted.key.participant || quoted.key.remoteJid,
398
+ quotedMessage: quoted.message
399
+ }
400
+ : {};
401
+ const mentionCtx = (normalizedMentions.length || Object.keys(quoteCtx).length)
402
+ ? { contextInfo: { ...quoteCtx, ...(normalizedMentions.length ? { mentionedJid: normalizedMentions } : {}) } }
390
403
  : {};
391
404
 
392
405
  if (s.text || (!s.image && !s.video && !s.gif && !s.audio && !s.sticker && !s.document)) {
@@ -27,6 +27,9 @@ export const makeSocket = (config) => {
27
27
  if (printQRInTerminal) {
28
28
  logger.warn({}, '⚠️ The printQRInTerminal option has been deprecated. You will no longer receive QR codes in the terminal automatically. Please listen to the connection.update event yourself and handle the QR your way. You can remove this message by removing this opttion. This message will be removed in a future version.');
29
29
  }
30
+ if (browser[1].toLocaleLowerCase().includes('android')) {
31
+ logger.warn('⚠️ Using the Android browser is experimental and may lead to unexpected behavior. Use at your own risk.');
32
+ }
30
33
  const syncDisabled = PROCESSABLE_HISTORY_TYPES.map(syncType => config.shouldSyncHistoryMessage({ syncType })).filter(x => x === false)
31
34
  .length === PROCESSABLE_HISTORY_TYPES.length;
32
35
  if (syncDisabled) {
@@ -20,6 +20,7 @@ export type BrowsersMap = {
20
20
  macOS(browser: string): [string, string, string];
21
21
  baileys(browser: string): [string, string, string];
22
22
  windows(browser: string): [string, string, string];
23
+ android(browser: string): [string, string, string];
23
24
  appropriate(browser: string): [string, string, string];
24
25
  };
25
26
  export declare enum DisconnectReason {
@@ -18,6 +18,7 @@ export const Browsers = {
18
18
  macOS: browser => ['Mac OS', browser, '14.4.1'],
19
19
  baileys: browser => ['Baileys', browser, '6.5.0'],
20
20
  windows: browser => ['Windows', browser, '10.0.22631'],
21
+ android: browser => [browser, 'Android', ''],
21
22
  /** The appropriate browser based on your OS & release */
22
23
  appropriate: browser => [PLATFORM_MAP[platform()] || 'Ubuntu', browser, release()]
23
24
  };
@@ -1,7 +1,7 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { createHash, randomBytes } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
- const baileysVersion = [2, 3000, 1035194821];
4
+ const baileysVersion = [2, 3000, 1043857760];
5
5
  import { DisconnectReason } from '../Types/index.js';
6
6
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
7
  import { sha256 } from './crypto.js';
@@ -102,7 +102,8 @@ export async function buildTcTokenFromJid({ authState, jid, baseContent = [], ge
102
102
  const tcTokenData = await authState.keys.get('tctoken', [storageJid]);
103
103
  const entry = tcTokenData?.[storageJid];
104
104
  const tcTokenBuffer = entry?.token;
105
- if (!tcTokenBuffer?.length || isTcTokenExpired(entry?.timestamp)) {
105
+ const timestamp = entry?.timestamp;
106
+ if (!tcTokenBuffer?.length || timestamp === undefined || isTcTokenExpired(timestamp)) {
106
107
  if (tcTokenBuffer) {
107
108
  // Preserve senderTimestamp so shouldSendNewTcToken() keeps its dedupe state
108
109
  // after we drop the unusable peer token. Only wipe the record entirely when
@@ -116,7 +117,7 @@ export async function buildTcTokenFromJid({ authState, jid, baseContent = [], ge
116
117
  }
117
118
  baseContent.push({
118
119
  tag: 'tctoken',
119
- attrs: {},
120
+ attrs: { t: String(timestamp) },
120
121
  content: tcTokenBuffer
121
122
  });
122
123
  return baseContent;
@@ -13,7 +13,9 @@ const getUserAgent = (config) => {
13
13
  secondary: config.version[1],
14
14
  tertiary: config.version[2]
15
15
  },
16
- platform: proto.ClientPayload.UserAgent.Platform.WEB,
16
+ platform: config.browser[1].toLocaleLowerCase().includes('android')
17
+ ? proto.ClientPayload.UserAgent.Platform.ANDROID
18
+ : proto.ClientPayload.UserAgent.Platform.WEB,
17
19
  releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
18
20
  osVersion: '0.1',
19
21
  device: 'Desktop',
@@ -43,7 +45,9 @@ const getClientPayload = (config) => {
43
45
  connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
44
46
  userAgent: getUserAgent(config)
45
47
  };
46
- payload.webInfo = getWebInfo(config);
48
+ if (!config.browser[1].toLocaleLowerCase().includes('android')) {
49
+ payload.webInfo = getWebInfo(config);
50
+ }
47
51
  if (config.pushName) {
48
52
  payload.pushName = config.pushName;
49
53
  }
@@ -64,6 +68,9 @@ export const generateLoginNode = (userJid, config) => {
64
68
  };
65
69
  const getPlatformType = (platform) => {
66
70
  const platformType = platform.toUpperCase();
71
+ if (platformType === 'ANDROID') {
72
+ return proto.DeviceProps.PlatformType.ANDROID_PHONE;
73
+ }
67
74
  return (proto.DeviceProps.PlatformType[platformType] ||
68
75
  proto.DeviceProps.PlatformType.CHROME);
69
76
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinzsocket/baileys",
3
3
  "type": "module",
4
- "version": "3.2.14",
4
+ "version": "3.3.0",
5
5
  "description": "A WebSockets library for interacting with WhatsApp Web",
6
6
  "keywords": [
7
7
  "whatsapp",