@zeronexcode/baileys 7.0.0-zeronex.5 → 7.0.0-zeronex.7

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
@@ -308,6 +308,982 @@ await sock.sendMessage(jid, {
308
308
 
309
309
  ---
310
310
 
311
+ ## Interactive Message (Single Select)
312
+
313
+ ZeroneXCode Baileys adds high-level support for WhatsApp Native Flow interactive messages using `single_select`.
314
+
315
+ Basic example:
316
+
317
+ ```ts
318
+ await sock.sendMessage(jid, {
319
+ interactiveMessage: {
320
+ title: 'ZeroneXCode Bot',
321
+ header: '🍃 Main Menu',
322
+ footer: 'Powered by ZeroneXCode',
323
+ buttons: [
324
+ {
325
+ name: 'single_select',
326
+ buttonParamsJson: JSON.stringify({
327
+ title: '🍃 Menu Utama',
328
+ sections: [
329
+ {
330
+ title: 'Pilih Menu',
331
+ rows: [
332
+ {
333
+ title: 'Ping',
334
+ description: 'Cek speed bot',
335
+ id: '.ping'
336
+ },
337
+ {
338
+ title: 'Owner',
339
+ description: 'Lihat owner bot',
340
+ id: '.owner'
341
+ }
342
+ ]
343
+ }
344
+ ]
345
+ })
346
+ }
347
+ ]
348
+ }
349
+ })
350
+ ```
351
+
352
+ With quoted message:
353
+
354
+ ```ts
355
+ await sock.sendMessage(
356
+ jid,
357
+ {
358
+ interactiveMessage: {
359
+ title: 'ZeroneXCode Bot',
360
+ header: '🍃 Main Menu',
361
+ footer: 'Powered by ZeroneXCode',
362
+ buttons: [
363
+ {
364
+ name: 'single_select',
365
+ buttonParamsJson: JSON.stringify({
366
+ title: '🍃 Menu Utama',
367
+ sections: [
368
+ {
369
+ title: 'Pilih Menu',
370
+ rows: [
371
+ {
372
+ title: 'Ping',
373
+ description: 'Cek speed bot',
374
+ id: '.ping'
375
+ }
376
+ ]
377
+ }
378
+ ]
379
+ })
380
+ }
381
+ ]
382
+ }
383
+ },
384
+ { quoted: msg }
385
+ )
386
+ ```
387
+
388
+ Interactive messages can also be wrapped as view-once messages:
389
+
390
+ ```ts
391
+ await sock.sendMessage(jid, {
392
+ viewOnce: true,
393
+ interactiveMessage: {
394
+ title: 'ZeroneXCode Bot',
395
+ header: '🍃 Main Menu',
396
+ footer: 'Powered by ZeroneXCode',
397
+ buttons: [
398
+ {
399
+ name: 'single_select',
400
+ buttonParamsJson: JSON.stringify({
401
+ title: 'Pilih Menu',
402
+ sections: [
403
+ {
404
+ title: 'Main',
405
+ rows: [
406
+ {
407
+ title: 'Ping',
408
+ description: 'Cek speed bot',
409
+ id: '.ping'
410
+ }
411
+ ]
412
+ }
413
+ ]
414
+ })
415
+ }
416
+ ]
417
+ }
418
+ })
419
+ ```
420
+
421
+ > [!NOTE]
422
+ > The current ZeroneXCode high-level interactive helper intentionally supports `single_select` only. Other Native Flow button types are not enabled by this helper yet.
423
+
424
+ ---
425
+
426
+
427
+ # Extended Message API
428
+
429
+ This section documents ZeroneXCode extended message helpers and advanced WhatsApp message payloads.
430
+
431
+ ## Album Messages
432
+
433
+ ```ts
434
+ await sock.sendMessage(jid, {
435
+ albumMessage: [
436
+ { image: { url: './photo1.jpg' }, caption: 'First' },
437
+ { image: { url: './photo2.jpg' }, caption: 'Second' },
438
+ { video: { url: './clip.mp4' }, caption: 'Video' }
439
+ ]
440
+ })
441
+ ```
442
+
443
+ > [!NOTE]
444
+ > Album helpers should set `expectedImageCount` and `expectedVideoCount` from the supplied media entries.
445
+
446
+ ---
447
+
448
+ # AI Rich Response Messages
449
+
450
+ AI Rich Response messages are designed to render structured content such as tables, lists, code blocks, rich text, and inline links through WhatsApp rich-response message primitives.
451
+
452
+ ## Table V1
453
+
454
+ ```ts
455
+ await sock.sendTable(
456
+ jid,
457
+ 'Java vs JavaScript',
458
+ ['Feature', 'Java', 'JavaScript'],
459
+ [
460
+ ['Type', 'Compiled', 'Interpreted'],
461
+ ['Typing', 'Static', 'Dynamic'],
462
+ ['Main Use', 'Enterprise', 'Web, Full-stack']
463
+ ],
464
+ quoted,
465
+ {
466
+ headerText: 'Comparison:',
467
+ footer: 'Powered by ZeroneXCode'
468
+ }
469
+ )
470
+ ```
471
+
472
+ ## List
473
+
474
+ ```ts
475
+ await sock.sendList(
476
+ jid,
477
+ 'Bot Info',
478
+ [
479
+ ['Name', 'ZeroneXCode Bot'],
480
+ ['Version', '1.0.0'],
481
+ ['Developer', 'ZeroneXCode']
482
+ ],
483
+ quoted,
484
+ {
485
+ footer: '© ZeroneXCode'
486
+ }
487
+ )
488
+ ```
489
+
490
+ ## Code Block V1
491
+
492
+ ```ts
493
+ await sock.sendCodeBlock(
494
+ jid,
495
+ `const greeting = "Hello World"
496
+ function sayHello(name) {
497
+ return greeting + " " + name
498
+ }
499
+ sayHello("ZeroneXCode")`,
500
+ quoted,
501
+ {
502
+ language: 'javascript',
503
+ title: 'Example Code',
504
+ footer: 'Powered by ZeroneXCode'
505
+ }
506
+ )
507
+ ```
508
+
509
+ Supported V1 languages:
510
+
511
+ - `javascript`
512
+ - `typescript`
513
+ - `python`
514
+
515
+ ## Table V2 (Unified Response)
516
+
517
+ The V2 table uses a unified-response structure with `GenATableUXPrimitive` and base64-encoded data.
518
+
519
+ Features:
520
+
521
+ - string-based table input
522
+ - `|` or `,` column delimiters
523
+ - `;;` row delimiter
524
+ - unified-response sections
525
+ - `GenATableUXPrimitive`
526
+ - `GenAIMarkdownTextUXPrimitive`
527
+ - dual row output for submessages and sections
528
+ - extended `contextInfo`
529
+
530
+ ```ts
531
+ await sock.sendTableV2(
532
+ jid,
533
+ [
534
+ 'Java vs JavaScript',
535
+ 'Feature | Java | JavaScript',
536
+ 'Type | Compiled | Interpreted;;Typing | Static | Dynamic;;Main Use | Enterprise | Web, Full-stack'
537
+ ],
538
+ quoted,
539
+ {
540
+ headerText: 'Comparison:',
541
+ text: 'Here is a comparison table:',
542
+ footer: 'Powered by ZeroneXCode'
543
+ }
544
+ )
545
+ ```
546
+
547
+ Input format:
548
+
549
+ - `table[0]` — title
550
+ - `table[1]` — header row
551
+ - `table[2+]` — data rows
552
+ - columns can use `|` or `,`
553
+ - multiple rows can use `;;`
554
+
555
+ V2 options:
556
+
557
+ | Option | Type | Default | Description |
558
+ |---|---|---|---|
559
+ | `title` | `string` | — | Title if `headerText` is not set |
560
+ | `headerText` | `string` | — | Text before the table |
561
+ | `text` | `string` | — | Markdown text section |
562
+ | `footer` | `string` | — | Footer text |
563
+
564
+ ## Code Block V2 (Unified Response)
565
+
566
+ ```ts
567
+ await sock.sendCodeBlockV2(
568
+ jid,
569
+ `package main
570
+
571
+ import "fmt"
572
+
573
+ func main() {
574
+ fmt.Println("Hello, World!")
575
+ }`,
576
+ quoted,
577
+ {
578
+ language: 'go',
579
+ title: 'Go Example',
580
+ text: 'Here is a Go code snippet:',
581
+ footer: 'Powered by ZeroneXCode'
582
+ }
583
+ )
584
+ ```
585
+
586
+ Supported V2 language families:
587
+
588
+ | Language Key | Aliases |
589
+ |---|---|
590
+ | `javascript` | `js`, `typescript`, `ts` |
591
+ | `python` | `py` |
592
+ | `go` | `golang` |
593
+ | `lua` | — |
594
+ | `bash` | `sh`, `shell` |
595
+
596
+ V2 options:
597
+
598
+ | Option | Type | Default | Description |
599
+ |---|---|---|---|
600
+ | `language` | `string` | `javascript` | Syntax-highlighting language |
601
+ | `title` | `string` | — | Title above code |
602
+ | `text` | `string` | — | Markdown text section |
603
+ | `footer` | `string` | — | Footer text |
604
+
605
+ Token types:
606
+
607
+ | Code | V1 Name | V2 Name | Description |
608
+ |---|---|---|---|
609
+ | 0 | `DEFAULT` | `DEFAULT` | Normal text, whitespace, operators |
610
+ | 1 | `KEYWORD` | `KEYWORD` | Language keywords |
611
+ | 2 | `METHOD` | `METHOD` | Function or method calls |
612
+ | 3 | `STRING` | `STR` | String literals |
613
+ | 4 | `NUMBER` | `NUMBER` | Numeric values |
614
+ | 5 | `COMMENT` | `COMMENT` | Comments |
615
+
616
+ ---
617
+
618
+ # Link Message
619
+
620
+ ## Inline Embed Links
621
+
622
+ ```ts
623
+ await sock.sendLink(
624
+ jid,
625
+ 'Upload results:\n✅ Freeimage\n🔗 Klik: {{IE_0}}link disini{{/IE_0}}\n✅ Yardsansh\n🔗 Klik: {{IE_1}}link disini{{/IE_1}}',
626
+ [
627
+ 'https://example.com/upload1',
628
+ 'https://example.com/upload2'
629
+ ],
630
+ quoted,
631
+ {
632
+ headerText: '📁 Media Uploader',
633
+ footer: '✨ Selesai!',
634
+ botJid: '867051314767696@bot',
635
+ forwardingScore: 3,
636
+ citations: [
637
+ {
638
+ sourceTitle: 'Freeimage',
639
+ citationNumber: 1,
640
+ faviconCdnUrl: 'https://cdn.example.com/favicon.ico'
641
+ },
642
+ {
643
+ sourceTitle: 'Yardsansh',
644
+ citationNumber: 2
645
+ }
646
+ ],
647
+ proofs: [
648
+ {
649
+ version: 1,
650
+ useCase: 1,
651
+ signature: 'base64signature==',
652
+ certificateChain: ['base64cert1', 'base64cert2']
653
+ }
654
+ ]
655
+ }
656
+ )
657
+ ```
658
+
659
+ Link options:
660
+
661
+ | Option | Type | Default | Description |
662
+ |---|---|---|---|
663
+ | `headerText` | `string` | — | Text shown before link content |
664
+ | `footer` | `string` | — | Footer text |
665
+ | `botJid` | `string` | `867051314767696@bot` | Bot JID for forwarded AI context |
666
+ | `forwardingScore` | `number` | `3` | Forward score |
667
+ | `citations` | `Citation[]` | `[]` | Citation metadata |
668
+ | `proofs` | `Proof[]` | `[]` | Verification proof entries |
669
+
670
+ Citation object:
671
+
672
+ | Field | Type | Description |
673
+ |---|---|---|
674
+ | `sourceQuery` | `string` | Source query text |
675
+ | `faviconCdnUrl` | `string` | CDN URL for favicon |
676
+ | `citationNumber` | `number` | Citation index |
677
+ | `sourceTitle` | `string` | Source title |
678
+
679
+ Proof object:
680
+
681
+ | Field | Type | Description |
682
+ |---|---|---|
683
+ | `version` | `number` | Proof version |
684
+ | `useCase` | `number` | Use-case identifier |
685
+ | `signature` | `string` | Base64 signature |
686
+ | `certificateChain` | `string[]` | Base64 certificate chain |
687
+
688
+ ## Link V2
689
+
690
+ ```ts
691
+ await sock.sendLinkV2(
692
+ jid,
693
+ 'Search results:\n- {{IE_0}}Official docs{{/IE_0}}\n- {{IE_1}}GitHub repo{{/IE_1}}',
694
+ [
695
+ {
696
+ url: 'https://www.npmjs.com/package/@zeronexcode/baileys',
697
+ displayName: 'Official package',
698
+ sourceDisplayName: 'npm',
699
+ sourceSubtitle: 'package registry'
700
+ },
701
+ {
702
+ url: 'https://github.com/XzeroOffc/baileys',
703
+ displayName: 'GitHub repo',
704
+ sourceDisplayName: 'github',
705
+ sourceSubtitle: 'source hosting'
706
+ }
707
+ ],
708
+ quoted,
709
+ {
710
+ headerText: '@zeronexcode/baileys',
711
+ footer: 'Reference links',
712
+ searchEngine: 'MAME'
713
+ }
714
+ )
715
+ ```
716
+
717
+ ---
718
+
719
+ # Other Advanced Message Types
720
+
721
+ ## Payment Request
722
+
723
+ ```ts
724
+ await sock.sendMessage(jid, {
725
+ requestPaymentMessage: {
726
+ amount: 50000,
727
+ currency: 'IDR',
728
+ note: 'Payment for order #123',
729
+ from: '628xxx@s.whatsapp.net'
730
+ }
731
+ })
732
+ ```
733
+
734
+ ## Event
735
+
736
+ ```ts
737
+ await sock.sendMessage(jid, {
738
+ eventMessage: {
739
+ name: 'Community Meetup',
740
+ description: 'Join us for the monthly meetup!',
741
+ startTime: Date.now() + 86400000,
742
+ endTime: Date.now() + 90000000,
743
+ location: {
744
+ name: 'Jakarta',
745
+ degreesLatitude: -6.2,
746
+ degreesLongitude: 106.8
747
+ }
748
+ }
749
+ })
750
+ ```
751
+
752
+ ## Poll Result
753
+
754
+ ```ts
755
+ await sock.sendMessage(jid, {
756
+ pollResultMessage: {
757
+ name: 'Favorite Color?',
758
+ pollVotes: [
759
+ { optionName: 'Red', optionVoteCount: 42 },
760
+ { optionName: 'Blue', optionVoteCount: 38 },
761
+ { optionName: 'Green', optionVoteCount: 25 }
762
+ ]
763
+ }
764
+ })
765
+ ```
766
+
767
+ ## Status with Mentions
768
+
769
+ ```ts
770
+ await sock.sendStatusMention(
771
+ { text: 'Big update coming!' },
772
+ [
773
+ '628xxx@s.whatsapp.net',
774
+ 'groupid@g.us'
775
+ ]
776
+ )
777
+ ```
778
+
779
+ ## Product Message
780
+
781
+ ```ts
782
+ await sock.sendMessage(jid, {
783
+ productMessage: {
784
+ title: 'Wireless Headphones',
785
+ description: 'High quality bluetooth headphones',
786
+ productId: 'WH-001',
787
+ retailerId: 'zeronex-shop',
788
+ url: 'https://example.com/product',
789
+ priceAmount1000: 299000,
790
+ currencyCode: 'IDR',
791
+ thumbnail: { url: 'https://example.com/product.jpg' },
792
+ body: 'Check out this product!',
793
+ footer: 'ZeroneXCode Shop'
794
+ }
795
+ })
796
+ ```
797
+
798
+ ## Mixed Rich Message
799
+
800
+ ```ts
801
+ await sock.sendRichMessage(
802
+ jid,
803
+ [
804
+ {
805
+ messageType: 2,
806
+ messageText: 'Here is some info:'
807
+ },
808
+ {
809
+ messageType: 4,
810
+ tableMetadata: {
811
+ title: 'Stats',
812
+ rows: [
813
+ { items: ['Metric', 'Value'], isHeading: true },
814
+ { items: ['Users', '1000'] },
815
+ { items: ['Uptime', '99.9%'] }
816
+ ]
817
+ }
818
+ },
819
+ {
820
+ messageType: 2,
821
+ messageText: 'And some code:'
822
+ },
823
+ {
824
+ messageType: 5,
825
+ codeMetadata: {
826
+ codeLanguage: 'javascript',
827
+ codeBlocks: [
828
+ {
829
+ highlightType: 0,
830
+ codeContent: 'console.log("OK")'
831
+ }
832
+ ]
833
+ }
834
+ }
835
+ ],
836
+ quoted
837
+ )
838
+ ```
839
+
840
+ SubMessage types:
841
+
842
+ | messageType | Name | Payload Field |
843
+ |---|---|---|
844
+ | 0 | UNKNOWN | — |
845
+ | 1 | GRID_IMAGE | `gridImageMetadata` |
846
+ | 2 | TEXT | `messageText` |
847
+ | 3 | INLINE_IMAGE | `imageMetadata` |
848
+ | 4 | TABLE | `tableMetadata` |
849
+ | 5 | CODE | `codeMetadata` |
850
+ | 6 | DYNAMIC | `dynamicMetadata` |
851
+ | 7 | MAP | `mapMetadata` |
852
+ | 8 | LATEX | `latexMetadata` |
853
+ | 9 | CONTENT_ITEMS | `contentItemsMetadata` |
854
+
855
+ ---
856
+
857
+ # Newsletter Methods
858
+
859
+ ```ts
860
+ const info = await sock.cekIDSaluran('https://whatsapp.com/channel/xxxxx')
861
+ console.log(info.name, info.subscribers)
862
+
863
+ await sock.newsletterMultipleFollow('id1@newsletter id2@newsletter')
864
+
865
+ const channels = await sock.newsletterFetchAllSubscribe()
866
+
867
+ await sock.newsletterAction('id@newsletter', 'follow')
868
+
869
+ const nl = await sock.newsletterCreate('My Channel', 'Description')
870
+
871
+ await sock.newsletterUpdate('id@newsletter', {
872
+ name: 'New Name'
873
+ })
874
+
875
+ const { subscribers } = await sock.newsletterSubscribers('id@newsletter')
876
+
877
+ const meta = await sock.newsletterMetadata('jid', 'id@newsletter')
878
+
879
+ await sock.newsletterFollow('id@newsletter')
880
+ await sock.newsletterUnfollow('id@newsletter')
881
+ await sock.newsletterMute('id@newsletter')
882
+ await sock.newsletterUnmute('id@newsletter')
883
+
884
+ await sock.newsletterUpdateName('id@newsletter', 'New Name')
885
+ await sock.newsletterUpdateDescription('id@newsletter', 'New Desc')
886
+ await sock.newsletterUpdatePicture('id@newsletter', mediaUpload)
887
+ await sock.newsletterRemovePicture('id@newsletter')
888
+
889
+ await sock.newsletterReactMessage('id@newsletter', serverId, '👍')
890
+
891
+ const msgs = await sock.newsletterFetchMessages('id@newsletter', 50, 0, 0)
892
+
893
+ const count = await sock.newsletterAdminCount('id@newsletter')
894
+ await sock.newsletterChangeOwner('id@newsletter', newOwnerJid)
895
+ await sock.newsletterDemote('id@newsletter', userJid)
896
+ await sock.newsletterDelete('id@newsletter')
897
+ ```
898
+
899
+ ---
900
+
901
+ # Extended Group Methods
902
+
903
+ ```ts
904
+ const meta = await sock.groupMetadata('id@g.us')
905
+
906
+ const group = await sock.groupCreate(
907
+ 'My Group',
908
+ ['628xxx@s.whatsapp.net']
909
+ )
910
+
911
+ await sock.groupLeave('id@g.us')
912
+
913
+ await sock.groupUpdateSubject('id@g.us', 'New Subject')
914
+ await sock.groupUpdateDescription('id@g.us', 'New Description')
915
+
916
+ await sock.groupParticipantsUpdate(
917
+ 'id@g.us',
918
+ ['628xxx@s.whatsapp.net'],
919
+ 'add'
920
+ )
921
+
922
+ const requests = await sock.groupRequestParticipantsList('id@g.us')
923
+
924
+ await sock.groupRequestParticipantsUpdate(
925
+ 'id@g.us',
926
+ ['628xxx@s.whatsapp.net'],
927
+ 'approve'
928
+ )
929
+
930
+ const code = await sock.groupInviteCode('id@g.us')
931
+ await sock.groupRevokeInvite('id@g.us')
932
+ await sock.groupAcceptInvite('ABCDE12345')
933
+ const inviteInfo = await sock.groupGetInviteInfo('ABCDE12345')
934
+
935
+ await sock.groupSettingUpdate('id@g.us', 'announcement')
936
+ await sock.groupSettingUpdate('id@g.us', 'locked')
937
+
938
+ await sock.groupMemberAddMode('id@g.us', 'admin_add')
939
+ await sock.groupJoinApprovalMode('id@g.us', 'on')
940
+
941
+ await sock.groupToggleEphemeral('id@g.us', 86400)
942
+
943
+ const groups = await sock.groupFetchAllParticipating()
944
+
945
+ await sock.updateMemberLabel('id@g.us', 'VIP')
946
+ ```
947
+
948
+ ---
949
+
950
+ # Community Methods
951
+
952
+ ```ts
953
+ const meta = await sock.communityMetadata('communityid@g.us')
954
+
955
+ const community = await sock.communityCreate(
956
+ 'ZeroneXCode Community',
957
+ 'Community description'
958
+ )
959
+
960
+ const subgroup = await sock.communityCreateGroup(
961
+ 'Announcements',
962
+ ['628xxx@s.whatsapp.net'],
963
+ 'communityid@g.us'
964
+ )
965
+
966
+ await sock.communityLinkGroup('groupid@g.us', 'communityid@g.us')
967
+ await sock.communityUnlinkGroup('groupid@g.us', 'communityid@g.us')
968
+
969
+ const linked = await sock.communityFetchLinkedGroups('communityid@g.us')
970
+
971
+ const code = await sock.communityInviteCode('communityid@g.us')
972
+ await sock.communityRevokeInvite('communityid@g.us')
973
+ await sock.communityAcceptInvite(code)
974
+ const inviteInfo = await sock.communityGetInviteInfo(code)
975
+
976
+ const requests = await sock.communityRequestParticipantsList('communityid@g.us')
977
+
978
+ await sock.communityRequestParticipantsUpdate(
979
+ 'communityid@g.us',
980
+ ['628xxx@s.whatsapp.net'],
981
+ 'approve'
982
+ )
983
+
984
+ await sock.communityParticipantsUpdate(
985
+ 'communityid@g.us',
986
+ ['628xxx@s.whatsapp.net'],
987
+ 'add'
988
+ )
989
+
990
+ await sock.communityUpdateSubject('communityid@g.us', 'New Subject')
991
+ await sock.communityUpdateDescription('communityid@g.us', 'New Description')
992
+ await sock.communityToggleEphemeral('communityid@g.us', 86400)
993
+ await sock.communitySettingUpdate('communityid@g.us', 'announcement')
994
+ await sock.communityMemberAddMode('communityid@g.us', 'admin_add')
995
+ await sock.communityJoinApprovalMode('communityid@g.us', 'on')
996
+
997
+ await sock.communityLeave('communityid@g.us')
998
+ const communities = await sock.communityFetchAllParticipating()
999
+ ```
1000
+
1001
+ ---
1002
+
1003
+ # Business Methods
1004
+
1005
+ ```ts
1006
+ const { products, nextPageCursor } = await sock.getCatalog({
1007
+ jid: '628xxx@s.whatsapp.net',
1008
+ limit: 10
1009
+ })
1010
+
1011
+ const { collections } = await sock.getCollections(
1012
+ '628xxx@s.whatsapp.net',
1013
+ 10
1014
+ )
1015
+
1016
+ const order = await sock.getOrderDetails(orderId, tokenBase64)
1017
+
1018
+ const product = await sock.productCreate({
1019
+ name: 'Premium Package',
1020
+ description: 'Official premium plan',
1021
+ price: 150000,
1022
+ currency: 'IDR',
1023
+ originCountryCode: 'ID',
1024
+ images: [mediaUpload]
1025
+ })
1026
+
1027
+ await sock.productUpdate(product.id, {
1028
+ name: 'Premium Package Plus',
1029
+ description: 'Official premium plan plus',
1030
+ price: 175000,
1031
+ currency: 'IDR',
1032
+ images: [mediaUpload]
1033
+ })
1034
+
1035
+ await sock.productDelete([product.id])
1036
+
1037
+ await sock.updateBusinessProfile({
1038
+ address: 'Jakarta, Indonesia',
1039
+ description: 'Official store',
1040
+ websites: ['https://example.com'],
1041
+ email: 'hello@example.com',
1042
+ hours: {
1043
+ timezone: 'Asia/Jakarta',
1044
+ days: [
1045
+ {
1046
+ day: 'mon',
1047
+ mode: 'open_24h'
1048
+ }
1049
+ ]
1050
+ }
1051
+ })
1052
+
1053
+ await sock.updateBussinesProfile({
1054
+ description: 'Legacy alias still works'
1055
+ })
1056
+
1057
+ await sock.updateCoverPhoto(mediaUpload)
1058
+ await sock.removeCoverPhoto(coverId)
1059
+
1060
+ await sock.addOrEditQuickReply({
1061
+ shortcut: 'hello',
1062
+ message: 'Hello from business account'
1063
+ })
1064
+
1065
+ await sock.removeQuickReply(timestamp)
1066
+ ```
1067
+
1068
+ ---
1069
+
1070
+ # Chat & Profile Methods
1071
+
1072
+ ```ts
1073
+ const url = await sock.profilePictureUrl(jid, 'image')
1074
+ await sock.updateProfilePicture(jid, mediaUpload)
1075
+ await sock.removeProfilePicture(jid)
1076
+
1077
+ await sock.updateProfileName('My Name')
1078
+ await sock.updateProfileStatus('Available')
1079
+
1080
+ await sock.sendPresenceUpdate('available', jid)
1081
+ await sock.presenceSubscribe(jid)
1082
+
1083
+ await sock.readMessages([msg.key])
1084
+ await sock.sendReceipt(jid, participant, [msgId], 'read')
1085
+
1086
+ await sock.updateBlockStatus(jid, 'block')
1087
+ await sock.updateBlockStatus(jid, 'unblock')
1088
+
1089
+ const list = await sock.fetchBlocklist()
1090
+
1091
+ await sock.chatModify(
1092
+ {
1093
+ archive: true,
1094
+ lastMessageOrig: msg,
1095
+ lastMessage: msg
1096
+ },
1097
+ jid
1098
+ )
1099
+
1100
+ await sock.star(
1101
+ jid,
1102
+ [{ id: msgId, fromMe: true }],
1103
+ true
1104
+ )
1105
+
1106
+ await sock.addOrEditContact(jid, {
1107
+ displayName: 'Name'
1108
+ })
1109
+
1110
+ await sock.removeContact(jid)
1111
+
1112
+ await sock.addChatLabel(jid, labelId)
1113
+ await sock.removeChatLabel(jid, labelId)
1114
+ await sock.addMessageLabel(jid, messageId, labelId)
1115
+
1116
+ await sock.resyncAppState(
1117
+ ['regular', 'critical_block'],
1118
+ true
1119
+ )
1120
+
1121
+ const biz = await sock.getBusinessProfile(jid)
1122
+ ```
1123
+
1124
+ ---
1125
+
1126
+ # Privacy Settings
1127
+
1128
+ ```ts
1129
+ await sock.updateLastSeenPrivacy('all')
1130
+ await sock.updateOnlinePrivacy('all')
1131
+ await sock.updateProfilePicturePrivacy('contacts')
1132
+ await sock.updateStatusPrivacy('contacts')
1133
+ await sock.updateReadReceiptsPrivacy('all')
1134
+ await sock.updateGroupsAddPrivacy('all')
1135
+ await sock.updateMessagesPrivacy('all')
1136
+ await sock.updateCallPrivacy('everyone')
1137
+ await sock.updateDefaultDisappearingMode(86400)
1138
+ await sock.updateDisableLinkPreviewsPrivacy(true)
1139
+ ```
1140
+
1141
+ ---
1142
+
1143
+ # Event Reference
1144
+
1145
+ ```ts
1146
+ sock.ev.on('connection.update', ({ connection, lastDisconnect, qr, isNewLogin, receivedPendingNotifications, isOnline }) => {})
1147
+ sock.ev.on('creds.update', update => {})
1148
+ sock.ev.on('messaging-history.set', ({ chats, contacts, messages, isLatest }) => {})
1149
+ sock.ev.on('chats.upsert', chats => {})
1150
+ sock.ev.on('chats.update', updates => {})
1151
+ sock.ev.on('chats.delete', jids => {})
1152
+ sock.ev.on('contacts.upsert', contacts => {})
1153
+ sock.ev.on('contacts.update', updates => {})
1154
+ sock.ev.on('messages.upsert', ({ messages, type }) => {})
1155
+ sock.ev.on('messages.update', updates => {})
1156
+ sock.ev.on('messages.delete', keys => {})
1157
+ sock.ev.on('messages.reaction', reactions => {})
1158
+ sock.ev.on('message-receipt.update', updates => {})
1159
+ sock.ev.on('groups.update', updates => {})
1160
+ sock.ev.on('group-participants.update', update => {})
1161
+ sock.ev.on('group.join-request', update => {})
1162
+ sock.ev.on('call', calls => {})
1163
+ sock.ev.on('labels.edit', label => {})
1164
+ sock.ev.on('labels.associations', ({ associated, label, type }) => {})
1165
+ sock.ev.on('newsletter.update', updates => {})
1166
+ sock.ev.on('newsletter.follow', jid => {})
1167
+ sock.ev.on('newsletter.unfollow', jid => {})
1168
+ sock.ev.on('settings.update', settings => {})
1169
+ ```
1170
+
1171
+ ---
1172
+
1173
+ # Utility Exports
1174
+
1175
+ ```ts
1176
+ import {
1177
+ useMultiFileAuthState,
1178
+ makeCacheableSignalKeyStore,
1179
+ initAuthCreds,
1180
+ BufferJSON,
1181
+ fetchLatestBaileysVersion,
1182
+
1183
+ tokenizeCode,
1184
+ tokenizeCodeV2,
1185
+ CodeHighlightType,
1186
+ RichSubMessageType,
1187
+
1188
+ generateTableContent,
1189
+ generateTableContentV2,
1190
+ toTableMetadataV2,
1191
+ generateListContent,
1192
+ generateCodeBlockContent,
1193
+ generateCodeBlockContentV2,
1194
+ generateLinkContent,
1195
+ generateLinkContentV2,
1196
+ generateRichMessageContent,
1197
+ generateLatexContent,
1198
+ generateLatexImageContent,
1199
+ generateLatexInlineImageContent,
1200
+ generateUnifiedResponseContent,
1201
+ captureUnifiedResponse,
1202
+
1203
+ buildRichContextInfo,
1204
+ buildBotForwardedMessage,
1205
+
1206
+ makeStickerPack,
1207
+
1208
+ JS_KEYWORDS,
1209
+ PYTHON_KEYWORDS,
1210
+ GO_KEYWORDS,
1211
+ LUA_KEYWORDS,
1212
+ BASH_KEYWORDS,
1213
+ LANGUAGE_KEYWORDS,
1214
+
1215
+ Curve,
1216
+ signedKeyPair,
1217
+ aesEncryptGCM,
1218
+ aesDecryptGCM,
1219
+
1220
+ jidEncode,
1221
+ jidDecode,
1222
+ jidNormalizedUser,
1223
+ areJidsSameUser,
1224
+ isJidGroup,
1225
+ isJidNewsletter,
1226
+ isLidUser,
1227
+ isPnUser,
1228
+ isJidBot,
1229
+ isJidMetaAI,
1230
+ isJidBroadcast,
1231
+ isJidStatusBroadcast,
1232
+
1233
+ DisconnectReason,
1234
+ Browsers,
1235
+
1236
+ Dugong,
1237
+
1238
+ WASocket
1239
+ } from '@zeronexcode/baileys'
1240
+ ```
1241
+
1242
+ > [!NOTE]
1243
+ > Advanced helper declarations can live in dedicated socket or rich-message declaration files before being reflected everywhere in aggregated declarations.
1244
+
1245
+ ---
1246
+
1247
+ # Building This Package
1248
+
1249
+ ```bash
1250
+ npm install
1251
+ npm run build
1252
+ ```
1253
+
1254
+ The build process:
1255
+
1256
+ - runs TypeScript with `tsconfig.build.json`
1257
+ - emits JavaScript and declaration files into `lib/`
1258
+ - runs `tsc-esm-fix` so generated ESM imports resolve cleanly
1259
+
1260
+ Important notes:
1261
+
1262
+ - `tsconfig.json` is authoring-oriented and can use `noEmit: true`
1263
+ - `tsconfig.build.json` enables emit
1264
+ - published package files are limited by `package.json` `files`
1265
+
1266
+ ---
1267
+
1268
+ # ZeroneXCode Extensions
1269
+
1270
+ | Area | Upstream Baileys v7 | ZeroneXCode Baileys |
1271
+ |---|---|---|
1272
+ | Interactive messages | Low-level proto support | High-level `single_select` helper |
1273
+ | View-once interactive | Manual wrapping | Supported through `viewOnce` |
1274
+ | Album messages | Base proto support | Extended helper surface |
1275
+ | AI Rich Response | Not part of standard high-level API | Table, code block, list, rich text helpers |
1276
+ | Table V1 | Not standard helper | Supported extension |
1277
+ | Table V2 | Not standard helper | Unified-response extension |
1278
+ | Code Block V1 | Not standard helper | Syntax-highlighted helper |
1279
+ | Code Block V2 | Not standard helper | Unified-response extension |
1280
+ | Link Message | Not standard helper | Inline embed/citation extension |
1281
+ | Newsletter extras | Base newsletter APIs | Extended helper methods |
1282
+ | Status mentions | Not standard high-level helper | Extended helper |
1283
+ | Rich message builders | Not standard high-level helper | ZeroneXCode extensions |
1284
+
1285
+ ---
1286
+
311
1287
  # Presence
312
1288
 
313
1289
  ```ts