zaileys 4.2.1 → 4.4.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { WAMessage, WAMessageKey, AnyMessageContent, MiscMessageGenerationOptions, Chat, Contact, PresenceData, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue, GroupMetadata, ParticipantAction, NewsletterMetadata, WAMediaUpload, AuthenticationCreds, SignalDataTypeMap, SignalDataSet, WASocket, UserFacingSocketConfig, SignalKeyStore, MessageUpsertType } from 'baileys';
2
- export { GroupMetadata, GroupParticipant, NewsletterMetadata, ParticipantAction, WAMediaUpload, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from 'baileys';
1
+ import { WAMessage, WAMessageKey, AnyMessageContent, MiscMessageGenerationOptions, Chat, Contact, PresenceData, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue, GroupMetadata, ParticipantAction, WAMediaUpload, ChatModification, NewsletterMetadata, AuthenticationCreds, SignalDataTypeMap, SignalDataSet, WASocket, UserFacingSocketConfig, SignalKeyStore, MessageUpsertType } from 'baileys';
2
+ export { GroupMetadata, GroupParticipant, NewsletterMetadata, ParticipantAction, WAMediaUpload, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue, areJidsSameUser, getDevice, isJidBroadcast, isJidGroup, isJidNewsletter, isLidUser, isPnUser, jidDecode, jidEncode, jidNormalizedUser } from 'baileys';
3
3
  import { Readable } from 'node:stream';
4
4
  import { Pool } from 'pg';
5
5
  import { RedisClientType } from 'redis';
@@ -15,6 +15,11 @@ type VideoOptions = {
15
15
  caption?: string;
16
16
  gifPlayback?: boolean;
17
17
  viewOnce?: boolean;
18
+ /** Send as a round video note (PTV). */
19
+ ptv?: boolean;
20
+ };
21
+ type VideoNoteOptions = {
22
+ viewOnce?: boolean;
18
23
  };
19
24
  type AudioOptions = {
20
25
  ptt?: boolean;
@@ -118,6 +123,44 @@ type TemplateOptions = {
118
123
  footer?: string;
119
124
  buttons: ButtonDef[];
120
125
  };
126
+ type EventOptions = {
127
+ name: string;
128
+ description?: string;
129
+ startAt: Date | number;
130
+ endAt?: Date | number;
131
+ location?: {
132
+ latitude: number;
133
+ longitude: number;
134
+ name?: string;
135
+ address?: string;
136
+ };
137
+ call?: 'audio' | 'video';
138
+ canceled?: boolean;
139
+ };
140
+ type ProductOptions = {
141
+ image: MediaSource;
142
+ title: string;
143
+ businessOwnerId: string;
144
+ description?: string;
145
+ /** Price in currency units (e.g. 50 = 50.00); mapped to priceAmount1000. */
146
+ price?: number;
147
+ currency?: string;
148
+ productId?: string;
149
+ retailerId?: string;
150
+ url?: string;
151
+ body?: string;
152
+ footer?: string;
153
+ };
154
+ type GroupInviteOptions = {
155
+ jid: string;
156
+ code: string;
157
+ subject?: string;
158
+ caption?: string;
159
+ /** Unix seconds when the invite expires. Defaults to ~3 days from now. WhatsApp reads this as seconds. */
160
+ expiresAt?: number;
161
+ /** Optional JPEG thumbnail (group avatar) — improves how the card renders. */
162
+ thumbnail?: Buffer;
163
+ };
121
164
  type BuilderContext = {
122
165
  recipient: string;
123
166
  quoted?: WAMessage | WAMessageKey;
@@ -199,6 +242,7 @@ declare class MessageBuilder<State extends BuilderState> {
199
242
  to(this: MessageBuilder<'init'>, recipient: string): MessageBuilder<'init'>;
200
243
  text(this: MessageBuilder<'init'>, content: string, opts?: TextOptions): MessageBuilder<'content-set'>;
201
244
  image(this: MessageBuilder<'init'>, src: MediaSource, opts?: ImageOptions): MessageBuilder<'content-set'>;
245
+ videoNote(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoNoteOptions): MessageBuilder<'content-set'>;
202
246
  video(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoOptions): MessageBuilder<'content-set'>;
203
247
  audio(this: MessageBuilder<'init'>, src: MediaSource, opts?: AudioOptions): MessageBuilder<'content-set'>;
204
248
  document(this: MessageBuilder<'init'>, src: MediaSource, opts: DocumentOptions): MessageBuilder<'content-set'>;
@@ -212,6 +256,12 @@ declare class MessageBuilder<State extends BuilderState> {
212
256
  location(this: MessageBuilder<'init'>, lat: number, lon: number, opts?: LocationOptions): MessageBuilder<'content-set'>;
213
257
  contact(this: MessageBuilder<'init'>, vcard: string): MessageBuilder<'content-set'>;
214
258
  template(this: MessageBuilder<'init'>, opts: TemplateOptions): MessageBuilder<'content-set'>;
259
+ event(this: MessageBuilder<'init'>, opts: EventOptions): MessageBuilder<'content-set'>;
260
+ groupInvite(this: MessageBuilder<'init'>, opts: GroupInviteOptions): MessageBuilder<'content-set'>;
261
+ product(this: MessageBuilder<'init'>, opts: ProductOptions): MessageBuilder<'content-set'>;
262
+ requestPhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
263
+ sharePhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
264
+ limitSharing(this: MessageBuilder<'init'>, enabled?: boolean): MessageBuilder<'content-set'>;
215
265
  album(this: MessageBuilder<'init'>, items: AlbumItem[]): MessageBuilder<'content-set'>;
216
266
  reply(quoted: WAMessage | WAMessageKey): MessageBuilder<State>;
217
267
  mentions(jids: string[]): MessageBuilder<State>;
@@ -276,9 +326,14 @@ interface MessageStore {
276
326
  type DeleteOptions = {
277
327
  forEveryone?: boolean;
278
328
  };
329
+ type PinOptions = {
330
+ /** Pin duration in seconds (WhatsApp offers 86400 / 604800 / 2592000). Defaults to 24h. */
331
+ duration?: number;
332
+ };
279
333
  declare const deleteMessage: (socket: BuilderSocketLike, key: WAMessageKey, opts?: DeleteOptions) => Promise<void>;
280
334
  declare const reactToMessage: (socket: BuilderSocketLike, key: WAMessageKey, emoji: string) => Promise<WAMessageKey>;
281
335
  declare const forwardMessage: (socket: BuilderSocketLike, store: Pick<MessageStore, "getMessage">, key: WAMessageKey, to: string) => Promise<WAMessageKey>;
336
+ declare const pinMessage: (socket: BuilderSocketLike, key: WAMessageKey, pin: boolean, opts?: PinOptions) => Promise<WAMessageKey>;
282
337
 
283
338
  interface UsernameResolveSocketLike {
284
339
  onWhatsApp(...phoneNumber: string[]): Promise<Array<{
@@ -359,6 +414,43 @@ interface DomainSocketLike {
359
414
  groupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>;
360
415
  groupSettingUpdate(jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<void>;
361
416
  updateMemberLabel(jid: string, memberLabel: string): Promise<unknown>;
417
+ groupFetchAllParticipating(): Promise<{
418
+ [jid: string]: GroupMetadata;
419
+ }>;
420
+ groupGetInviteInfo(code: string): Promise<GroupMetadata>;
421
+ groupRequestParticipantsList(jid: string): Promise<Array<{
422
+ [k: string]: string;
423
+ }>>;
424
+ groupRequestParticipantsUpdate(jid: string, participants: string[], action: 'approve' | 'reject'): Promise<{
425
+ status: string;
426
+ jid: string;
427
+ }[]>;
428
+ groupJoinApprovalMode(jid: string, mode: 'on' | 'off'): Promise<void>;
429
+ groupMemberAddMode(jid: string, mode: 'admin_add' | 'all_member_add'): Promise<void>;
430
+ onWhatsApp(...jids: string[]): Promise<Array<{
431
+ jid: string;
432
+ exists: boolean;
433
+ lid?: string;
434
+ }> | undefined>;
435
+ addOrEditContact(jid: string, contact: {
436
+ firstName?: string;
437
+ lastName?: string;
438
+ fullName?: string;
439
+ }): Promise<unknown>;
440
+ removeContact(jid: string): Promise<unknown>;
441
+ getBusinessProfile(jid: string): Promise<unknown>;
442
+ getCatalog(opts: {
443
+ jid?: string;
444
+ limit?: number;
445
+ cursor?: string;
446
+ }): Promise<unknown>;
447
+ getCollections(jid?: string, limit?: number): Promise<unknown>;
448
+ getOrderDetails(orderId: string, tokenBase64: string): Promise<unknown>;
449
+ productCreate(create: Record<string, unknown>): Promise<unknown>;
450
+ productUpdate(productId: string, update: Record<string, unknown>): Promise<unknown>;
451
+ productDelete(productIds: string[]): Promise<{
452
+ deleted: number;
453
+ }>;
362
454
  updateLastSeenPrivacy(value: WAPrivacyValue): Promise<void>;
363
455
  updateOnlinePrivacy(value: WAPrivacyOnlineValue): Promise<void>;
364
456
  updateProfilePicturePrivacy(value: WAPrivacyValue): Promise<void>;
@@ -371,6 +463,13 @@ interface DomainSocketLike {
371
463
  }>;
372
464
  updateBlockStatus(jid: string, action: 'block' | 'unblock'): Promise<void>;
373
465
  fetchBlocklist(): Promise<string[]>;
466
+ updateProfileName(name: string): Promise<void>;
467
+ updateProfileStatus(status: string): Promise<void>;
468
+ updateProfilePicture(jid: string, content: WAMediaUpload): Promise<void>;
469
+ removeProfilePicture(jid: string): Promise<void>;
470
+ profilePictureUrl(jid: string, type?: 'image' | 'preview', timeoutMs?: number): Promise<string | undefined>;
471
+ fetchStatus(jid: string): Promise<unknown>;
472
+ chatModify(mod: ChatModification, jid: string): Promise<void>;
374
473
  newsletterCreate(name: string, description?: string): Promise<NewsletterMetadata>;
375
474
  newsletterFollow(jid: string): Promise<unknown>;
376
475
  newsletterUnfollow(jid: string): Promise<unknown>;
@@ -381,6 +480,13 @@ interface DomainSocketLike {
381
480
  newsletterMute(jid: string): Promise<unknown>;
382
481
  newsletterUnmute(jid: string): Promise<unknown>;
383
482
  newsletterDelete(jid: string): Promise<void>;
483
+ newsletterSubscribers(jid: string): Promise<unknown>;
484
+ newsletterRemovePicture(jid: string): Promise<unknown>;
485
+ newsletterReactMessage(jid: string, serverId: string, reaction?: string): Promise<void>;
486
+ newsletterFetchMessages(jid: string, count: number, since?: number, after?: number): Promise<unknown>;
487
+ newsletterAdminCount(jid: string): Promise<number>;
488
+ newsletterChangeOwner(jid: string, newOwnerJid: string): Promise<void>;
489
+ newsletterDemote(jid: string, userJid: string): Promise<void>;
384
490
  communityCreate(subject: string, body: string): Promise<GroupMetadata>;
385
491
  communityCreateGroup(subject: string, participants: string[], parentCommunityJid: string): Promise<GroupMetadata>;
386
492
  communityLinkGroup(groupJid: string, parentCommunityJid: string): Promise<void>;
@@ -396,6 +502,15 @@ interface DomainSocketLike {
396
502
  communityInviteCode(jid: string): Promise<string | undefined>;
397
503
  communityRevokeInvite(jid: string): Promise<string | undefined>;
398
504
  communityAcceptInvite(code: string): Promise<string | undefined>;
505
+ communityMetadata(jid: string): Promise<GroupMetadata>;
506
+ communityFetchAllParticipating(): Promise<{
507
+ [jid: string]: GroupMetadata;
508
+ }>;
509
+ communityGetInviteInfo(code: string): Promise<GroupMetadata>;
510
+ communityToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>;
511
+ communitySettingUpdate(jid: string, setting: 'announcement' | 'not_announcement'): Promise<void>;
512
+ communityMemberAddMode(jid: string, mode: 'admin_add' | 'all_member_add'): Promise<void>;
513
+ communityJoinApprovalMode(jid: string, mode: 'on' | 'off'): Promise<void>;
399
514
  }
400
515
 
401
516
  declare class GroupModule {
@@ -420,6 +535,15 @@ declare class GroupModule {
420
535
  acceptInvite(code: string): Promise<string>;
421
536
  toggleEphemeral(groupId: string, seconds: number): Promise<void>;
422
537
  setting(groupId: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<void>;
538
+ list(): Promise<GroupMetadata[]>;
539
+ inviteInfo(code: string): Promise<GroupMetadata>;
540
+ joinRequests(groupId: string): Promise<Array<{
541
+ [k: string]: string;
542
+ }>>;
543
+ approveJoin(groupId: string, jids: string[]): Promise<ParticipantUpdateResult[]>;
544
+ rejectJoin(groupId: string, jids: string[]): Promise<ParticipantUpdateResult[]>;
545
+ joinApproval(groupId: string, enabled: boolean): Promise<void>;
546
+ memberAddMode(groupId: string, adminsOnly: boolean): Promise<void>;
423
547
  }
424
548
 
425
549
  declare class PrivacyModule {
@@ -455,6 +579,18 @@ declare class NewsletterModule {
455
579
  mute(jid: string): Promise<void>;
456
580
  unmute(jid: string): Promise<void>;
457
581
  delete(jid: string): Promise<void>;
582
+ removePicture(jid: string): Promise<void>;
583
+ react(jid: string, serverId: string, emoji: string): Promise<void>;
584
+ /** Remove a reaction from a newsletter message. */
585
+ unreact(jid: string, serverId: string): Promise<void>;
586
+ subscribers(jid: string): Promise<unknown>;
587
+ messages(jid: string, count?: number, opts?: {
588
+ since?: number;
589
+ after?: number;
590
+ }): Promise<unknown>;
591
+ adminCount(jid: string): Promise<number>;
592
+ changeOwner(jid: string, newOwnerJid: string): Promise<void>;
593
+ demote(jid: string, userJid: string): Promise<void>;
458
594
  }
459
595
 
460
596
  declare class CommunityModule {
@@ -474,10 +610,97 @@ declare class CommunityModule {
474
610
  inviteCode(communityId: string): Promise<string | undefined>;
475
611
  revokeInvite(communityId: string): Promise<string | undefined>;
476
612
  acceptInvite(code: string): Promise<string | undefined>;
613
+ metadata(communityId: string): Promise<GroupMetadata>;
614
+ list(): Promise<GroupMetadata[]>;
615
+ inviteInfo(code: string): Promise<GroupMetadata>;
616
+ toggleEphemeral(communityId: string, seconds: number): Promise<void>;
617
+ setting(communityId: string, setting: 'announcement' | 'not_announcement'): Promise<void>;
618
+ memberAddMode(communityId: string, adminsOnly: boolean): Promise<void>;
619
+ joinApproval(communityId: string, enabled: boolean): Promise<void>;
620
+ }
621
+
622
+ declare class ProfileModule {
623
+ private readonly getSocket;
624
+ constructor(getSocket: () => DomainSocketLike | undefined);
625
+ protected requireSocket(): DomainSocketLike;
626
+ setName(name: string): Promise<void>;
627
+ setStatus(status: string): Promise<void>;
628
+ /** Set the profile/group picture. `jid` defaults to self; pass a group jid to set a group avatar. */
629
+ setPicture(jid: string, image: WAMediaUpload): Promise<void>;
630
+ removePicture(jid: string): Promise<void>;
631
+ getPicture(jid: string, hd?: boolean): Promise<string | null>;
632
+ getStatus(jid: string): Promise<unknown>;
633
+ }
634
+
635
+ type LastMessage = {
636
+ key: WAMessageKey;
637
+ messageTimestamp: number;
638
+ };
639
+ type LastMessageResolver = (jid: string) => Promise<LastMessage[]>;
640
+ declare class ChatModule {
641
+ private readonly getSocket;
642
+ private readonly resolveLast?;
643
+ constructor(getSocket: () => DomainSocketLike | undefined, resolveLast?: LastMessageResolver | undefined);
644
+ protected requireSocket(): DomainSocketLike;
645
+ private last;
646
+ archive(jid: string): Promise<void>;
647
+ unarchive(jid: string): Promise<void>;
648
+ pin(jid: string): Promise<void>;
649
+ unpin(jid: string): Promise<void>;
650
+ /** Mute for `durationMs` (e.g. 8h = 28_800_000). Omit to mute indefinitely. */
651
+ mute(jid: string, durationMs?: number): Promise<void>;
652
+ unmute(jid: string): Promise<void>;
653
+ markRead(jid: string): Promise<void>;
654
+ markUnread(jid: string): Promise<void>;
655
+ star(key: WAMessageKey, starred?: boolean): Promise<void>;
656
+ unstar(key: WAMessageKey): Promise<void>;
657
+ delete(jid: string): Promise<void>;
658
+ clear(jid: string): Promise<void>;
659
+ }
660
+
661
+ type ContactCheckResult = {
662
+ jid: string;
663
+ exists: boolean;
664
+ lid?: string;
665
+ };
666
+ declare class ContactModule {
667
+ private readonly getSocket;
668
+ private readonly normalize;
669
+ constructor(getSocket: () => DomainSocketLike | undefined, normalize: (input: string) => string);
670
+ protected requireSocket(): DomainSocketLike;
671
+ /** Check whether phone numbers are on WhatsApp; returns the resolved jid + existence per input. */
672
+ check(...numbers: string[]): Promise<ContactCheckResult[]>;
673
+ exists(number: string): Promise<boolean>;
674
+ save(jid: string, name: {
675
+ firstName?: string;
676
+ lastName?: string;
677
+ fullName?: string;
678
+ }): Promise<void>;
679
+ remove(jid: string): Promise<void>;
680
+ }
681
+
682
+ declare class BusinessModule {
683
+ private readonly getSocket;
684
+ constructor(getSocket: () => DomainSocketLike | undefined);
685
+ protected requireSocket(): DomainSocketLike;
686
+ profile(jid: string): Promise<unknown>;
687
+ catalog(opts?: {
688
+ jid?: string;
689
+ limit?: number;
690
+ cursor?: string;
691
+ }): Promise<unknown>;
692
+ collections(jid?: string, limit?: number): Promise<unknown>;
693
+ orderDetails(orderId: string, tokenBase64: string): Promise<unknown>;
694
+ createProduct(create: Record<string, unknown>): Promise<unknown>;
695
+ updateProduct(productId: string, update: Record<string, unknown>): Promise<unknown>;
696
+ deleteProduct(...productIds: string[]): Promise<{
697
+ deleted: number;
698
+ }>;
477
699
  }
478
700
 
479
701
  interface SenderInfo {
480
702
  jid: string;
703
+ deviceJid?: string;
481
704
  lid?: string;
482
705
  pn?: string;
483
706
  username?: string;
@@ -629,6 +852,7 @@ type NewsletterPayload = {
629
852
  update?: Record<string, unknown>;
630
853
  });
631
854
  type InboundEventMap = {
855
+ message: MessageContext;
632
856
  text: MessageContext;
633
857
  image: MessageContext;
634
858
  video: MessageContext;
@@ -660,7 +884,7 @@ type InboundEventMap = {
660
884
  };
661
885
  type InboundEventName = keyof InboundEventMap;
662
886
 
663
- type ChatType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'poll' | 'contact' | 'location' | 'live-location' | 'event' | 'buttons' | 'list' | 'interactive' | 'template' | 'unknown';
887
+ type ChatType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'poll' | 'contact' | 'location' | 'live-location' | 'event' | 'album' | 'group-invite' | 'product' | 'order' | 'payment' | 'buttons' | 'list' | 'interactive' | 'template' | 'unknown';
664
888
  type SenderDevice = 'unknown' | 'android' | 'ios' | 'web' | 'desktop' | string;
665
889
  interface CitationConfig {
666
890
  authors?: string[] | ((jid: string) => boolean | Promise<boolean>);
@@ -706,6 +930,54 @@ interface LocationMedia {
706
930
  speed: number | null;
707
931
  caption: string | null;
708
932
  }
933
+ interface AlbumMedia {
934
+ type: 'album';
935
+ expectedImageCount: number | null;
936
+ expectedVideoCount: number | null;
937
+ }
938
+ interface GroupInviteMedia {
939
+ type: 'group-invite';
940
+ groupId: string | null;
941
+ groupName: string | null;
942
+ inviteCode: string | null;
943
+ caption: string | null;
944
+ expiresAt: number | null;
945
+ }
946
+ interface ProductMedia {
947
+ type: 'product';
948
+ productId: string | null;
949
+ title: string | null;
950
+ description: string | null;
951
+ price: number | null;
952
+ currency: string | null;
953
+ retailerId: string | null;
954
+ url: string | null;
955
+ businessOwnerId: string | null;
956
+ }
957
+ interface OrderMedia {
958
+ type: 'order';
959
+ orderId: string | null;
960
+ title: string | null;
961
+ itemCount: number | null;
962
+ total: number | null;
963
+ currency: string | null;
964
+ status: string | null;
965
+ message: string | null;
966
+ }
967
+ interface PaymentMedia {
968
+ type: 'payment';
969
+ kind: 'request' | 'send' | 'invite';
970
+ amount: number | null;
971
+ currency: string | null;
972
+ note: string | null;
973
+ expiresAt: number | null;
974
+ }
975
+ interface LinkPreviewMedia {
976
+ type: 'link';
977
+ url: string | null;
978
+ title: string | null;
979
+ description: string | null;
980
+ }
709
981
  interface EventMedia {
710
982
  type: 'event';
711
983
  name: string | null;
@@ -756,9 +1028,10 @@ interface TemplateMedia {
756
1028
  text: string | null;
757
1029
  buttons: MessageButton[];
758
1030
  }
759
- type ContextMedia = MediaAttachment | PollMedia | ContactMedia | LocationMedia | EventMedia | ButtonsMedia | ListMedia | InteractiveMedia | TemplateMedia;
1031
+ type ContextMedia = MediaAttachment | PollMedia | ContactMedia | LocationMedia | EventMedia | AlbumMedia | GroupInviteMedia | ProductMedia | OrderMedia | PaymentMedia | LinkPreviewMedia | ButtonsMedia | ListMedia | InteractiveMedia | TemplateMedia;
760
1032
  interface MessageContext {
761
1033
  uniqueId: string;
1034
+ staticId: string;
762
1035
  channelId: string;
763
1036
  chatId: string;
764
1037
  chatType: ChatType;
@@ -827,6 +1100,7 @@ interface BuildContextInput {
827
1100
  isNewsletter: boolean;
828
1101
  prefixes: string[];
829
1102
  citationConfig?: CitationConfig;
1103
+ lidMap?: Map<string, string>;
830
1104
  resolveRoomName: () => Promise<string | null>;
831
1105
  resolveReceiverName: () => Promise<string | null>;
832
1106
  resolveReplied: () => Promise<MessageContext | null>;
@@ -834,6 +1108,11 @@ interface BuildContextInput {
834
1108
  react: (emoji: string) => Promise<WAMessageKey>;
835
1109
  media?: ContextMedia;
836
1110
  }
1111
+ declare const extractLinks: (text: string) => string[];
1112
+ declare const computeUniqueId: (key: WAMessageKey) => string;
1113
+ declare const computeStaticId: (roomId: string | null, senderId: string) => string;
1114
+ declare const epochSecondsToMs: (value: unknown) => number;
1115
+ declare const senderDeviceOf: (jid: string) => SenderDevice;
837
1116
  declare const buildMessageContext: (input: BuildContextInput) => MessageContext;
838
1117
 
839
1118
  type CommandPrefix = string | string[];
@@ -1278,6 +1557,10 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1278
1557
  private _privacy?;
1279
1558
  private _newsletter?;
1280
1559
  private _community?;
1560
+ private _profile?;
1561
+ private _chat?;
1562
+ private _contact?;
1563
+ private _business?;
1281
1564
  private commandRegistry?;
1282
1565
  private readonly commandMiddleware;
1283
1566
  private readonly commandPrefixes;
@@ -1299,6 +1582,10 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1299
1582
  get privacy(): PrivacyModule;
1300
1583
  get newsletter(): NewsletterModule;
1301
1584
  get community(): CommunityModule;
1585
+ get profile(): ProfileModule;
1586
+ get chat(): ChatModule;
1587
+ get contact(): ContactModule;
1588
+ get business(): BusinessModule;
1302
1589
  get presence(): PresenceModule;
1303
1590
  broadcast(jids: string[], build: (b: MessageBuilder<'init'>) => MessageBuilder<'content-set'>, options?: BroadcastOptions): Promise<BroadcastResult>;
1304
1591
  scheduleAt(date: Date, build: (b: MessageBuilder<'init'>) => MessageBuilder<'content-set'>): Promise<ScheduleHandle>;
@@ -1317,6 +1604,9 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1317
1604
  delete(key: WAMessageKey, opts?: DeleteOptions): Promise<void>;
1318
1605
  react(key: WAMessageKey, emoji: string): Promise<WAMessageKey>;
1319
1606
  forward(key: WAMessageKey, to: string): Promise<WAMessageKey>;
1607
+ pin(key: WAMessageKey, opts?: PinOptions): Promise<WAMessageKey>;
1608
+ unpin(key: WAMessageKey): Promise<WAMessageKey>;
1609
+ setDisappearing(to: string, seconds: number): Promise<void>;
1320
1610
  private resolveRecipient;
1321
1611
  private requireSocket;
1322
1612
  private attachEmitterLogger;
@@ -1326,6 +1616,11 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1326
1616
  private handleAuthExhausted;
1327
1617
  private handleOpen;
1328
1618
  private resolveMessageForResend;
1619
+ private lidMapping;
1620
+ /** Resolve a `@lid` JID to its phone-number JID (uses WhatsApp's LID mapping; may hit the network). */
1621
+ lidToPn(lid: string): Promise<string | null>;
1622
+ /** Resolve a phone-number JID to its `@lid` JID (uses WhatsApp's LID mapping; may hit the network). */
1623
+ pnToLid(pn: string): Promise<string | null>;
1329
1624
  private lookupQuoted;
1330
1625
  private handleClose;
1331
1626
  private rejectPendingConnect;
@@ -1683,6 +1978,26 @@ type ZaileysLogger = Logger$1;
1683
1978
  declare function createLogger(options?: CreateLoggerOptions): ZaileysLogger;
1684
1979
  declare function adoptLogger(maybe: Logger | Partial<Logger> | undefined, fallback?: Logger): Logger;
1685
1980
 
1981
+ declare const extractJid: (remoteJid: string | undefined | null) => string | null;
1982
+ declare const isLidJid: (jid: string) => boolean;
1983
+ declare const isPnJid: (jid: string) => boolean;
1984
+
1985
+ /** Digits-only phone number from a JID (e.g. `628xx@s.whatsapp.net` → `628xx`). Empty for groups/lids. */
1986
+ declare const jidToPhone: (jid: string) => string;
1987
+ /** Build a user JID from a phone number or digits (e.g. `+62 812` → `62812@s.whatsapp.net`). */
1988
+ declare const phoneToJid: (phone: string) => string;
1989
+
1990
+ type LoadedMedia = {
1991
+ buffer: Buffer;
1992
+ mime: string;
1993
+ size: number;
1994
+ };
1995
+ type LoadMediaOptions = {
1996
+ timeoutMs?: number;
1997
+ };
1998
+ declare const detectMimeFromBuffer: (buffer: Buffer) => Promise<string>;
1999
+ declare const loadMedia: (src: MediaSource, options?: LoadMediaOptions) => Promise<LoadedMedia>;
2000
+
1686
2001
  interface LIDMapping {
1687
2002
  readonly lid: string;
1688
2003
  readonly pn: string;
@@ -1856,4 +2171,4 @@ declare class Media {
1856
2171
  toBuffer(): Promise<Buffer>;
1857
2172
  }
1858
2173
 
1859
- export { type AddressButton, type AlbumItem, type AudioOptions, AudioProcessor, type AudioType, type AuthAttemptBlockReason, type AuthAttemptDecision, type AuthCredsStore, type AuthGuard, type AuthGuardOptions, type AuthStore, type AuthStoreBundle, type AuthStoreKey, type AuthStoreValue, type AutomationErrorCode, type AutomationSocketLike, type BaileysSocket, type BaileysSocketLike, type BottomSheetOptions, type BroadcastDeps, type BroadcastOptions, type BroadcastResult, BufferConverter, type BuildContextInput, type BuilderContext, type BuilderErrorCode, type BuilderSocketLike, type BuilderState, type ButtonClickPayload, type ButtonDef, type CacheableAuthStoreOptions, type CallBase, type CallButton, type CallPayload, type CancelReminderButton, type ChatType, type CitationConfig, type CitationPredicates, Client, type ClientEventMap, type ClientEventName, type ClientOptions, type CommandContext, type CommandDefinition, type CommandErrorCode, type CommandHandler, type CommandPrefix, CommandRegistry, CommunityModule, type ConnectionAuthType, type ConnectionEventHandler, type ConnectionEventMap, type ConnectionEventName, type ConnectionState, type ConnectionStateMachine, type ContextMedia, ConvexAuthStore, type ConvexAuthStoreOptions, ConvexMessageStore, type ConvexMessageStoreOptions, type CopyButton, type CreateLoggerOptions, type DeleteOptions, type DeletePayload, type DisconnectReasonDomain, type DispatcherDeps, type DispatcherHandle, type DocumentOptions, DocumentProcessor, type DomainErrorCode, type DomainSocketLike, EditBuilder, type EditPayload, FFMPEG_CONSTANTS, type FFmpegConfig, FFmpegProcessor, FileAuthStore, type FileAuthStoreOptions, type FileExtension, FileManager, type GroupJoinPayload, type GroupLeavePayload, GroupModule, type GroupParticipantInfo, type GroupUpdatePayload, type HistorySyncPayload, type ImageOptions, ImageProcessor, type InboundEventMap, type InboundEventName, type InteractiveButton, type LIDMapping, type LIDMappingUpdatePayload, type LimitedPayload, type LimitedTimeOfferOptions, type LinkedGroup, type ListOptions, type ListSection$1 as ListSection, type ListSelectPayload, type LocationOptions, type LocationRequestButton, type Logger, type LoggerLevel, Media, type MediaDescriptor, type MediaDownloadResult, type MediaInput, type MediaKind, type MediaSource, type MemberTagPayload, MemoryAuthStore, MemoryMessageStore, type MentionAllContext, type MentionContext, MessageBuilder, type MessageContext, type MessageStore, type MessageStoreListOptions, type Middleware, MimeValidator, NewsletterModule, type NewsletterPayload, type OperationCategory, type OperationGuard, type OperationGuardClock, type OperationGuardOptions, type PairingFlow, type PairingFlowOptions, type PairingFlowResult, type ParsedArgs, type ParticipantUpdateResult, type PollOptions, type PollVotePayload, PostgresAuthStore, type PostgresAuthStoreOptions, PostgresMessageStore, type PostgresMessageStoreOptions, type PresenceClock, PresenceModule, type PresencePayload, type PresenceThrottleOptions, type PrivacyConfig, PrivacyModule, type PrivacySettings, type QuotedRef, RateLimiter, type RateLimiterClock, type RateLimiterOptions, type ReactionPayload, type ReconnectDecision, type ReconnectOptions, type ReconnectStrategy, type ReconnectStrategyDeps, RedisAuthStore, type RedisAuthStoreOptions, RedisMessageStore, type RedisMessageStoreOptions, type ReminderButton, type ReplyButton, type ResolvedCommand, type RetryPolicy, SELF_ONLY_PROTOCOL_TYPES, type ScheduleHandle, type ScheduledContentSnapshot, type ScheduledJob, type ScheduledJobRecord, Scheduler, type SchedulerDeps, type SchedulerTimer, type SelfOnlyProtocolType, type SenderDevice, type SenderInfo, SqliteAuthStore, type SqliteAuthStoreOptions, SqliteMessageStore, type SqliteMessageStoreOptions, type StateTransitionListener, type StickerMetadataType, type StickerOptions, StickerProcessor, type StickerShapeType, type StoreErrorCode, TaskQueue, type TaskQueueClock, type TaskQueueOptions, type TemplateOptions, type TextOptions, TypedEventEmitter, type TypedEventEmitterOptions, type UpsertPayload, type UrlButton, type UsernameResolveSocketLike, type VideoOptions, VideoProcessor, type WAPresence, ZaileysAutomationError, ZaileysBuilderError, ZaileysCommandError, ZaileysDomainError, type ZaileysLogger, ZaileysStoreError, adoptLogger, attachCommandDispatcher, buildMessageContext, chunk, createAuthGuard, createConnectionStateMachine, createLogger, createOperationGuard, createPairingFlow, createReconnectStrategy, deleteMessage, detectFileType, dropSpoofedSelfOnly, ffmpegTransform, forwardMessage, generateId, initializeFFmpeg, isFatalDisconnect, isJid, isRateLimited, makeCacheableAuthStore, mapDisconnectReason, normalizePhoneNumber, parseCommand, printQrToTerminal, reactToMessage, renderQrInTerminal, resolveUsername, runBroadcast, runMiddleware, shouldClearAuth, shouldReconnect, signalKeyStoreFromAuthStore, validateE164 };
2174
+ export { type AddressButton, type AlbumItem, type AudioOptions, AudioProcessor, type AudioType, type AuthAttemptBlockReason, type AuthAttemptDecision, type AuthCredsStore, type AuthGuard, type AuthGuardOptions, type AuthStore, type AuthStoreBundle, type AuthStoreKey, type AuthStoreValue, type AutomationErrorCode, type AutomationSocketLike, type BaileysSocket, type BaileysSocketLike, type BottomSheetOptions, type BroadcastDeps, type BroadcastOptions, type BroadcastResult, BufferConverter, type BuildContextInput, type BuilderContext, type BuilderErrorCode, type BuilderSocketLike, type BuilderState, BusinessModule, type ButtonClickPayload, type ButtonDef, type CacheableAuthStoreOptions, type CallBase, type CallButton, type CallPayload, type CancelReminderButton, ChatModule, type ChatType, type CitationConfig, type CitationPredicates, Client, type ClientEventMap, type ClientEventName, type ClientOptions, type CommandContext, type CommandDefinition, type CommandErrorCode, type CommandHandler, type CommandPrefix, CommandRegistry, CommunityModule, type ConnectionAuthType, type ConnectionEventHandler, type ConnectionEventMap, type ConnectionEventName, type ConnectionState, type ConnectionStateMachine, ContactModule, type ContextMedia, ConvexAuthStore, type ConvexAuthStoreOptions, ConvexMessageStore, type ConvexMessageStoreOptions, type CopyButton, type CreateLoggerOptions, type DeleteOptions, type DeletePayload, type DisconnectReasonDomain, type DispatcherDeps, type DispatcherHandle, type DocumentOptions, DocumentProcessor, type DomainErrorCode, type DomainSocketLike, EditBuilder, type EditPayload, type EventOptions, FFMPEG_CONSTANTS, type FFmpegConfig, FFmpegProcessor, FileAuthStore, type FileAuthStoreOptions, type FileExtension, FileManager, type GroupInviteOptions, type GroupJoinPayload, type GroupLeavePayload, GroupModule, type GroupParticipantInfo, type GroupUpdatePayload, type HistorySyncPayload, type ImageOptions, ImageProcessor, type InboundEventMap, type InboundEventName, type InteractiveButton, type LIDMapping, type LIDMappingUpdatePayload, type LimitedPayload, type LimitedTimeOfferOptions, type LinkedGroup, type ListOptions, type ListSection$1 as ListSection, type ListSelectPayload, type LoadMediaOptions, type LoadedMedia, type LocationOptions, type LocationRequestButton, type Logger, type LoggerLevel, Media, type MediaDescriptor, type MediaDownloadResult, type MediaInput, type MediaKind, type MediaSource, type MemberTagPayload, MemoryAuthStore, MemoryMessageStore, type MentionAllContext, type MentionContext, MessageBuilder, type MessageContext, type MessageStore, type MessageStoreListOptions, type Middleware, MimeValidator, NewsletterModule, type NewsletterPayload, type OperationCategory, type OperationGuard, type OperationGuardClock, type OperationGuardOptions, type PairingFlow, type PairingFlowOptions, type PairingFlowResult, type ParsedArgs, type ParticipantUpdateResult, type PinOptions, type PollOptions, type PollVotePayload, PostgresAuthStore, type PostgresAuthStoreOptions, PostgresMessageStore, type PostgresMessageStoreOptions, type PresenceClock, PresenceModule, type PresencePayload, type PresenceThrottleOptions, type PrivacyConfig, PrivacyModule, type PrivacySettings, type ProductOptions, ProfileModule, type QuotedRef, RateLimiter, type RateLimiterClock, type RateLimiterOptions, type ReactionPayload, type ReconnectDecision, type ReconnectOptions, type ReconnectStrategy, type ReconnectStrategyDeps, RedisAuthStore, type RedisAuthStoreOptions, RedisMessageStore, type RedisMessageStoreOptions, type ReminderButton, type ReplyButton, type ResolvedCommand, type RetryPolicy, SELF_ONLY_PROTOCOL_TYPES, type ScheduleHandle, type ScheduledContentSnapshot, type ScheduledJob, type ScheduledJobRecord, Scheduler, type SchedulerDeps, type SchedulerTimer, type SelfOnlyProtocolType, type SenderDevice, type SenderInfo, SqliteAuthStore, type SqliteAuthStoreOptions, SqliteMessageStore, type SqliteMessageStoreOptions, type StateTransitionListener, type StickerMetadataType, type StickerOptions, StickerProcessor, type StickerShapeType, type StoreErrorCode, TaskQueue, type TaskQueueClock, type TaskQueueOptions, type TemplateOptions, type TextOptions, TypedEventEmitter, type TypedEventEmitterOptions, type UpsertPayload, type UrlButton, type UsernameResolveSocketLike, type VideoNoteOptions, type VideoOptions, VideoProcessor, type WAPresence, ZaileysAutomationError, ZaileysBuilderError, ZaileysCommandError, ZaileysDomainError, type ZaileysLogger, ZaileysStoreError, adoptLogger, attachCommandDispatcher, buildMessageContext, chunk, computeStaticId, computeUniqueId, createAuthGuard, createConnectionStateMachine, createLogger, createOperationGuard, createPairingFlow, createReconnectStrategy, deleteMessage, detectFileType, detectMimeFromBuffer, dropSpoofedSelfOnly, epochSecondsToMs, extractLinks, ffmpegTransform, forwardMessage, generateId, initializeFFmpeg, isFatalDisconnect, isJid, isLidJid, isPnJid, isRateLimited, jidToPhone, loadMedia, makeCacheableAuthStore, mapDisconnectReason, extractJid as normalizeJid, normalizePhoneNumber, parseCommand, phoneToJid, pinMessage, printQrToTerminal, reactToMessage, renderQrInTerminal, resolveUsername, runBroadcast, runMiddleware, senderDeviceOf, shouldClearAuth, shouldReconnect, signalKeyStoreFromAuthStore, validateE164 };