whalibmob 5.40.35 → 5.40.38

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
@@ -275,6 +275,7 @@ Where a session is kept, saving and restoring it, database backends, and the Sig
275
275
  ### [Handling Events & History Sync](https://github.com/Kunboruto20/whalibmob/blob/main/docs/events-history.md)
276
276
 
277
277
  - [Handling Events](https://github.com/Kunboruto20/whalibmob/blob/main/docs/events-history.md#handling-events)
278
+ - [Connection Health, Sync and Account Events](https://github.com/Kunboruto20/whalibmob/blob/main/docs/events-history.md#connection-health-sync-and-account-events)
278
279
  - [History Sync](https://github.com/Kunboruto20/whalibmob/blob/main/docs/events-history.md#history-sync)
279
280
 
280
281
  ### [Sending & Receiving Messages](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md)
@@ -285,6 +286,9 @@ Where a session is kept, saving and restoring it, database backends, and the Sig
285
286
  - [Status / Stories](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#status--stories)
286
287
  - [Send States in Chat](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#send-states-in-chat)
287
288
  - [Modifying Chats](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#modifying-chats)
289
+ - [Vote on a Poll](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#vote-on-a-poll) · [Pin a Message](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#pin-a-message) · [Send a Message You Encoded](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#send-a-message-you-encoded)
290
+ - [Encrypted Reactions, Comments, Event Responses and Edits](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#encrypted-reactions-comments-event-responses-and-edits)
291
+ - [Labels](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#labels) · [Delete a Message for Me](https://github.com/Kunboruto20/whalibmob/blob/main/docs/messaging.md#delete-a-message-for-me)
288
292
 
289
293
  ### [User Queries, Profile, Privacy & Account State](https://github.com/Kunboruto20/whalibmob/blob/main/docs/profile-privacy.md)
290
294
 
@@ -298,7 +302,9 @@ Where a session is kept, saving and restoring it, database backends, and the Sig
298
302
  - [Groups](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#groups)
299
303
  - [Communities](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#communities)
300
304
  - [Newsletters (Channels)](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#newsletters-channels)
305
+ - [Read a Channel's Posts](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#read-a-channels-posts) · [Live Updates, Views and Reactions](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#live-updates-views-and-reactions)
301
306
  - [Business Profile](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#business-profile)
307
+ - [Links, Bots, Sticker Packs and Web Push](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#links-bots-sticker-packs-and-web-push)
302
308
  - [WhatsApp IDs](https://github.com/Kunboruto20/whalibmob/blob/main/docs/groups-channels.md#whatsapp-ids)
303
309
 
304
310
  ### [IDs, Transport, Media Encryption & Device Emulation](https://github.com/Kunboruto20/whalibmob/blob/main/docs/internals.md)
@@ -165,6 +165,35 @@ The `decoded` object shape per message type:
165
165
  { type: 'protocol', subtype: string }
166
166
  ```
167
167
 
168
+ ### Connection Health, Sync and Account Events
169
+
170
+ | Event | Payload | Description |
171
+ |---|---|---|
172
+ | `keepalive_timeout` | `{ errorCount, lastSuccess }` | A keepalive ping went unanswered for 10 seconds. `errorCount` is how many in a row, `lastSuccess` when the last answer came (ms). The connection is not closed for you: decide whether to `disconnect({ reconnect: true })` |
173
+ | `keepalive_restored` | `{ missed }` | The first ping answered after one or more were missed |
174
+ | `offline_sync_preview` | `{ total, appDataChanges, messages, notifications, receipts }` | What the server is about to replay from while you were away |
175
+ | `offline_sync_completed` | `{ count }` | The replay is done; what arrives from here on is live |
176
+ | `temporary_ban` | `{ code, expireSecs, expiresAt }` | The account is temporarily banned. The session survives; the server refuses it until the ban runs out |
177
+ | `qr_scanned_without_multidevice` | `{}` | The QR was scanned by a phone with multi-device off. The same QR still works once it is on |
178
+ | `picture_update` | `{ jid, author, removed, pictureId, ts }` | A contact or group changed or removed its picture |
179
+ | `about_update` | `{ jid, about, ts }` | A contact changed its "about" text |
180
+ | `newsletter_live_update` | `{ jid, ts, messages }` | Count changes on a channel you subscribed to with `subscribeNewsletterLiveUpdates` |
181
+ | `label_edit` | `{ labelId, name, color, deleted }` | A label was created, changed or deleted |
182
+ | `label_association` | `{ labelId, jid, msgId, labeled }` | A label was put on, or taken off, a chat (`msgId` null) or a message |
183
+ | `message_deleted_for_me` | `{ jid, msgId, fromMe, deleteMedia }` | A message was deleted on this account's devices only |
184
+ | `status_muted` | `{ jid, muted }` | A contact's status updates were muted or unmuted |
185
+ | `unarchive_chats_setting` | `{ unarchiveChats }` | Whether archived chats come back when a message arrives |
186
+
187
+ The app-state events carry `remote: true` when the change was made on another device and `synced: true` when this client made it.
188
+
189
+ A keepalive example — drop a connection that has gone silent:
190
+
191
+ ```js
192
+ client.on('keepalive_timeout', ({ errorCount }) => {
193
+ if (errorCount >= 3) client.disconnect({ reconnect: true })
194
+ })
195
+ ```
196
+
168
197
  ---
169
198
 
170
199
  ## History Sync
@@ -261,6 +290,18 @@ Sync type values:
261
290
  | `NON_BLOCKING_DATA` | Background low-priority data |
262
291
  | `ON_DEMAND` | Explicitly requested by the client |
263
292
 
293
+ ### When a History Blob Cannot Be Fetched
294
+
295
+ A large history chunk is not sent inline: the phone uploads it and sends a notice with where it is and the key to open it. If that file is gone by the time you fetch it, tell the phone, and it uploads the chunk again:
296
+
297
+ ```js
298
+ // msgId: the id of the message that carried the history notice
299
+ // mediaKey: the key from that notice
300
+ await client.sendHistorySyncServerErrorReceipt(msgId, mediaKey)
301
+ ```
302
+
303
+ The receipt goes to your own account as a peer message, the same way a media re-upload request does.
304
+
264
305
  ### Persistent Files Written to Disk
265
306
 
266
307
  The library automatically writes these files to `sessionDir` per account. You do not need to create or manage them.
@@ -403,6 +403,17 @@ await client.unlinkGroupFromCommunity(
403
403
  )
404
404
  ```
405
405
 
406
+ ### Sub Groups and Community Participants
407
+
408
+ ```js
409
+ const groups = await client.getSubGroups('120363000000000001@g.us')
410
+ // [{ jid, subject, subjectTime, size, isDefaultSubGroup }]
411
+
412
+ // everyone in any group of the community — admins of the community only
413
+ const people = await client.getLinkedGroupsParticipants('120363000000000001@g.us')
414
+ // [{ jid, phoneNumber, lid }]
415
+ ```
416
+
406
417
  ## Newsletters (Channels)
407
418
 
408
419
  Newsletters are one-to-many broadcast channels. Only the owner can post; anyone can subscribe.
@@ -440,6 +451,59 @@ await client.changeNewsletterDescription('120363000000000004@newsletter', 'New d
440
451
  await client.sendNewsletterText('120363000000000004@newsletter', 'Breaking: WhatsApp adds polls!')
441
452
  ```
442
453
 
454
+ ### Read a Channel's Posts
455
+
456
+ Channel posts are not end-to-end encrypted, so they can be read for any channel, followed or not.
457
+
458
+ ```js
459
+ const posts = await client.getNewsletterMessages('120363000000000004@newsletter', { count: 20 })
460
+ for (const p of posts) {
461
+ console.log(p.serverId, p.decoded?.text, p.viewsCount, p.reactionCounts) // { '❤️': 3 } or null
462
+ }
463
+
464
+ // page back from the oldest one you have
465
+ const older = await client.getNewsletterMessages(jid, { count: 20, before: posts[0].serverId })
466
+
467
+ // what changed since: view and reaction counts, edits
468
+ const updates = await client.getNewsletterMessageUpdates(jid, { since: 1700000000, count: 50 })
469
+ ```
470
+
471
+ Each post is `{ serverId, id, type, ts, viewsCount, forwardsCount, reactionCounts, decoded, raw }`. `serverId` is the post's number in the channel and is what the calls below take; `raw` is the encoded `Message`.
472
+
473
+ Posts from channels you follow also arrive live, on the ordinary `message` event with `newsletter: true` and `serverId` set.
474
+
475
+ ### Live Updates, Views and Reactions
476
+
477
+ ```js
478
+ // ask for count changes to be pushed; lasts durationSecs, then ask again
479
+ const { durationSecs } = await client.subscribeNewsletterLiveUpdates(jid)
480
+ client.on('newsletter_live_update', ({ jid, messages }) => {
481
+ for (const m of messages) console.log(m.serverId, m.viewsCount, m.reactionCounts)
482
+ })
483
+
484
+ await client.markNewsletterViewed(jid, [posts[0].serverId, posts[1].serverId])
485
+ await client.sendNewsletterReaction(jid, posts[0].serverId, '🔥')
486
+ await client.sendNewsletterReaction(jid, posts[0].serverId, '') // take it back
487
+ ```
488
+
489
+ ### Mute, List and Look Up Channels
490
+
491
+ ```js
492
+ await client.muteNewsletter(jid)
493
+ await client.unmuteNewsletter(jid)
494
+
495
+ const mine = await client.getSubscribedNewsletters() // as the server describes them
496
+ const info = await client.getNewsletterInfoWithInvite('https://whatsapp.com/channel/0029VaABC')
497
+ ```
498
+
499
+ ### Post a Message You Encoded
500
+
501
+ `sendNewsletterText` covers text. For anything else, encode the `Message` yourself:
502
+
503
+ ```js
504
+ await client.sendNewsletterMessage(jid, messageBytes, { type: 'media', mediaType: 'image', mediaId })
505
+ ```
506
+
443
507
  ## Business Profile
444
508
 
445
509
  Query the public business profile of any WhatsApp Business account:
@@ -458,6 +522,28 @@ if (bp) {
458
522
 
459
523
  ---
460
524
 
525
+ ## Links, Bots, Sticker Packs and Web Push
526
+
527
+ ```js
528
+ // where a wa.me/message/… business link points, and the text it prefills
529
+ const biz = await client.resolveBusinessMessageLink('https://wa.me/message/ABCDEF')
530
+ // { jid, pushName, message, isSigned, verifiedName, verifiedLevel }
531
+
532
+ // your own contact link; pass true to revoke it and get a new one
533
+ const { link } = await client.getContactQrLink() // https://wa.me/qr/…
534
+ const who = await client.resolveContactQrLink(link) // { jid, pushName, type }
535
+
536
+ // the Meta AI bots the server lists
537
+ const bots = await client.getBotList() // [{ jid, personaId }]
538
+
539
+ // a sticker pack's listing from WhatsApp's store
540
+ const pack = await client.fetchStickerPack('PACK_ID')
541
+
542
+ // Web Push: let the server wake this client through a browser push service
543
+ await client.registerWebPush({ endpoint, auth, p256dh }) // from a PushSubscription
544
+ const settings = await client.getPushConfig()
545
+ ```
546
+
461
547
  ## WhatsApp IDs
462
548
 
463
549
  - Individual contacts: `[countrycode][number]@s.whatsapp.net`
package/docs/messaging.md CHANGED
@@ -309,6 +309,88 @@ The key is derived from the poll id, the poll's sender and the voter, so a vote
309
309
  on someone else's poll needs their `encKey`, which only arrives if they sent the
310
310
  poll to you: read it off `msg.decoded.encKey` on the poll message itself.
311
311
 
312
+ ### Vote on a Poll
313
+
314
+ ```js
315
+ // poll: a poll message you received (or one you sent with sendPoll)
316
+ client.on('message', async (msg) => {
317
+ if (msg.decoded?.type !== 'poll') return
318
+ await client.sendPollVote(msg.chat, {
319
+ id: msg.id,
320
+ sender: msg.participant || msg.from, // who sent the poll
321
+ encKey: msg.decoded.encKey // the poll's message secret
322
+ }, ['Rust']) // option texts; [] clears your vote
323
+ })
324
+
325
+ // a poll you sent yourself
326
+ const poll = await client.sendPoll(jid, 'Language?', ['Rust', 'Go'], 1)
327
+ await client.sendPollVote(jid, { id: poll.id, fromMe: true, encKey: poll.encKey }, ['Go'])
328
+ ```
329
+
330
+ The vote is encrypted under the poll's secret, so `encKey` is required: there is no way to vote on a poll whose message you never received. In a group the vote names the poll's author, which is why `sender` is needed for somebody else's poll.
331
+
332
+ ### Pin a Message
333
+
334
+ ```js
335
+ // pin for everyone, for 7 days (the default); 86400 and 2592000 are the other choices
336
+ await client.pinMessage(jid, { id: 'MSGID123', fromMe: true }, { durationSecs: 604800 })
337
+
338
+ // in a group, somebody else's message needs its sender
339
+ await client.pinMessage(groupJid, { id: 'MSGID456', fromMe: false, participant: '919634847671@s.whatsapp.net' })
340
+
341
+ await client.unpinMessage(jid, { id: 'MSGID123', fromMe: true })
342
+ ```
343
+
344
+ An incoming pin decodes as `{ type: 'pinInChat', pinned, targetKey }`, and a "keep in chat" on a disappearing message as `{ type: 'keepInChat', kept, targetKey }`.
345
+
346
+ ### Encrypted Reactions, Comments, Event Responses and Edits
347
+
348
+ Some messages act on another message and are encrypted under *that* message's secret rather than sent in the clear: a reaction or a comment in a community announcement group, a response to an event, an encrypted edit. They decode as `encReaction`, `encComment`, `encEventResponse` and `secretEncrypted`, each with a `targetKey` naming the message it belongs to.
349
+
350
+ To read one you need the target message's secret. It is on the target when it arrives, as `decoded.messageSecret`, so keep it by message id:
351
+
352
+ ```js
353
+ const secrets = new Map() // message id -> 32-byte secret
354
+
355
+ client.on('message', (msg) => {
356
+ const d = msg.decoded
357
+ if (!d) return
358
+ if (d.messageSecret) secrets.set(msg.id, d.messageSecret)
359
+
360
+ const secret = d.targetKey && secrets.get(d.targetKey.id)
361
+ if (!secret) return
362
+
363
+ if (d.type === 'encReaction') {
364
+ const r = client.decryptReaction(msg, { messageSecret: secret })
365
+ console.log(msg.participant, 'reacted', r.text) // '' means the reaction was removed
366
+ } else if (d.type === 'encComment') {
367
+ const c = client.decryptComment(msg, { messageSecret: secret })
368
+ console.log('comment:', c.decoded?.text)
369
+ } else if (d.type === 'encEventResponse') {
370
+ const e = client.decryptEventResponse(msg, { messageSecret: secret })
371
+ console.log(e.response) // 'going' | 'not_going' | 'maybe'
372
+ } else if (d.type === 'secretEncrypted') {
373
+ const e = client.decryptSecretMessage(msg, { messageSecret: secret })
374
+ console.log(e.secretType, e.decoded?.text) // 'Message Edit', the new text
375
+ }
376
+ })
377
+ ```
378
+
379
+ Every result also carries `plaintext`, the protobuf that was inside, for anything the built-in decoder does not name. The key depends on who sent the target and who sent the add-on; both are read off the message, and `opts.targetSender` / `opts.sender` override them when you know better. A wrong secret or a wrong sender throws rather than returning garbage.
380
+
381
+ ### Send a Message You Encoded
382
+
383
+ For a message type this library has no method for, encode the `Message` protobuf yourself and hand over the bytes. It is encrypted and delivered exactly like the built-in sends.
384
+
385
+ ```js
386
+ // messageBytes: an encoded WhatsApp `Message`, from your own protobuf tooling
387
+ await client.sendRawMessage(jid, messageBytes) // a text-like message
388
+ await client.sendRawMessage(jid, messageBytes, { type: 'media', mediaType: 'image' })
389
+ await client.sendRawMessage(jid, messageBytes, { type: 'poll', pollType: 'creation' })
390
+ ```
391
+
392
+ The options describe what the stanza says in the clear, which the server reads without decrypting anything: `type` (`text`, `media`, `poll`, `reaction`), `mediaType` for media (`image`, `video`, `audio`, `ptt`, `document`, `sticker`, `gif`, `vcard`…), `pollType`, `edit` (`'1'` edit, `'2'` pin, `'7'` revoke, `'8'` admin revoke) and `hide` (show nothing if it cannot be decrypted). A message that says one thing in the stanza and another inside may be dropped by the recipient, so set them to match.
393
+
312
394
  ### Quoted Reply
313
395
 
314
396
  Send a text message that quotes (replies to) a specific earlier message. The recipient sees the original message highlighted above your reply.
@@ -606,6 +688,31 @@ await client.starMessage('MSGID123', '919634847671', true) // yours
606
688
  await client.unstarMessage('MSGID123', '919634847671', false) // theirs
607
689
  ```
608
690
 
691
+ ### Labels
692
+
693
+ Labels are the coloured tags a WhatsApp Business account files chats under. A label is identified by an id you choose; create or change it, then put it on a chat or on one message.
694
+
695
+ ```js
696
+ await client.editLabel('5', { name: 'VIP', color: 3 }) // create, rename or recolour
697
+ await client.labelChat('919634847671', '5') // tag a chat
698
+ await client.labelMessage('919634847671', '5', 'MSGID123') // tag one message
699
+ await client.labelChat('919634847671', '5', false) // remove the tag
700
+ await client.editLabel('5', { deleted: true }) // delete the label
701
+ ```
702
+
703
+ ### Delete a Message for Me
704
+
705
+ Removes one message from this account's devices only; nobody else's copy changes. This is not `deleteMessage(..., true)`, which revokes it for everyone.
706
+
707
+ ```js
708
+ await client.deleteMessageForMe('919634847671', 'MSGID123', true, {
709
+ timestamp: 1700000000, // the message's time, unix seconds
710
+ deleteMedia: true
711
+ })
712
+ ```
713
+
714
+ Both of these are app-state changes, so they need a session that can sync app state (`client.canSyncAppState()`), and they throw when it cannot. Changes made on the phone arrive as `label_edit`, `label_association`, `message_deleted_for_me`, `status_muted` and `unarchive_chats_setting` — see [All Events](events-history.md#connection-health-sync-and-account-events).
715
+
609
716
  <a id="app-state-sync"></a>
610
717
 
611
718
  ### Reading Changes Made Elsewhere
package/index.d.ts CHANGED
@@ -62,6 +62,8 @@ export interface DeviceConfig {
62
62
  osVersion?: string;
63
63
  build?: string;
64
64
  modelId?: string;
65
+ /** The Android SDK the handset shipped with, sent as `first_api_level`. */
66
+ firstApiLevel?: number | string;
65
67
  business?: boolean;
66
68
  [key: string]: any;
67
69
  }
@@ -202,6 +204,75 @@ export interface ConnectWebOptions {
202
204
  lidDbMigrated?: boolean;
203
205
  }
204
206
 
207
+ /** A message another message acts on. */
208
+ export interface MessageTarget {
209
+ id: string;
210
+ fromMe?: boolean;
211
+ /** In a group, who sent it when it is not ours. */
212
+ participant?: Jid;
213
+ }
214
+
215
+ export interface PollVoteTarget {
216
+ id: string;
217
+ /** Who sent the poll; not needed when `fromMe`. */
218
+ sender?: Jid;
219
+ fromMe?: boolean;
220
+ /** The poll's 32-byte message secret. */
221
+ encKey: Buffer;
222
+ }
223
+
224
+ export interface RawMessageOptions {
225
+ id?: string;
226
+ /** What the stanza says the message is. Default `text`. */
227
+ type?: 'text' | 'media' | 'poll' | 'reaction';
228
+ /** For `media`: image, video, audio, ptt, document, sticker, gif, vcard… */
229
+ mediaType?: string;
230
+ pollType?: 'creation' | 'vote';
231
+ /** `'1'` edit, `'2'` pin, `'7'` revoke, `'8'` admin revoke. */
232
+ edit?: string;
233
+ /** Tell recipients to show nothing if it cannot be decrypted. */
234
+ hide?: boolean;
235
+ }
236
+
237
+ export interface SecretMessageOptions {
238
+ /** The target message's 32-byte secret (`decoded.messageSecret` on it). */
239
+ messageSecret: Buffer;
240
+ targetSender?: Jid;
241
+ sender?: Jid;
242
+ }
243
+
244
+ export interface SecretMessageResult {
245
+ type: 'encReaction' | 'encComment' | 'encEventResponse' | 'secretEncrypted';
246
+ /** The label the key was derived under, e.g. `Enc Reaction`. */
247
+ secretType: string;
248
+ targetKey: { remoteJid: string | null; fromMe: boolean; id: string | null; participant: string | null };
249
+ /** The protobuf that was inside. */
250
+ plaintext: Buffer;
251
+ /** Read as a Message where that is what it is: an edit, a comment. */
252
+ decoded: any | null;
253
+ /** A reaction's emoji; empty when it was removed. */
254
+ text?: string;
255
+ response?: 'going' | 'not_going' | 'maybe' | 'unknown';
256
+ senderTimestampMs?: number;
257
+ timestampMs?: number;
258
+ extraGuestCount?: number;
259
+ messageRaw?: Buffer;
260
+ }
261
+
262
+ /** One post of a channel. */
263
+ export interface NewsletterMessage {
264
+ serverId: number | null;
265
+ id: string | null;
266
+ type: string | null;
267
+ ts: number;
268
+ viewsCount: number;
269
+ forwardsCount: number;
270
+ reactionCounts: Record<string, number> | null;
271
+ /** The encoded Message. */
272
+ raw: Buffer | null;
273
+ decoded: any | null;
274
+ }
275
+
205
276
  /** Who a pair-success would link this device to. */
206
277
  export interface PrePairInfo {
207
278
  jid: Jid;
@@ -1019,6 +1090,27 @@ export interface WhalibmobEvents {
1019
1090
  paired: (p: { jid: Jid; lid: Jid; deviceIndex: number; platform: string }) => void;
1020
1091
  /** Companion mode: a pair-success was turned down, here or by `prePair`. `error` fires too. */
1021
1092
  pair_error: (p: { jid: Jid | null; lid: Jid | null; platform: string | null; err: Error }) => void;
1093
+
1094
+ /** A keepalive ping went unanswered. The connection is not closed for you. */
1095
+ keepalive_timeout: (k: { errorCount: number; lastSuccess: number | null }) => void;
1096
+ /** The first keepalive answered after one or more were missed. */
1097
+ keepalive_restored: (k: { missed: number }) => void;
1098
+ /** What the server is about to replay from while this client was away. */
1099
+ offline_sync_preview: (o: { total: number; appDataChanges: number; messages: number; notifications: number; receipts: number }) => void;
1100
+ /** The replay is done; what arrives from here on is live. */
1101
+ offline_sync_completed: (o: { count: number }) => void;
1102
+ /** The account is temporarily banned; the session survives. */
1103
+ temporary_ban: (b: { code: string | null; expireSecs: number | null; expiresAt: number | null }) => void;
1104
+ /** The QR was scanned by a phone with multi-device turned off. */
1105
+ qr_scanned_without_multidevice: (e: Record<string, never>) => void;
1106
+ picture_update: (p: { jid: Jid; author: Jid | null; removed: boolean; pictureId: string | null; ts: number }) => void;
1107
+ about_update: (a: { jid: Jid; about: string; ts: number }) => void;
1108
+ newsletter_live_update: (u: { jid: Jid; ts: number; messages: NewsletterMessage[] }) => void;
1109
+ label_edit: (l: { labelId: string; name: string; color: number; deleted: boolean; remote?: boolean; synced?: boolean }) => void;
1110
+ label_association: (l: { labelId: string; jid: Jid; msgId: string | null; labeled: boolean; remote?: boolean; synced?: boolean }) => void;
1111
+ message_deleted_for_me: (m: { jid: Jid; msgId: string; fromMe: boolean; deleteMedia: boolean; remote?: boolean; synced?: boolean }) => void;
1112
+ status_muted: (s: { jid: Jid; muted: boolean; remote?: boolean }) => void;
1113
+ unarchive_chats_setting: (s: { unarchiveChats: boolean; remote?: boolean }) => void;
1022
1114
  /** Companion mode: the account can be linked with a passkey. Answer with `sendPasskeyResponse`. */
1023
1115
  passkey_request: (p: { publicKey: PasskeyRequestOptions }) => void;
1024
1116
  /**
@@ -1418,6 +1510,18 @@ export declare class WhalibmobClient extends EventEmitter {
1418
1510
  * without them only the SHA-256 of each choice is available.
1419
1511
  */
1420
1512
  decryptPollVote(vote: DecodedMessage | IncomingMessage, opts: PollVoteOptions): PollVoteResult;
1513
+ /** Vote on a poll. `selected` are option texts; an empty list clears the vote. */
1514
+ sendPollVote(chatJid: Jid, poll: PollVoteTarget, selected: string[], opts?: SendOptions & { sender?: Jid }): Promise<SendResult>;
1515
+ /** Send an encoded `Message` this library has no method for. */
1516
+ sendRawMessage(to: Jid, message: Buffer, opts?: RawMessageOptions): Promise<SendResult>;
1517
+ /** Pin a message for everyone in a chat. */
1518
+ pinMessage(chatJid: Jid, target: MessageTarget, opts?: { pin?: boolean; durationSecs?: number; id?: string }): Promise<SendResult>;
1519
+ unpinMessage(chatJid: Jid, target: MessageTarget, opts?: { id?: string }): Promise<SendResult>;
1520
+ /** Open an add-on sealed under another message's secret. Throws when it will not open. */
1521
+ decryptSecretMessage(msg: DecodedMessage | IncomingMessage, opts: SecretMessageOptions): SecretMessageResult;
1522
+ decryptReaction(msg: DecodedMessage | IncomingMessage, opts: SecretMessageOptions): SecretMessageResult;
1523
+ decryptComment(msg: DecodedMessage | IncomingMessage, opts: SecretMessageOptions): SecretMessageResult;
1524
+ decryptEventResponse(msg: DecodedMessage | IncomingMessage, opts: SecretMessageOptions): SecretMessageResult;
1421
1525
  /** Ask the sender's phone to re-upload a file the CDN no longer has. */
1422
1526
  requestMediaRetry(info: { id: string; chatJid: Jid; fromMe: boolean; participant?: Jid }, mediaKey: Buffer): Promise<void>;
1423
1527
  decryptMediaRetry(notification: MediaRetryNotification, mediaKey: Buffer): MediaRetryResult;
@@ -1439,6 +1543,16 @@ export declare class WhalibmobClient extends EventEmitter {
1439
1543
  queryPictureInfo(jid: Jid, opts?: object): Promise<any>;
1440
1544
  downloadProfilePicture(jid: Jid, opts?: object): Promise<Buffer | null>;
1441
1545
  queryBusinessProfile(jid: Jid): Promise<BusinessProfile | null>;
1546
+ resolveBusinessMessageLink(linkOrCode: string): Promise<{ jid: Jid | null; pushName: string | null; message: string | null;
1547
+ isSigned: boolean; verifiedName: string | null; verifiedLevel: string | null }>;
1548
+ /** Our own contact link; `revoke` replaces it. */
1549
+ getContactQrLink(revoke?: boolean): Promise<{ code: string; link: string }>;
1550
+ resolveContactQrLink(linkOrCode: string): Promise<{ jid: Jid | null; pushName: string | null; type: string | null }>;
1551
+ getBotList(): Promise<Array<{ jid: Jid; personaId: string | null }>>;
1552
+ fetchStickerPack(packId: string): Promise<any>;
1553
+ registerWebPush(subscription: { endpoint: string; auth: Buffer | string; p256dh: Buffer | string }): Promise<void>;
1554
+ getPushConfig(): Promise<Record<string, string>>;
1555
+ sendHistorySyncServerErrorReceipt(msgId: string, mediaKey: Buffer): Promise<void>;
1442
1556
 
1443
1557
  // ─── Profile ─────────────────────────────────────────────────────────────
1444
1558
  /** Publishes and saves rename intent. True confirms an App State write only;
@@ -1526,6 +1640,12 @@ export declare class WhalibmobClient extends EventEmitter {
1526
1640
  archiveChat(jid: Jid): Promise<boolean>;
1527
1641
  unarchiveChat(jid: Jid): Promise<boolean>;
1528
1642
  starMessage(msgId: string, chatJid: Jid, fromMe: boolean): Promise<boolean>;
1643
+ /** Create, rename or recolour a label, or delete it with `{ deleted: true }`. Needs app-state sync. */
1644
+ editLabel(labelId: string | number, opts?: { name?: string; color?: number; deleted?: boolean }): Promise<void>;
1645
+ labelChat(jid: Jid, labelId: string | number, labeled?: boolean): Promise<void>;
1646
+ labelMessage(jid: Jid, labelId: string | number, msgId: string, labeled?: boolean): Promise<void>;
1647
+ /** Delete one message on this account's devices only. Needs app-state sync. */
1648
+ deleteMessageForMe(jid: Jid, msgId: string, fromMe: boolean, opts?: { timestamp?: number; deleteMedia?: boolean }): Promise<void>;
1529
1649
  unstarMessage(msgId: string, chatJid: Jid, fromMe: boolean): Promise<boolean>;
1530
1650
  changeEphemeralTimer(jid: Jid, seconds: number): Promise<any>;
1531
1651
  changeNewChatsEphemeralTimer(seconds: number): Promise<any>;
@@ -1614,6 +1734,9 @@ export declare class WhalibmobClient extends EventEmitter {
1614
1734
  createCommunity(subject: string, description?: string, opts?: object): Promise<GroupMetadata>;
1615
1735
  deactivateCommunity(communityJid: Jid): Promise<any>;
1616
1736
  linkGroupsToCommunity(communityJid: Jid, groupJids: Jid[]): Promise<any>;
1737
+ getSubGroups(communityJid: Jid): Promise<Array<{ jid: Jid; subject: string | null; subjectTime: number; size: number | null; isDefaultSubGroup: boolean }>>;
1738
+ /** Everyone in any group of a community. Community admins only. */
1739
+ getLinkedGroupsParticipants(communityJid: Jid): Promise<Array<{ jid: Jid; phoneNumber: Jid | null; lid: Jid | null }>>;
1617
1740
  unlinkGroupFromCommunity(communityJid: Jid, groupJid: Jid): Promise<any>;
1618
1741
 
1619
1742
  // ─── Newsletters ─────────────────────────────────────────────────────────
@@ -1623,6 +1746,20 @@ export declare class WhalibmobClient extends EventEmitter {
1623
1746
  queryNewsletterMetadata(newsletterJid: Jid): Promise<any>;
1624
1747
  changeNewsletterDescription(newsletterJid: Jid, description: string): Promise<any>;
1625
1748
  sendNewsletterText(newsletterJid: Jid, text: string): Promise<any>;
1749
+ /** Post an encoded `Message` to a channel you administer. */
1750
+ sendNewsletterMessage(newsletterJid: Jid, message: Buffer,
1751
+ opts?: { id?: string; type?: string; mediaType?: string; mediaId?: string; edit?: string }): Promise<{ id: string; to: Jid }>;
1752
+ getNewsletterMessages(newsletterJid: Jid, opts?: { count?: number; before?: number }): Promise<NewsletterMessage[]>;
1753
+ getNewsletterMessageUpdates(newsletterJid: Jid, opts?: { count?: number; since?: number; after?: number }): Promise<NewsletterMessage[]>;
1754
+ /** Ask for count changes to be pushed as `newsletter_live_update`, for `durationSecs`. */
1755
+ subscribeNewsletterLiveUpdates(newsletterJid: Jid): Promise<{ durationSecs: number }>;
1756
+ markNewsletterViewed(newsletterJid: Jid, serverIds: number | number[]): Promise<void>;
1757
+ /** React to a channel post; an empty reaction takes ours back. */
1758
+ sendNewsletterReaction(newsletterJid: Jid, serverId: number, reaction: string, opts?: { id?: string }): Promise<{ id: string; to: Jid }>;
1759
+ muteNewsletter(newsletterJid: Jid, mute?: boolean): Promise<{ jid: Jid; muted: boolean }>;
1760
+ unmuteNewsletter(newsletterJid: Jid): Promise<{ jid: Jid; muted: boolean }>;
1761
+ getSubscribedNewsletters(): Promise<any[]>;
1762
+ getNewsletterInfoWithInvite(linkOrCode: string): Promise<any>;
1626
1763
 
1627
1764
  // ─── Stores on disk ──────────────────────────────────────────────────────
1628
1765
  getHistoryStore(): any;
@@ -2221,6 +2358,7 @@ export declare const Messages: {
2221
2358
  RETRY_KEY_INFO: string;
2222
2359
  };
2223
2360
  ReportingToken: LibModule;
2361
+ MessageSecret: LibModule;
2224
2362
  TcTokenStore: LibModule;
2225
2363
  };
2226
2364
 
package/index.js CHANGED
@@ -170,6 +170,7 @@ const GroupParticipant = require('./lib/GroupParticipant');
170
170
  const Messages = {
171
171
  MessageSender: require('./lib/messages/MessageSender'),
172
172
  MediaRetry: require('./lib/messages/MediaRetry'),
173
+ MessageSecret: require('./lib/messages/MessageSecret'),
173
174
  ReportingToken: require('./lib/messages/ReportingToken'),
174
175
  TcTokenStore: require('./lib/messages/TcTokenStore')
175
176
  };