@codexverified/baileys 2.14.14 → 2.17.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,35 @@
1
- # @codexverified/baileys
1
+ <div align="center">
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@codexverified/baileys.svg)](https://www.npmjs.com/package/@codexverified/baileys)
4
- [![node](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](#at-a-glance)
5
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](#license-and-maintenance)
6
- [![types](https://img.shields.io/badge/types-included-blue)](#at-a-glance)
3
+ # BAILEYS
7
4
 
8
- > A readable, carefully maintained Baileys distribution for building reliable WhatsApp integrations with codexverified/baileys.
5
+ ### **The intelligent interactive and productivity layer for WhatsApp protocols.**
6
+
7
+ <img src="https://readme-typing-svg.demolab.com?font=Space+Mono&size=22&pause=1200&color=00FFF0&center=true&vCenter=true&width=900&height=70&repeat=true&lines=BAILEYS+PROTOCOL.;NODE.JS+%2B+TYPESCRIPT.;RICH+MESSAGES+%2B+MEDIA.;BUILD+RELIABLE+INTEGRATIONS." alt="CodexVerified Baileys animated keywords" />
8
+
9
+ <img src="https://i.imgur.com/dBaSKWF.gif" height="16" width="88%" alt="animated coloured divider" />
10
+
11
+ <img src="https://raw.githubusercontent.com/codexverified/CODEX-AI/main/assets/rolling-circle.svg" width="90" alt="CodexVerified rolling circle" />
12
+
13
+ [![Version](https://img.shields.io/badge/version-2.14.14-00FFF0?style=for-the-badge&labelColor=07111F)](https://www.npmjs.com/package/@codexverified/baileys)
14
+ [![Developer CODEX](https://img.shields.io/badge/Developer-CODEX-B88CFF?style=for-the-badge&logo=telegram&labelColor=07111F)](https://t.me/codexverified)
15
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-7CFFB2?style=for-the-badge&logo=node.js&logoColor=white&labelColor=07111F)](https://nodejs.org/)
16
+ [![Powered by codexverified/baileys](https://img.shields.io/badge/powered%20by-codexverified%2Fbaileys-25D366?style=for-the-badge&logo=whatsapp&logoColor=white&labelColor=07111F)](https://www.npmjs.com/package/@codexverified/baileys)
17
+ [![License](https://img.shields.io/badge/license-MIT-B88CFF?style=for-the-badge&labelColor=07111F)](#license-and-maintenance)
18
+
19
+ </div>
20
+
21
+ <div align="center">
22
+
23
+ [![Main WhatsApp Channel](https://img.shields.io/badge/WhatsApp%20Channel-Follow-25D366?style=for-the-badge&logo=whatsapp)](https://whatsapp.com/channel/0029Vb78BHmL2AU7fsANSH2y)
24
+ [![Backup WhatsApp Channel](https://img.shields.io/badge/Backup%20Channel-Follow-25D366?style=for-the-badge&logo=whatsapp)](https://whatsapp.com/channel/0029Vb6sMEy96H4VI2w3I50F)
25
+ [![Support Group](https://img.shields.io/badge/Support%20Group-Join-25D366?style=for-the-badge&logo=whatsapp)](https://chat.whatsapp.com/If0d4XKHITO2NUf6YvQ3Eg?s=cl&p=a&mlu=4&ilr=4)
26
+ [![Telegram Channel](https://img.shields.io/badge/Telegram%20Channel-Join-26A5E4?style=for-the-badge&logo=telegram)](https://t.me/codex_tech_innovation)
27
+ [![Telegram Group](https://img.shields.io/badge/Telegram%20Group-Join-26A5E4?style=for-the-badge&logo=telegram)](https://t.me/CODEXV3)
28
+ [![Website](https://img.shields.io/badge/Website-Visit-00FFF0?style=for-the-badge&logo=vercel&logoColor=black)](https://codex-ai.site)
29
+
30
+ </div>
31
+
32
+ > A readable, carefully maintained Baileys distribution for building reliable WhatsApp integrations. built by codex
9
33
 
10
34
  `@codexverified/baileys` is a Node.js and TypeScript library for creating WhatsApp automations over the Baileys protocol. It provides a socket-oriented API for authentication, messaging, media, interactive content, rich responses, newsletters, groups, communities, business features, account utilities, and carefully documented extensions.
11
35
 
@@ -34,13 +58,14 @@ The package is maintained by **Codex** under the **CodexVerified** organization.
34
58
  - [Comparison references](#comparison-references)
35
59
  - [Additional functional compatibility helpers](#additional-functional-compatibility-helpers)
36
60
  - [AI generation primitive](#ai-generation-primitive)
61
+ - [New AIRich metadata helpers](#new-airich-metadata-helpers)
37
62
 
38
63
  ## At a glance
39
64
 
40
65
  | Property | Value |
41
66
  | --- | --- |
42
67
  | Package | `@codexverified/baileys` |
43
- | Version | `2.14.14` |
68
+ | Version | `2.17.18` |
44
69
  | Runtime | Node.js 20 or newer |
45
70
  | Module format | ESM, with CommonJS compatibility where supported |
46
71
  | Type declarations | Included at `lib/index.d.ts` |
@@ -54,7 +79,7 @@ The package is maintained by **Codex** under the **CodexVerified** organization.
54
79
  | Method | Command | Notes |
55
80
  | --- | --- | --- |
56
81
  | From npm | `npm install @codexverified/baileys` | Standard install when published under your organization |
57
- | From local archive | `npm install ./codex-baileys-2.14.14.tgz` | Place the `.tgz` beside your application |
82
+ | From local archive | `npm install ./codex-baileys-2.17.18.tgz` | Place the `.tgz` beside your application |
58
83
  | Source audit (no scripts) | `npm install --ignore-scripts` | Skips install hooks for local review |
59
84
 
60
85
  Both npm and archive installs use the same import name:
@@ -663,6 +688,134 @@ await sock.sendBotCommand(jid, {
663
688
  ```
664
689
 
665
690
 
691
+
692
+
693
+ ### Full-width stacked albums
694
+
695
+ `sendAlbumMessage` sends a rich vertical album rather than the legacy parent/child album collection. Each image or video is rendered as one large media item on its own row. Provide at least two publicly fetchable media URLs. Both `{ image: { url } }` and the typed `{ type: 'image', data: { url } }` forms are accepted.
696
+
697
+ ```js
698
+ await sock.sendAlbumMessage(jid, [
699
+ { image: { url: 'https://example.com/one.jpg' } },
700
+ { image: { url: 'https://example.com/two.jpg' } },
701
+ { image: { url: 'https://example.com/three.jpg' } }
702
+ ], { caption: 'Codex album' })
703
+ ```
704
+
705
+ The rich album path is URL-based and does not upload local buffers. Remove accidental whitespace from URLs before sending; the implementation trims URL values, but clean URLs are recommended.
706
+
707
+ ### A2UI command menu
708
+
709
+ `sendA2UICommandMenu` sends the large command/function menu UI: an optional image header, title, command rows, URL buttons, and a native-flow fallback. The `rows` entries use `[command, description]` tuples, matching the menu layout shown in the WhatsApp client.
710
+
711
+ ```js
712
+ await sock.sendA2UICommandMenu(jid, {
713
+ image: { url: 'https://example.com/menu.jpg' },
714
+ title: 'Speed menu',
715
+ rows: [
716
+ ['.menu', 'Main menu'],
717
+ ['.ping', 'Speed check']
718
+ ],
719
+ buttons: [
720
+ { text: 'Website', url: 'https://example.com' },
721
+ { text: 'Support', url: 'https://example.com/support' }
722
+ ]
723
+ })
724
+ ```
725
+
726
+
727
+ ### AIRich command menu and video grid
728
+
729
+ The compatibility update also exposes the two AIRich layouts that were not already present in Codex. `sendAIRichCommandMenu` sends the manually serialized command card with an image, Markdown command table, optional widget CTAs, and footer URL actions. The image must be a publicly fetchable URL.
730
+
731
+ ```ts
732
+ await sock.sendAIRichCommandMenu(jid, {
733
+ image: 'https://example.com/menu.png',
734
+ title: 'CODEX AI',
735
+ subtitle: 'Choose a command',
736
+ rows: [
737
+ ['.menu', 'Show the main menu'],
738
+ ['.ping', 'Check service latency']
739
+ ],
740
+ buttons: [
741
+ { id: 'docs', text: 'Documentation', url: 'https://example.com/docs' }
742
+ ],
743
+ footer: 'Developed by - CODEX TECHNOLOGY'
744
+ })
745
+ ```
746
+
747
+ `sendVideoGridMessage` sends at least two video URL items as a `GenAIGridLayoutViewModel` containing `GenAIVideoPrimitive` entries. It is separate from `sendAlbumMessage`, which uses the vertical album layout.
748
+
749
+ ```ts
750
+ await sock.sendVideoGridMessage(jid, [
751
+ {
752
+ url: 'https://cdn.example.com/first.mp4',
753
+ title: 'First clip',
754
+ thumbnailUrl: 'https://cdn.example.com/first.jpg',
755
+ progressiveUrls: ['https://cdn.example.com/first-720p.mp4']
756
+ },
757
+ {
758
+ url: 'https://cdn.example.com/second.mp4',
759
+ title: 'Second clip',
760
+ thumbnailUrl: 'https://cdn.example.com/second.jpg'
761
+ }
762
+ ])
763
+ ```
764
+
765
+ Both layouts are experimental WhatsApp protocol structures. Client rendering can change, and callers should provide a plain-message fallback where reliability matters.
766
+
767
+
768
+ ### Bot planning responses
769
+
770
+ `sendBotPlanning` sends a bot-planning rich response with a summary, ordered step text, and optional planning/query-plan capabilities.
771
+
772
+ ```ts
773
+ await sock.sendBotPlanning(jid, {
774
+ text: 'Preparing the deployment',
775
+ steps: [
776
+ { title: 'Build', body: 'Compile the application' },
777
+ { title: 'Verify', body: 'Run the checks' },
778
+ 'Publish the release'
779
+ ],
780
+ queryPlan: true
781
+ })
782
+ ```
783
+
784
+ ### Newsletter invite metadata
785
+
786
+ `newsletterGetInviteInfo` accepts either a channel invite code or a WhatsApp channel invite URL and returns the resolved newsletter metadata, or `null` when WhatsApp does not return a matching record.
787
+
788
+ ```ts
789
+ const info = await sock.newsletterGetInviteInfo('https://whatsapp.com/channel/INVITE_CODE')
790
+ console.log(info?.id, info?.name, info?.invite)
791
+ ```
792
+
793
+ The lookup is an explicit network request and does not follow, join, or subscribe to the channel.
794
+
795
+
796
+ ### Carousel, compatibility aliases, and source search
797
+
798
+ `sendCarousel` normalizes card media, captions, footers, and buttons before sending a carousel message.
799
+
800
+ ```ts
801
+ await sock.sendCarousel(jid, [
802
+ {
803
+ title: 'Documentation',
804
+ body: { text: 'Read the API guide' },
805
+ media: { image: { url: 'https://example.com/docs.jpg' } },
806
+ buttons: [{ text: 'Open', id: 'docs' }]
807
+ }
808
+ ])
809
+ ```
810
+
811
+ `HoldOn` is retained as a compatibility alias for `sendRichButtonGrid`. New applications should prefer the descriptive Codex-named method.
812
+
813
+ `grepCode(pattern, options)` searches installed package source files and returns matching file, line, column, and source-line information. It is an explicit diagnostic helper and performs no network access.
814
+
815
+ ```ts
816
+ const matches = sock.grepCode('prepareVideoGridMessage', { includeReadme: true })
817
+ ```
818
+
666
819
  ### Interactive rich HTML
667
820
 
668
821
  The compatibility update also exposes `sendRichHtmlMessage`, which uses the interactive GenAI HTML primitive and supports embedded tabs. Only pass trusted, sanitized HTML; this is not a general-purpose HTML sanitizer.
@@ -677,3 +830,119 @@ await sock.sendRichHtmlMessage(jid, {
677
830
  ```
678
831
 
679
832
  Multiple tabs can be supplied with `tabs`; each tab may provide its own `html`, `url`, and `trustedSources`. The structure is experimental and depends on WhatsApp client support.
833
+
834
+
835
+ ## Codex unified responses and the built-in mini-app
836
+
837
+ `sendCodexMessage` accepts one object containing any supported combination of text, links, media, products, reels, tables, code, LaTeX, or suggestions. Unsupported optional sections are ignored by the rich-response serializer, so callers can use one stable entry point for heterogeneous response data.
838
+
839
+ ```js
840
+ await sock.sendCodexMessage(jid, {
841
+ text: 'Here is your result',
842
+ links: [{ text: 'Open the docs', url: 'https://example.com/docs' }],
843
+ table: {
844
+ title: 'Summary',
845
+ headers: ['Name', 'Status'],
846
+ rows: [['Codex', 'Ready']]
847
+ }
848
+ })
849
+ ```
850
+
851
+ `sendMiniApp` sends the bundled interactive mini-app as a trusted rich HTML screen. The helper does not fetch or execute caller-provided remote code; pass only presentation options such as `title` and keep authentication or business actions on your own server.
852
+
853
+ ```js
854
+ await sock.sendMiniApp(jid, {
855
+ title: 'Codex mini-app'
856
+ }, {
857
+ quoted: message
858
+ })
859
+ ```
860
+
861
+ The package also exports `BotCapabilityType`, `normalizeBotCapabilities`, `buildBotCapabilityMetadata`, and `buildBotRichResponse` for applications that need to construct compatible bot metadata.
862
+
863
+
864
+ ## New AIRich metadata helpers
865
+
866
+ The package includes experimental helpers for protocol-backed rich clients. Rendering depends on the recipient's WhatsApp client version; these helpers do not call Meta AI or any private backend.
867
+
868
+ ```js
869
+ await sock.sendA2UIMessage(jid, {
870
+ type: 'im_a2ui',
871
+ data: {
872
+ version: 'v0.9',
873
+ createSurface: {
874
+ surfaceId: 'custom-card',
875
+ catalogId: 'https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json',
876
+ components: [{ id: 'root', component: 'Column', children: ['title'] }]
877
+ }
878
+ }
879
+ })
880
+
881
+ await sock.sendRichMap(jid, {
882
+ centerLatitude: 6.5244,
883
+ centerLongitude: 3.3792,
884
+ annotations: [{ latitude: 6.53, longitude: 3.38, title: 'Lagos', body: 'Nigeria' }],
885
+ showInfoList: true
886
+ })
887
+
888
+ await sock.sendBotPromptSuggestions(jid, {
889
+ text: 'Choose a follow-up',
890
+ suggestions: ['Summarize this', 'Translate this', 'Explain further'],
891
+ selectedPromptId: 'translate'
892
+ })
893
+
894
+ await sock.sendBotSources(jid, {
895
+ text: 'Relevant sources:',
896
+ sources: [{
897
+ provider: 2,
898
+ url: 'https://example.com/docs',
899
+ query: 'baileys proto',
900
+ title: 'Documentation',
901
+ citationNumber: 1
902
+ }]
903
+ })
904
+
905
+ await sock.sendRichDynamicMedia(jid, {
906
+ type: 'IMAGE',
907
+ url: 'https://example.com/image.jpg',
908
+ version: 1
909
+ })
910
+
911
+ await sock.sendBotPttTranscript(jid, {
912
+ text: 'Voice transcript',
913
+ transcript: 'Hello, this text came from a voice message.'
914
+ })
915
+
916
+ await sock.sendSocialEntity(jid, {
917
+ platform: 'YOUTUBE',
918
+ username: 'example',
919
+ title: 'Example creator',
920
+ imageUrl: 'https://example.com/avatar.png',
921
+ entityUrl: 'https://www.youtube.com/@example',
922
+ isVerified: true,
923
+ resultText: 'See results'
924
+ })
925
+
926
+ await sock.sendInstagramProfile(jid, {
927
+ username: 'example',
928
+ title: 'Example profile',
929
+ imageUrl: 'https://example.com/avatar.png',
930
+ entityUrl: 'https://www.instagram.com/example',
931
+ isVerified: true,
932
+ resultText: 'See results'
933
+ })
934
+ ```
935
+
936
+ The map, prompt, source, dynamic-media, transcript, A2UI, and social/entity payloads are serialized from the generated `WAProto` structures. Validate URLs, button identifiers, and any user-supplied metadata in your own application before sending.
937
+
938
+ <div align="center">
939
+
940
+ <sub>Thanks for reading my README.</sub>
941
+
942
+ <img src="https://i.imgur.com/dBaSKWF.gif" height="16" width="88%" alt="animated coloured footer line" />
943
+
944
+ <br><br>
945
+
946
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=00FFF0&height=100&section=footer" alt="@codexverified/baileys footer" />
947
+
948
+ </div>