@qadeer-xtech/stablebail 1.0.4 → 1.0.5

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
@@ -1,111 +1,321 @@
1
- # @qadeer-xtech/stablebail
1
+ @qadeer-xtech/stablebail
2
2
 
3
- WhatsApp Web API library — Team Qadeer ki apni copy, official Baileys 7.0.0-rc14 par mabni, channels (newsletter) ke fixes ke sath.
3
+ <p align="center">
4
+ **STABLEBAIL — POWERED BY TEAM QADEER**
5
+ </p>
4
6
 
5
- ## Install
7
+ A powerful WhatsApp Web API library built on the Baileys architecture, enhanced with custom fixes, improved media handling, advanced newsletter support, and additional WhatsApp features.
6
8
 
7
- ```
9
+ Designed for developers who need a familiar Baileys-compatible API with extra functionality and a smoother development experience.
10
+
11
+ ## 📦 Installation
12
+
13
+ ```bash
8
14
  npm install @qadeer-xtech/stablebail
9
15
  ```
10
16
 
11
- Bot ke `package.json` mein official naam ke tor par:
17
+ ## Use as Official Baileys Replacement
18
+
19
+ To use StableBail without changing your existing import paths, add this alias to your "package.json":
12
20
 
13
21
  ```json
14
- "@whiskeysockets/baileys": "npm:@qadeer-xtech/stablebail@latest"
22
+ {
23
+ "dependencies": {
24
+ "@whiskeysockets/baileys": "npm:@qadeer-xtech/stablebail@latest"
25
+ }
26
+ }
27
+ ```
28
+
29
+ This allows existing Baileys-based projects to use StableBail while keeping their original package imports.
30
+
31
+ ## ✨ Key Features
32
+
33
+ - Baileys-Compatible API — Familiar socket methods and existing Baileys workflow.
34
+ - Newsletter Enhancements — Improved channel messaging, media uploads, subscriptions, and metadata fetching.
35
+ - Media Stream Fixes — Improved download error handling, media retries, and expired-link recovery.
36
+ - Windows Hybrid Support — Updated device identification for modern WhatsApp connections.
37
+ - LID Compatibility — Improved "onWhatsApp()" support for LID-based addresses.
38
+ - Status Mentions — Mention contacts and groups in WhatsApp status updates.
39
+ - CSToken / NCT Support — Additional token handling for LID-addressed messaging.
40
+ - Connection Banner — Optional branded startup banner.
41
+ - Improved Stability — Additional fixes for connection handling and media operations.
42
+
43
+ ## 🔧 What's Included
44
+
45
+ ### 1. Newsletter / Channel Support
46
+
47
+ Extended newsletter functionality with improved message fetching, media handling, and channel metadata support.
48
+
49
+ Available methods:
50
+
51
+ | Method | Description |
52
+ | --- | --- |
53
+ | "newsletterFromUrl()" | Fetch channel information from an invite link |
54
+ | "newsletterSubscribed()" | Get subscribed channels |
55
+ | "newsletterFetchAllSubscribe()" | Fetch all subscribed channels |
56
+ | "newsletterFetchMessages()" | Retrieve channel messages |
57
+ | "newsletterFetchUpdates()" | Fetch views and reactions |
58
+ | "newsletterReactionMode()" | Change channel reaction settings |
59
+ | "newsletterFollow()" | Follow a channel |
60
+ | "newsletterUnfollow()" | Unfollow a channel |
61
+ | "newsletterReactMessage()" | React to channel messages |
62
+
63
+ Additional improvements:
64
+
65
+ - Dedicated newsletter media upload handling.
66
+ - Improved channel message decoding.
67
+ - Better thumbnail handling.
68
+ - Protection against missing channel profile pictures.
69
+ - Support for legacy message-fetching arguments.
70
+
71
+ ### 2. Media Streaming Improvements
72
+
73
+ Enhanced media download and retry handling.
74
+
75
+ - Proper stream error propagation.
76
+ - Prevents downloads from remaining stuck after stream failures.
77
+ - Improved recovery for expired media links.
78
+ - Handles CDN "403", "404", and "410" responses.
79
+ - Improved phone-based media reupload handling.
80
+ - Automatically converts Base64 media keys into usable byte data when required.
81
+
82
+ ### 3. Connection & Device Compatibility
83
+
84
+ - Updated Windows device identification using "WIN_HYBRID".
85
+ - Updated default WhatsApp Web version configuration.
86
+ - Improved LID address handling in "onWhatsApp()".
87
+ - Returns LID information alongside standard WhatsApp lookup results when available.
88
+
89
+ Example response:
90
+
91
+ ```js
92
+ {
93
+ jid,
94
+ exists,
95
+ lid
96
+ }
97
+ ```
98
+
99
+ ### 4. Status Mentions
100
+
101
+ StableBail includes "sendStatusMention()" for mentioning contacts or groups in WhatsApp status updates.
102
+
103
+ Mention individual contacts:
104
+
105
+ ```js
106
+ await sock.sendStatusMention(
107
+ [
108
+ '923001234567@s.whatsapp.net',
109
+ '923009876543@s.whatsapp.net'
110
+ ],
111
+ {
112
+ text: 'Eid Mubarak! 🌙'
113
+ }
114
+ )
15
115
  ```
16
116
 
17
- ## 1.0.2 mein kya fix hai (Channels / Newsletter)
117
+ Mention a group:
18
118
 
19
- Official rc14 mein channel ke ye hisse adhoore ya toote hue thay — 1.0.2 mein theek hain:
119
+ ```js
120
+ await sock.sendStatusMention(
121
+ ['120363000000000000@g.us'],
122
+ {
123
+ image: {
124
+ url: 'https://example.com/pic.jpg'
125
+ },
126
+ caption: 'Team Qadeer'
127
+ },
128
+ {
129
+ delayMs: 1500
130
+ }
131
+ )
132
+ ```
20
133
 
21
- - **Channel messages parhna** — `newsletterFetchMessages` ab WA Web wale asal tareeqe se kaam karta hai aur messages ko decode karke saaf list deta hai (pehle khaali khaam jawab aata tha)
22
- - **Channel par media bhejna** — newsletter ke liye alag media upload rasta (`NEWSLETTER_MEDIA_PATH_MAP` + server thumbnail) lagaya hai; pehle channel par media ghalat raste se ja kar atak jata tha
23
- - **Subscribed channels ki list** — naya `newsletterSubscribed()` (aur `newsletterFetchAllSubscribe()`), bilkul `groupFetchAllParticipating` ki tarah
24
- - **Link se channel maloom karna** — naya `newsletterFromUrl(url)`: channel ke invite link se seedha metadata
25
- - **Views aur reactions** — naya `newsletterFetchUpdates(jid)`: har message ke views count aur reactions ki list
26
- - **Reaction mode** — naya `newsletterReactionMode(jid, mode)`: apne channel ki reaction setting badlein
27
- - **Crash fix** — jis channel ki picture na ho, us ki metadata par ab crash nahi hota
134
+ "delayMs" controls the delay between mention operations. Its default value is "1500" milliseconds.
28
135
 
29
- Purana `newsletterFetchMessages(jid, count, since, after)` wala andaaz bhi chalta rahega — library khud samajh jati hai.
136
+ ### 5. CSToken / NCT Support
30
137
 
31
- ## 1.0.3 mein kya fix hai (Media Stream Download)
138
+ Additional support for WhatsApp's NCT and contact token handling.
32
139
 
33
- rc14 (aur official master) mein media STREAM download ke ye hisse toote hue thay — 1.0.3 mein theek hain:
140
+ - Collects NCT salt through history and app-state synchronization.
141
+ - Stores available NCT salt in authentication credentials.
142
+ - Supports regular-high synchronization when history synchronization is disabled.
143
+ - Computes CSToken using HMAC-SHA256 when a required token is unavailable.
144
+ - Prioritizes existing TCToken data when available.
145
+ - Adds additional token handling for LID-addressed messaging.
34
146
 
35
- - **Stream error aage jata hai** — download darmiyan mein kate to pehle stream hamesha ke liye hang ho jati thi aur process par uncaughtException ata tha; ab error caller ko milta hai, download saaf fail hota hai, hang nahi (official issue #2750).
36
- - **Purani media par reupload** — CDN 404/410 de to bot phone se reupload mangta hai; fetch (undici) migration ke baad status check kharab tha, reupload kabhi manga hi nahi jata tha (official issue #2767).
37
- - **Expire link (403) par bhi reupload** — signed media link expire ho jaye (oe param) to 403 ata tha aur media hamesha ke liye fail; ab WhatsApp Web ki tarah reupload se naya link ata hai.
38
- - **mediaKey string wala bug** — database/JSON se restore hue messages ki mediaKey base64 string hoti thi, jis se retry decryption fail hoti thi; ab pehle bytes mein badalti hai.
147
+ The library also exposes existing reach-out timelock information through:
39
148
 
40
- Baaki sab kuch 1.0.2 wala hi hai — API mein koi tabdeeli nahi, purana code waisa hi chalega.
149
+ ```js
150
+ sock.fetchAccountReachoutTimelock()
151
+ ```
41
152
 
42
- ## 1.0.4 mein kya fix hai (Official issues + WhatsApp Web matching)
153
+ And the connection update event can provide "reachoutTimeLock" information.
43
154
 
44
- Ye fixes official rc14 (2026-07-29) ke baad ki haqiqat ke mutabiq hain — WhatsApp Web deep research + official GitHub issues se verify karke:
155
+ ### 6. Custom Connection Banner
45
156
 
46
- - **WIN_HYBRID pehchan (official PR #2741, issue #2677)** — WhatsApp ne purana WIN32 sub-platform retire kar diya hai: jo client WIN32 bhejta hai, server us ka handshake **428** se foran band kar deta hai (nayi pairing bhi, purane session ka reconnect bhi). Ab Windows/Desktop pehchan WIN_HYBRID jati hai.
47
- - **WhatsApp version pin taza** — default version 2.3000.1048663002 kar diya. Purana pin pairing ko khamoshi se fail karta tha (phone par "Couldn't link device", socket par 408 / 405 client_too_old).
48
- - **onWhatsApp ab LID par bhi kaam karta hai (official issue #1522)** — pehle @lid dete hi khali jawab ata tha. Ab pehle local LID<->number mapping se number nikala jata hai, phir aam check chalta hai aur jawab mein `lid` bhi milta hai: `{ jid, exists, lid }`. Jis LID ki mapping bot ke paas maujud hi nahi, wo pehle ki tarah skip hoti hai (ghalat exists:false nahi jata).
157
+ StableBail includes an optional branded connection banner.
49
158
 
50
- Imandari wali note:
51
- - Channel photo wala issue (#2199) stock rc9 par report hua tha — dedicated newsletter upload paths (jo is maslay ka hal hain) stablebail 1.0.2 se pehle hi maujud hain. Live bot par phir bhi masla aye to agli mashkook cheez MediaHandle hai — live capture ke baghair us par haath nahi dala, taake chalta hua kaam na toote.
52
- - Passkey wala prompt (#2672) WhatsApp ke server ka linking-time flow hai; is ka hal library ke andar mumkin nahi (bahar ka WebAuthn signer chahiye hota hai). Pehle se pair shuda sessions par is ka asar nahi — "connect nahi hota" ki zyada tar shikayatein asal mein upar wala 428/WIN32 masla hain, jo is version mein fix hai.
53
- - Bad MAC (#1769), 405/463, bar bar disconnect — ye zyada tar server-side/account-side clusters hain; in par koi jhooti "fix" nahi dali gayi. App-state resilience wali official fix (PR #2456) rc14 mein pehle se shamil hai.
159
+ ```
160
+ ╭───────────────────────────╮
161
+ │ ✦ Q A D E E R ✦ │
162
+ │ stablebail • Qadeer-Xtech │
163
+ ╰───────────────────────────╯
164
+ ```
54
165
 
55
- Baaki sab 1.0.3 wala hi hai (stream download fixes + channel fixes) — API mein koi tabdeeli nahi.
166
+ The banner is displayed once when the connection opens.
56
167
 
57
- ## Bot mein istemal
168
+ To disable it:
58
169
 
59
170
  ```js
60
- const makeWASocket = require('@qadeer-xtech/stablebail').default
61
- const { useMultiFileAuthState, DisconnectReason } = require('@qadeer-xtech/stablebail')
171
+ const sock = makeWASocket({
172
+ auth: state,
173
+ printQRInTerminal: true,
174
+ banner: false
175
+ })
176
+ ```
177
+
178
+ ## 🚀 Basic Usage
179
+
180
+ ```js
181
+ const makeWASocket =
182
+ require('@qadeer-xtech/stablebail').default
183
+
184
+ const {
185
+ useMultiFileAuthState,
186
+ DisconnectReason
187
+ } = require('@qadeer-xtech/stablebail')
62
188
 
63
189
  async function startBot() {
64
- const { state, saveCreds } = await useMultiFileAuthState('auth_info')
65
- const sock = makeWASocket({ auth: state, printQRInTerminal: true })
190
+ const { state, saveCreds } =
191
+ await useMultiFileAuthState('auth_info')
192
+
193
+ const sock = makeWASocket({
194
+ auth: state,
195
+ printQRInTerminal: true
196
+ })
197
+
66
198
  sock.ev.on('creds.update', saveCreds)
199
+
67
200
  return sock
68
201
  }
202
+
203
+ startBot()
69
204
  ```
70
205
 
71
- ## Channel (Newsletter) ki misalein
206
+ ## 📡 Newsletter Examples
207
+
208
+ Fetch Channel Information
72
209
 
73
210
  ```js
74
- // Link se channel ki maloomat
75
- const channel = await sock.newsletterFromUrl('https://whatsapp.com/channel/0029VbCCK3T5PO17Wu4r8U1A')
76
- console.log(channel.id, channel.name, channel.subscribers)
211
+ const channel = await sock.newsletterFromUrl(
212
+ 'https://whatsapp.com/channel/CHANNEL_ID'
213
+ )
214
+
215
+ console.log(
216
+ channel.id,
217
+ channel.name,
218
+ channel.subscribers
219
+ )
220
+ ```
77
221
 
78
- // Follow / unfollow
222
+ Follow / Unfollow
223
+
224
+ ```js
79
225
  await sock.newsletterFollow(channel.id)
226
+
80
227
  await sock.newsletterUnfollow(channel.id)
228
+ ```
229
+
230
+ Get Subscribed Channels
231
+
232
+ ```js
233
+ const channels = await sock.newsletterSubscribed()
81
234
 
82
- // Mere saare subscribed channels
83
- const list = await sock.newsletterSubscribed()
235
+ console.log(channels)
236
+ ```
84
237
 
85
- // Channel ke messages parhna (naya tareeqa / purana tareeqa — dono chalte hain)
86
- const msgs = await sock.newsletterFetchMessages('jid', channel.id, 20)
87
- const msgsOld = await sock.newsletterFetchMessages(channel.id, 20)
238
+ Fetch Channel Messages
88
239
 
89
- // Views + reactions
90
- const updates = await sock.newsletterFetchUpdates(channel.id, 20)
91
- console.log(updates[0].server_id, updates[0].views, updates[0].reactions)
240
+ ```js
241
+ const messages = await sock.newsletterFetchMessages(
242
+ channel.id,
243
+ 20
244
+ )
92
245
 
93
- // Channel par message / media bhejna (apna channel ho to)
94
- await sock.sendMessage(channel.id, { text: 'Assalam o Alaikum!' })
95
- await sock.sendMessage(channel.id, { image: { url: 'https://example.com/pic.jpg' }, caption: 'Nayi post' })
246
+ console.log(messages)
247
+ ```
96
248
 
97
- // Kisi message par reaction
98
- await sock.newsletterReactMessage(channel.id, updates[0].server_id, '❤️')
249
+ Fetch Views & Reactions
250
+
251
+ ```js
252
+ const updates = await sock.newsletterFetchUpdates(
253
+ channel.id,
254
+ 20
255
+ )
256
+
257
+ console.log(
258
+ updates[0].server_id,
259
+ updates[0].views,
260
+ updates[0].reactions
261
+ )
99
262
  ```
100
263
 
101
- ## Versions
264
+ Send Channel Message
265
+
266
+ ```js
267
+ await sock.sendMessage(channel.id, {
268
+ text: 'Assalam o Alaikum! 👋'
269
+ })
270
+ ```
271
+
272
+ Send Channel Image
273
+
274
+ ```js
275
+ await sock.sendMessage(channel.id, {
276
+ image: {
277
+ url: 'https://example.com/pic.jpg'
278
+ },
279
+ caption: 'New Channel Update'
280
+ })
281
+ ```
282
+
283
+ React to Channel Message
284
+
285
+ ```js
286
+ await sock.newsletterReactMessage(
287
+ channel.id,
288
+ updates[0].server_id,
289
+ '❤️'
290
+ )
291
+ ```
292
+
293
+ ## ⚙️ Compatibility
294
+
295
+ - Node.js environment
296
+ - Baileys-compatible socket workflow
297
+ - Existing Baileys-based bot projects
298
+ - Multi-file authentication
299
+ - WhatsApp Web connection workflows
300
+
301
+ StableBail is designed to minimize migration work for existing Baileys users. However, custom methods and options are specific to this package.
302
+
303
+ ## ⚠️ Important Notes
304
+
305
+ - Some custom features may require live WhatsApp testing.
306
+ - Status mention functionality should be tested with a dedicated account before production use.
307
+ - WhatsApp may change its internal protocols without notice.
308
+ - Connection restrictions, account-level limitations, and server-side errors cannot always be resolved through library-side changes.
309
+ - Always keep your authentication credentials private.
310
+
311
+ ## 📄 License
312
+
313
+ MIT License
314
+
315
+ ## 🖤 Credits
102
316
 
103
- - **1.0.4** — Official-issue fixes: WIN_HYBRID pehchan, version pin, onWhatsApp LID (upar wali list)
104
- - **1.0.3** — Media stream download fixes
105
- - **1.0.2** — Channels/newsletter fixes
106
- - **1.0.1** — Dependencies apne packages par: `@qadeer-xtech/libsignal`, `@qadeer-xtech/whatsapp-rust-bridge`
107
- - **1.0.0** — Official Baileys 7.0.0-rc14 ki saaf copy
317
+ Developed and maintained by Team Qadeer.
108
318
 
109
- ## License
319
+ STABLEBAIL — Built for developers. Enhanced for performance.
110
320
 
111
- MIT
321
+ "Powered by Team Qadeer"
@@ -1844,6 +1844,7 @@ message HistorySync {
1844
1844
  optional string companionMetaNonce = 16;
1845
1845
  optional bytes shareableChatIdentifierEncryptionKey = 17;
1846
1846
  repeated Account accounts = 18;
1847
+ optional bytes nctSalt = 19;
1847
1848
  enum BotAIWaitListState {
1848
1849
  IN_WAITLIST = 0;
1849
1850
  AI_AVAILABLE = 1;
@@ -4527,12 +4528,17 @@ message SyncActionValue {
4527
4528
  optional NewsletterSavedInterestsAction newsletterSavedInterestsAction = 75;
4528
4529
  optional AiThreadRenameAction aiThreadRenameAction = 76;
4529
4530
  optional InteractiveMessageAction interactiveMessageAction = 77;
4531
+ optional NctSaltSyncAction nctSaltSyncAction = 80;
4530
4532
  message AgentAction {
4531
4533
  optional string name = 1;
4532
4534
  optional int32 deviceID = 2;
4533
4535
  optional bool isDeleted = 3;
4534
4536
  }
4535
4537
 
4538
+ message NctSaltSyncAction {
4539
+ optional bytes salt = 1;
4540
+ }
4541
+
4536
4542
  message AiThreadRenameAction {
4537
4543
  optional string newTitle = 1;
4538
4544
  }
@@ -4532,6 +4532,7 @@ export namespace proto {
4532
4532
  companionMetaNonce?: (string|null);
4533
4533
  shareableChatIdentifierEncryptionKey?: (Uint8Array|null);
4534
4534
  accounts?: (proto.IAccount[]|null);
4535
+ nctSalt?: (Uint8Array|null);
4535
4536
  }
4536
4537
 
4537
4538
  class HistorySync implements IHistorySync {
@@ -4553,6 +4554,7 @@ export namespace proto {
4553
4554
  public companionMetaNonce?: (string|null);
4554
4555
  public shareableChatIdentifierEncryptionKey?: (Uint8Array|null);
4555
4556
  public accounts: proto.IAccount[];
4557
+ public nctSalt?: (Uint8Array|null);
4556
4558
  public static create(properties?: proto.IHistorySync): proto.HistorySync;
4557
4559
  public static encode(m: proto.IHistorySync, w?: $protobuf.Writer): $protobuf.Writer;
4558
4560
  public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HistorySync;
@@ -11494,6 +11496,7 @@ export namespace proto {
11494
11496
  newsletterSavedInterestsAction?: (proto.SyncActionValue.INewsletterSavedInterestsAction|null);
11495
11497
  aiThreadRenameAction?: (proto.SyncActionValue.IAiThreadRenameAction|null);
11496
11498
  interactiveMessageAction?: (proto.SyncActionValue.IInteractiveMessageAction|null);
11499
+ nctSaltSyncAction?: (proto.SyncActionValue.INctSaltSyncAction|null);
11497
11500
  }
11498
11501
 
11499
11502
  class SyncActionValue implements ISyncActionValue {
@@ -11567,6 +11570,7 @@ export namespace proto {
11567
11570
  public newsletterSavedInterestsAction?: (proto.SyncActionValue.INewsletterSavedInterestsAction|null);
11568
11571
  public aiThreadRenameAction?: (proto.SyncActionValue.IAiThreadRenameAction|null);
11569
11572
  public interactiveMessageAction?: (proto.SyncActionValue.IInteractiveMessageAction|null);
11573
+ public nctSaltSyncAction?: (proto.SyncActionValue.INctSaltSyncAction|null);
11570
11574
  public static create(properties?: proto.ISyncActionValue): proto.SyncActionValue;
11571
11575
  public static encode(m: proto.ISyncActionValue, w?: $protobuf.Writer): $protobuf.Writer;
11572
11576
  public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue;
@@ -11598,6 +11602,22 @@ export namespace proto {
11598
11602
  public static getTypeUrl(typeUrlPrefix?: string): string;
11599
11603
  }
11600
11604
 
11605
+ interface INctSaltSyncAction {
11606
+ salt?: (Uint8Array|null);
11607
+ }
11608
+
11609
+ class NctSaltSyncAction implements INctSaltSyncAction {
11610
+ constructor(p?: proto.SyncActionValue.INctSaltSyncAction);
11611
+ public salt?: (Uint8Array|null);
11612
+ public static create(properties?: proto.SyncActionValue.INctSaltSyncAction): proto.SyncActionValue.NctSaltSyncAction;
11613
+ public static encode(m: proto.SyncActionValue.INctSaltSyncAction, w?: $protobuf.Writer): $protobuf.Writer;
11614
+ public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.NctSaltSyncAction;
11615
+ public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.NctSaltSyncAction;
11616
+ public static toObject(m: proto.SyncActionValue.NctSaltSyncAction, o?: $protobuf.IConversionOptions): { [k: string]: any };
11617
+ public toJSON(): { [k: string]: any };
11618
+ public static getTypeUrl(typeUrlPrefix?: string): string;
11619
+ }
11620
+
11601
11621
  interface IAiThreadRenameAction {
11602
11622
  newTitle?: (string|null);
11603
11623
  }