@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 +277 -8
- package/lib/Socket/messages-send.js +303 -3
- package/lib/Socket/newsletter.js +19 -0
- package/lib/Utils/bot-capabilities.js +84 -0
- package/lib/Utils/games/miniapp.js +5 -0
- package/lib/Utils/index.js +4 -0
- package/lib/Utils/rich-message-utils.js +506 -1
- package/lib/Utils/source-grep.js +46 -0
- package/lib/index.d.ts +124 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -121,6 +121,83 @@ export interface AIPromptOptions {
|
|
|
121
121
|
[key: string]: unknown;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
export interface SocialEntityContent {
|
|
125
|
+
username?: string;
|
|
126
|
+
platform?: string;
|
|
127
|
+
title?: string;
|
|
128
|
+
subtitle?: string;
|
|
129
|
+
imageUrl?: string;
|
|
130
|
+
entityId?: string | number;
|
|
131
|
+
entityUrl?: string;
|
|
132
|
+
entityType?: string;
|
|
133
|
+
fullName?: string;
|
|
134
|
+
isVerified?: boolean;
|
|
135
|
+
resultText?: string;
|
|
136
|
+
botJid?: string;
|
|
137
|
+
responseId?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface RichMapAnnotation {
|
|
141
|
+
annotationNumber?: number;
|
|
142
|
+
latitude: number;
|
|
143
|
+
longitude: number;
|
|
144
|
+
title?: string;
|
|
145
|
+
body?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface RichMapContent {
|
|
149
|
+
centerLatitude: number;
|
|
150
|
+
centerLongitude: number;
|
|
151
|
+
latitudeDelta?: number;
|
|
152
|
+
longitudeDelta?: number;
|
|
153
|
+
annotations?: RichMapAnnotation[];
|
|
154
|
+
showInfoList?: boolean;
|
|
155
|
+
verificationMetadata?: Record<string, unknown>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface BotPromptSuggestionsContent {
|
|
159
|
+
text?: string;
|
|
160
|
+
suggestions: string[];
|
|
161
|
+
selectedPromptIndex?: number;
|
|
162
|
+
selectedPromptId?: string;
|
|
163
|
+
verificationMetadata?: Record<string, unknown>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface BotSourceContent {
|
|
167
|
+
provider?: number;
|
|
168
|
+
thumbnailCdnUrl?: string;
|
|
169
|
+
thumbnailUrl?: string;
|
|
170
|
+
sourceProviderUrl?: string;
|
|
171
|
+
url?: string;
|
|
172
|
+
sourceQuery?: string;
|
|
173
|
+
query?: string;
|
|
174
|
+
faviconCdnUrl?: string;
|
|
175
|
+
faviconUrl?: string;
|
|
176
|
+
citationNumber?: number;
|
|
177
|
+
sourceTitle?: string;
|
|
178
|
+
title?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface BotSourcesContent {
|
|
182
|
+
text?: string;
|
|
183
|
+
sources: BotSourceContent[];
|
|
184
|
+
verificationMetadata?: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface RichDynamicMediaContent {
|
|
188
|
+
url: string;
|
|
189
|
+
type?: 'IMAGE' | 'GIF' | string;
|
|
190
|
+
version?: number;
|
|
191
|
+
loopCount?: number;
|
|
192
|
+
verificationMetadata?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface BotPttTranscriptContent {
|
|
196
|
+
transcript: string;
|
|
197
|
+
text?: string;
|
|
198
|
+
verificationMetadata?: Record<string, unknown>;
|
|
199
|
+
}
|
|
200
|
+
|
|
124
201
|
export interface RelayMessageOptions {
|
|
125
202
|
messageId?: string;
|
|
126
203
|
/** Recipient-only delivery: skip the sender’s own devices in a one-to-one chat. */
|
|
@@ -162,6 +239,8 @@ export interface WASocket {
|
|
|
162
239
|
sendMessage(jid: string | string[], content: StatusContent | GroupStatusContent | Record<string, unknown>, options?: Partial<StatusOptions> & Record<string, unknown>): Promise<unknown>;
|
|
163
240
|
/** Relay a prepared message with optional recipient/device-scoping controls. */
|
|
164
241
|
relayMessage(jid: string, message: Record<string, unknown>, options?: RelayMessageOptions): Promise<unknown>;
|
|
242
|
+
/** Resolve a WhatsApp channel invite code or URL to newsletter metadata. */
|
|
243
|
+
newsletterGetInviteInfo(inviteCodeOrUrl: string): Promise<Record<string, unknown> | null>;
|
|
165
244
|
deleteGroupStatus(jid: string, key: WAMessageKey): Promise<unknown>;
|
|
166
245
|
/** Reports the contact and blocks it after WhatsApp accepts the report. */
|
|
167
246
|
reportContact(jid: string, messageKeys?: WAMessageKey[]): Promise<unknown>;
|
|
@@ -301,17 +380,43 @@ export interface WASocket {
|
|
|
301
380
|
sendMarkdownQuote(jid: string, content?: { text?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
302
381
|
/** Send a quote plus a COPY_TO_CLIPBOARD action. */
|
|
303
382
|
sendQuoteCopy(jid: string, content: { text?: string; copyText: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
304
|
-
/** Send
|
|
383
|
+
/** Send a full-width stacked AIRich album with at least two image/video URL items. */
|
|
305
384
|
sendAlbumMessage(jid: string, medias: Array<Record<string, unknown>>, options?: Record<string, unknown>): Promise<unknown>;
|
|
385
|
+
/** Send a provider-neutral AIRich social/entity result card. */
|
|
386
|
+
sendSocialEntity(jid: string, content?: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
387
|
+
/** Send a protocol-backed AIRich map with optional numbered annotations. */
|
|
388
|
+
sendRichMap(jid: string, content: RichMapContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
389
|
+
/** Send BotSuggestedPromptMetadata with a rich-response text fallback. */
|
|
390
|
+
sendBotPromptSuggestions(jid: string, content: BotPromptSuggestionsContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
391
|
+
/** Send BotSourcesMetadata for citation-aware bot responses. */
|
|
392
|
+
sendBotSources(jid: string, content: BotSourcesContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
393
|
+
/** Send an experimental AIRich dynamic image/GIF submessage. */
|
|
394
|
+
sendRichDynamicMedia(jid: string, content: RichDynamicMediaContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
395
|
+
/** Send BotPttPromptMetadata containing a caller-provided transcript. */
|
|
396
|
+
sendBotPttTranscript(jid: string, content: BotPttTranscriptContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
397
|
+
/** Send the primary Instagram profile result using the universal social/entity format. */
|
|
398
|
+
sendInstagramProfile(jid: string, content: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
399
|
+
/** Send arbitrary A2UI/interactive payloads with immediate relay/edit rendering. */
|
|
400
|
+
sendA2UIMessage(jid: string, content?: A2UIMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
401
|
+
/** Send the large A2UI command/function menu with an image header and URL buttons. */
|
|
402
|
+
sendA2UICommandMenu(jid: string, content?: { image?: unknown; title?: string; rows?: Array<[string, string, string?] | { title?: string; description?: string; id?: string }>; buttons?: Array<{ text?: string; label?: string; url?: string }>; fallback?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
403
|
+
/** Send the manually serialized AIRich command card with image, Markdown, widget CTAs, and footer actions. */
|
|
404
|
+
sendAIRichCommandMenu(jid: string, content: { image: string; title?: string; subtitle?: string; code?: string; rows?: Array<[string, string] | { command?: string; description?: string }>; buttons?: Array<{ id?: string; text?: string; label?: string; url?: string; toast?: string }>; footer?: string; latexImage?: string; latexExpression?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
405
|
+
/** Send a GenAI unified-response grid of video primitives. Requires at least two video URLs. */
|
|
406
|
+
sendVideoGridMessage(jid: string, videos: Array<string | { url?: string; videoUrl?: string; reelsUrl?: string; postId?: string | number; title?: string; thumbnailUrl?: string; thumbnail?: string; creator?: string; avatarUrl?: string; contentHash?: string; likes?: number; comments?: number; shares?: number; isVerified?: boolean; sourceApp?: string; progressiveUrls?: string[]; dashManifests?: string[] }>, options?: Record<string, unknown>): Promise<unknown>;
|
|
306
407
|
/** Send experimental bot diagnostic metadata. */
|
|
307
408
|
sendBotDiagnostics(jid: string, content?: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
308
409
|
/** Send experimental bot command metadata. */
|
|
309
410
|
sendBotCommand(jid: string, content?: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
411
|
+
/** Send an experimental bot planning/execution-plan rich response. */
|
|
412
|
+
sendBotPlanning(jid: string, content?: { text?: string; steps?: Array<string | { title?: string; name?: string; body?: string }>; queryPlan?: boolean; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
310
413
|
/** Send experimental resolved tool-call metadata. */
|
|
311
414
|
sendBotToolResult(jid: string, content?: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
312
415
|
richMenu(jid: string, content?: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
313
416
|
/** Send a rich button-card grid. */
|
|
314
417
|
sendRichButtonGrid(jid: string, grid: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
418
|
+
/** Compatibility alias for sendRichButtonGrid. */
|
|
419
|
+
HoldOn(jid: string, grid: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
315
420
|
/** Send a GenAI-style inline copy-to-clipboard rich response. */
|
|
316
421
|
sendCopyButton(jid: string, content: { text: string; label?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
317
422
|
/** Send a markdown-style interactive table with buttons. */
|
|
@@ -320,6 +425,10 @@ export interface WASocket {
|
|
|
320
425
|
sendWhatsAppFlow(jid: string, flow: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
321
426
|
/** Send a complete GenAI-style rich response envelope. */
|
|
322
427
|
sendRichMedia(jid: string, content?: Record<string, unknown>, quoted?: unknown, options?: Record<string, unknown>): Promise<{ message: unknown; messageId: string }>;
|
|
428
|
+
/** Send one tolerant rich response containing every supported section supplied in content. */
|
|
429
|
+
sendCodexMessage(jid: string, content?: Record<string, unknown>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
430
|
+
/** Search package source files for a literal or regular-expression pattern. */
|
|
431
|
+
grepCode(pattern: string, options?: { regex?: boolean; flags?: string; caseSensitive?: boolean; dirs?: string[]; includeReadme?: boolean; maxResults?: number }): Array<{ file: string; line: number; column: number; text: string }>;
|
|
323
432
|
/** Send a native AI image/video generation card. */
|
|
324
433
|
sendRichGeneration(jid: string, content?: RichGenerationContent, quoted?: unknown, options?: Record<string, unknown>): Promise<RichGenerationResult>;
|
|
325
434
|
/** Edit an existing rich generation card in place. */
|
|
@@ -351,6 +460,8 @@ export interface WASocket {
|
|
|
351
460
|
sendHtmlMessage(jid: string, content: { html: string; trustedSources?: string[] }, options?: Record<string, unknown>): Promise<unknown>;
|
|
352
461
|
/** Send the built-in HTML slot-machine payload. */
|
|
353
462
|
sendSlotMachine(jid: string, options?: { title?: string; startingCredits?: number }, sendOptions?: Record<string, unknown>): Promise<unknown>;
|
|
463
|
+
/** Send the built-in interactive Codex mini-app. */
|
|
464
|
+
sendMiniApp(jid: string, options?: { title?: string; [key: string]: unknown }, sendOptions?: Record<string, unknown>): Promise<unknown>;
|
|
354
465
|
/** Send a fetched website preview as an HTML rich response. */
|
|
355
466
|
sendWebsitePreview(jid: string, url: string, options?: Record<string, unknown>, sendOptions?: Record<string, unknown>): Promise<unknown>;
|
|
356
467
|
/** Send a lightweight HTML link-preview card. */
|
|
@@ -386,6 +497,7 @@ export declare function makeCacheManagerAuthState(store: CacheManagerStore, sess
|
|
|
386
497
|
}>;
|
|
387
498
|
|
|
388
499
|
/** Generate a self-contained local slot-machine HTML payload. */
|
|
500
|
+
export declare function generateMiniAppHtml(options?: { title?: string; [key: string]: unknown }): string;
|
|
389
501
|
export declare function generateSlotMachineHtml(options?: { title?: string; startingCredits?: number }): string;
|
|
390
502
|
export declare function buildImaginePrimitive(options?: { mediaType?: 'image' | 'video'; url?: string; thumbnail?: string; mimeType?: string; fileLength?: number; duration?: number; status?: string; estimatedMs?: number; imagineType?: string }): Record<string, unknown>;
|
|
391
503
|
export declare function parseNativeFlowResponse(message: unknown): Record<string, unknown> | null;
|
|
@@ -423,3 +535,14 @@ declare function makeWASocket(config: SocketConfig): WASocket;
|
|
|
423
535
|
export { makeWASocket };
|
|
424
536
|
export default makeWASocket;
|
|
425
537
|
|
|
538
|
+
|
|
539
|
+
export declare const BotCapabilityType: Record<string, number>;
|
|
540
|
+
export declare function normalizeBotCapabilities(capabilities?: unknown[]): number[];
|
|
541
|
+
export declare function buildBotCapabilityMetadata(capabilities?: unknown[]): Record<string, unknown>;
|
|
542
|
+
export declare function buildBotRichResponse(options?: Record<string, unknown>): Record<string, unknown>;
|
|
543
|
+
|
|
544
|
+
export declare function prepareVerticalAlbumMessage(options?: { items?: Array<Record<string, unknown>>; verificationMetadata?: Record<string, unknown> }): Record<string, unknown>;
|
|
545
|
+
export declare function prepareAIRichCommandMenu(options?: { image?: string; title?: string; subtitle?: string; code?: string; rows?: Array<[string, string] | Record<string, unknown>>; buttons?: Array<Record<string, unknown>>; footer?: string; latexImage?: string; latexExpression?: string }): Record<string, unknown>;
|
|
546
|
+
export declare function prepareVideoGridMessage(options?: { videos?: Array<string | Record<string, unknown>>; verificationMetadata?: Record<string, unknown> }): Record<string, unknown>;
|
|
547
|
+
|
|
548
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexverified/baileys",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.18",
|
|
4
4
|
"description": "CODEX TECHNOLOGY a premium Baileys developed and built by Dev Codex, with Meta compositing, bot planning replay, welcome flow, rich messages, interactive messages, albums, and more.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|