@x4r1s3/baileys 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +1262 -2
- package/SECURITY.md +47 -0
- package/WAProto/V +1 -0
- package/WAProto/WAProto.proto +8892 -0
- package/WAProto/index.d.ts +104128 -0
- package/WAProto/index.js +334920 -0
- package/assets/rolling-circle.svg +133 -0
- package/assets/x4r1s3-banner.svg +32 -0
- package/engine-requirements.js +27 -0
- package/lib/Builders/A2UI.js +245 -0
- package/lib/Builders/AIRich.js +179 -0
- package/lib/Builders/Button.js +108 -0
- package/lib/Builders/CFC.js +284 -0
- package/lib/Builders/Carousel.js +81 -0
- package/lib/Call/THIRD_PARTY_LICENSE.txt +21 -0
- package/lib/Call/audio-feeder.mjs +179 -0
- package/lib/Call/audio-recorder.mjs +250 -0
- package/lib/Call/fetch-wasm-resources.mjs +104 -0
- package/lib/Call/index.mjs +680 -0
- package/lib/Call/relay-transport.mjs +563 -0
- package/lib/Call/signaling.mjs +641 -0
- package/lib/Call/types.mjs +17 -0
- package/lib/Call/video-feeder.mjs +94 -0
- package/lib/Call/wasm-engine.mjs +1372 -0
- package/lib/Call/worker-bootstrap.mjs +1042 -0
- package/lib/Defaults/ban-checker.js +56 -0
- package/lib/Defaults/index.js +170 -0
- package/lib/Signal/Group/ciphertext-message.js +23 -0
- package/lib/Signal/Group/group-session-builder.js +41 -0
- package/lib/Signal/Group/group_cipher.js +93 -0
- package/lib/Signal/Group/index.js +23 -0
- package/lib/Signal/Group/keyhelper.js +29 -0
- package/lib/Signal/Group/sender-chain-key.js +37 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +74 -0
- package/lib/Signal/Group/sender-key-message.js +77 -0
- package/lib/Signal/Group/sender-key-name.js +59 -0
- package/lib/Signal/Group/sender-key-record.js +52 -0
- package/lib/Signal/Group/sender-key-state.js +95 -0
- package/lib/Signal/Group/sender-message-key.js +37 -0
- package/lib/Signal/libsignal.js +440 -0
- package/lib/Signal/lid-mapping.js +292 -0
- package/lib/Socket/Client/index.js +14 -0
- package/lib/Socket/Client/types.js +22 -0
- package/lib/Socket/Client/websocket.js +65 -0
- package/lib/Socket/aigroups.js +327 -0
- package/lib/Socket/ban-checker.js +165 -0
- package/lib/Socket/business.js +419 -0
- package/lib/Socket/chats.js +1921 -0
- package/lib/Socket/communities.js +443 -0
- package/lib/Socket/graphql.js +911 -0
- package/lib/Socket/groups.js +561 -0
- package/lib/Socket/index.js +49 -0
- package/lib/Socket/interactive-handler.js +612 -0
- package/lib/Socket/interop.js +575 -0
- package/lib/Socket/managed-account.js +220 -0
- package/lib/Socket/messages-recv.js +2191 -0
- package/lib/Socket/messages-send.js +4104 -0
- package/lib/Socket/mex.js +53 -0
- package/lib/Socket/newsletter.js +291 -0
- package/lib/Socket/privacy.js +458 -0
- package/lib/Socket/registration.js +440 -0
- package/lib/Socket/socket.js +1029 -0
- package/lib/Socket/status-actions.js +287 -0
- package/lib/Socket/username.js +241 -0
- package/lib/Store/index.js +16 -0
- package/lib/Store/make-cache-manager-store.js +101 -0
- package/lib/Store/make-in-memory-store.js +432 -0
- package/lib/Store/make-ordered-dictionary.js +90 -0
- package/lib/Store/object-repository.js +35 -0
- package/lib/Types/Auth.js +13 -0
- package/lib/Types/Bussines.js +13 -0
- package/lib/Types/Call.js +13 -0
- package/lib/Types/Chat.js +19 -0
- package/lib/Types/Contact.js +13 -0
- package/lib/Types/Events.js +13 -0
- package/lib/Types/GroupMetadata.js +13 -0
- package/lib/Types/Label.js +36 -0
- package/lib/Types/LabelAssociation.js +18 -0
- package/lib/Types/Message.js +30 -0
- package/lib/Types/Mex.js +53 -0
- package/lib/Types/Product.js +13 -0
- package/lib/Types/RichType.js +34 -0
- package/lib/Types/Signal.js +13 -0
- package/lib/Types/Socket.js +14 -0
- package/lib/Types/State.js +60 -0
- package/lib/Types/USync.js +13 -0
- package/lib/Types/index.js +37 -0
- package/lib/Utils/auth-utils.js +313 -0
- package/lib/Utils/ban-checker.js +48 -0
- package/lib/Utils/bot-capabilities.js +96 -0
- package/lib/Utils/bot-planning-replay.js +177 -0
- package/lib/Utils/browser-utils.js +40 -0
- package/lib/Utils/business.js +242 -0
- package/lib/Utils/c2582.js +147 -0
- package/lib/Utils/chat-utils.js +905 -0
- package/lib/Utils/companion-reg-client-utils.js +44 -0
- package/lib/Utils/consumer-application.js +114 -0
- package/lib/Utils/crypto.js +129 -0
- package/lib/Utils/decode-wa-message.js +496 -0
- package/lib/Utils/direct-chat-theme.js +164 -0
- package/lib/Utils/event-buffer.js +601 -0
- package/lib/Utils/experimental-proto.js +206 -0
- package/lib/Utils/games/miniapp.js +17 -0
- package/lib/Utils/games/slot-machine.js +270 -0
- package/lib/Utils/games/website-preview.js +306 -0
- package/lib/Utils/generics.js +402 -0
- package/lib/Utils/group-history.js +68 -0
- package/lib/Utils/group-wallpaper.js +168 -0
- package/lib/Utils/history.js +162 -0
- package/lib/Utils/identity-change-handler.js +60 -0
- package/lib/Utils/index.js +61 -0
- package/lib/Utils/jid-display-normalization.js +221 -0
- package/lib/Utils/link-preview.js +96 -0
- package/lib/Utils/logger.js +14 -0
- package/lib/Utils/lt-hash.js +19 -0
- package/lib/Utils/make-mutex.js +44 -0
- package/lib/Utils/message-composer.js +709 -0
- package/lib/Utils/message-inspect.js +79 -0
- package/lib/Utils/message-retry-manager.js +253 -0
- package/lib/Utils/message-security.js +167 -0
- package/lib/Utils/messages-media.js +1027 -0
- package/lib/Utils/messages.js +2467 -0
- package/lib/Utils/meta-ai-msmsg.js +215 -0
- package/lib/Utils/meta-compositing.js +239 -0
- package/lib/Utils/native-flow.js +158 -0
- package/lib/Utils/newsletter-live-update-utils.js +74 -0
- package/lib/Utils/newsletter-status-utils.js +152 -0
- package/lib/Utils/noise-handler.js +212 -0
- package/lib/Utils/offline-node-processor.js +51 -0
- package/lib/Utils/poll-manager.js +206 -0
- package/lib/Utils/portable-compat.js +12 -0
- package/lib/Utils/pre-key-manager.js +117 -0
- package/lib/Utils/process-message.js +610 -0
- package/lib/Utils/reporting-utils.js +269 -0
- package/lib/Utils/rich-message-utils.js +2841 -0
- package/lib/Utils/scheduled-message.js +107 -0
- package/lib/Utils/signal.js +212 -0
- package/lib/Utils/source-grep.js +57 -0
- package/lib/Utils/stanza-ack.js +49 -0
- package/lib/Utils/sticker-annotation.js +87 -0
- package/lib/Utils/sync-action-utils.js +59 -0
- package/lib/Utils/tc-token-utils.js +174 -0
- package/lib/Utils/use-multi-file-auth-state.js +132 -0
- package/lib/Utils/use-single-file-auth-state.js +108 -0
- package/lib/Utils/use-sqlite-auth-state.js +120 -0
- package/lib/Utils/validate-connection.js +220 -0
- package/lib/Utils/view-once-utils.js +218 -0
- package/lib/Utils/voip-rekey.js +32 -0
- package/lib/Utils/website-preview.js +27 -0
- package/lib/Utils/welcome-flow.js +228 -0
- package/lib/Utils/x4r1s3.js +144 -0
- package/lib/WABinary/constants.js +1475 -0
- package/lib/WABinary/decode.js +273 -0
- package/lib/WABinary/encode.js +231 -0
- package/lib/WABinary/generic-utils.js +242 -0
- package/lib/WABinary/index.js +17 -0
- package/lib/WABinary/jid-utils.js +107 -0
- package/lib/WABinary/types.js +13 -0
- package/lib/WAM/BinaryInfo.js +21 -0
- package/lib/WAM/constants.js +22864 -0
- package/lib/WAM/encode.js +161 -0
- package/lib/WAM/index.js +15 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +108 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +68 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +65 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +82 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +40 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +49 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +46 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +36 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +62 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +40 -0
- package/lib/WAUSync/Protocols/index.js +24 -0
- package/lib/WAUSync/USyncQuery.js +213 -0
- package/lib/WAUSync/USyncUser.js +66 -0
- package/lib/WAUSync/index.js +15 -0
- package/lib/antiban.cjs +4726 -0
- package/lib/index.d.ts +1285 -0
- package/lib/index.js +30 -0
- package/package.json +125 -4
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,1285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @X4R1S3
|
|
3
|
+
*
|
|
4
|
+
* File: lib/index.d.ts
|
|
5
|
+
* About: Index.d module for the X4R1S3 WhatsApp protocol client.
|
|
6
|
+
* Important exports: WAMessageKey, StatusOptions, PollVoteEvent, StatusContent, GroupStatusContent, StatusPrivacyList, StatusCustomList, BroadcastListQuota; …
|
|
7
|
+
* Directions: Import the listed exports and preserve protocol, validation, and compatibility invariants when modifying.
|
|
8
|
+
*
|
|
9
|
+
* Copyright and attribution notice.
|
|
10
|
+
* Do not copy, reproduce, redistribute, modify, or create derivative works
|
|
11
|
+
* from this source without explicit written permission.
|
|
12
|
+
*/
|
|
13
|
+
export interface WAMessageKey {
|
|
14
|
+
remoteJid?: string | null;
|
|
15
|
+
fromMe?: boolean | null;
|
|
16
|
+
id?: string | null;
|
|
17
|
+
participant?: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type StatusFont = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
21
|
+
|
|
22
|
+
export interface StatusOptions {
|
|
23
|
+
/** Users allowed to receive the status. At least one valid user JID is required. */
|
|
24
|
+
statusJidList: string[];
|
|
25
|
+
/** Hex, named, or ARGB status background color. */
|
|
26
|
+
backgroundColor?: string | number;
|
|
27
|
+
font?: StatusFont;
|
|
28
|
+
messageId?: string;
|
|
29
|
+
additionalAttributes?: Record<string, string>;
|
|
30
|
+
additionalNodes?: unknown[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PollVoteEvent {
|
|
34
|
+
pollUpdateMessageKey: WAMessageKey;
|
|
35
|
+
pollCreationMessageKey: WAMessageKey;
|
|
36
|
+
vote: unknown;
|
|
37
|
+
voterJid?: string;
|
|
38
|
+
pollCreatorJid?: string;
|
|
39
|
+
selectedOptions: string[];
|
|
40
|
+
selectedOptionHashes: string[];
|
|
41
|
+
unselectedOptions: string[];
|
|
42
|
+
senderTimestampMs?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface StatusContent {
|
|
46
|
+
/** Convenience flag; alternatively send to `status@broadcast`. */
|
|
47
|
+
status?: true;
|
|
48
|
+
statusJidList?: string[];
|
|
49
|
+
backgroundColor?: string | number;
|
|
50
|
+
font?: StatusFont;
|
|
51
|
+
text?: string;
|
|
52
|
+
image?: unknown;
|
|
53
|
+
video?: unknown;
|
|
54
|
+
audio?: unknown;
|
|
55
|
+
caption?: string;
|
|
56
|
+
mimetype?: string;
|
|
57
|
+
ptt?: boolean;
|
|
58
|
+
seconds?: number;
|
|
59
|
+
waveform?: Uint8Array;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type GroupThemeScope = 'everyone' | 'me';
|
|
64
|
+
export interface GroupWallpaperOptions { scope?: GroupThemeScope; dimLevel?: number; mediaUploadTimeoutMs?: number; settingTimestampMs?: number; messageId?: string; }
|
|
65
|
+
export interface GroupWallpaperResetOptions { scope?: GroupThemeScope; isDoodleEnabled?: boolean; settingTimestampMs?: number; messageId?: string; }
|
|
66
|
+
export interface DirectChatWallpaperOptions extends GroupWallpaperOptions {}
|
|
67
|
+
export interface DirectChatWallpaperResetOptions extends GroupWallpaperResetOptions {}
|
|
68
|
+
export interface ChatThemeResult { key: WAMessageKey; message: Record<string, unknown>; submissionStatus: 'written'; serverOutcome: 'unconfirmed'; }
|
|
69
|
+
export interface GroupWallpaperResult extends ChatThemeResult {}
|
|
70
|
+
export interface GroupColorSchemeOptions { scope: GroupThemeScope; allowUnverifiedPartialUpdate: true; settingTimestampMs?: number; messageId?: string; }
|
|
71
|
+
export interface DirectChatColorSchemeOptions extends GroupColorSchemeOptions {}
|
|
72
|
+
export function setGroupWallpaper(sock: WASocket, jid: string, image: Buffer | string | { url: string } | null, options?: GroupWallpaperOptions | GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
73
|
+
export function resetGroupWallpaper(sock: WASocket, jid: string, options?: GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
74
|
+
export function setGroupColorScheme(sock: WASocket, jid: string, colorSchemeId: string, options: GroupColorSchemeOptions): Promise<GroupWallpaperResult>;
|
|
75
|
+
export function setDirectChatWallpaper(sock: WASocket, jid: string, image: Buffer | string | { url: string } | null, options?: DirectChatWallpaperOptions | DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
76
|
+
export function resetDirectChatWallpaper(sock: WASocket, jid: string, options?: DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
77
|
+
export function setDirectChatColorScheme(sock: WASocket, jid: string, colorSchemeId: string, options: DirectChatColorSchemeOptions): Promise<ChatThemeResult>;
|
|
78
|
+
export interface DraftMessageSyncInput { chatJid: string; altChatJid?: string; action: number; editTimestampMs: number; draft?: Record<string, unknown>; clearReason?: number; }
|
|
79
|
+
export interface ConversationDraftInput { content: Record<string, unknown>; editTimestampMs: number | bigint | string; editorDeviceId?: number; }
|
|
80
|
+
export interface GroupMembershipFormQuestion { text: string; [key: string]: unknown; }
|
|
81
|
+
export interface GroupMembershipFormInput { questions: GroupMembershipFormQuestion[]; memberTagPrompt?: string; schemaVersion?: number; }
|
|
82
|
+
export interface GroupMembershipFormSubmissionInput { questionAnswers?: Array<{ question: GroupMembershipFormQuestion; answer: string; [key: string]: unknown }>; memberTagAnswer?: { prompt: string; memberTag: string; [key: string]: unknown }; schemaVersion?: number; }
|
|
83
|
+
export interface StatusTemplateAttributionInput { templateId: string; templateName?: string; thumbnailUrl?: string; }
|
|
84
|
+
export interface MembershipFormPublicKeysInput { mlKemPublicKey: Uint8Array; x25519PublicKey: Uint8Array; }
|
|
85
|
+
export interface EncryptedJoinRequestPayloadInput { encryptedAnswers: Uint8Array; encIv: Uint8Array; signalIdentityPublicKey: Uint8Array; kemCiphertext: Uint8Array; }
|
|
86
|
+
export function buildDraftMessageSync(input: DraftMessageSyncInput): Record<string, unknown>;
|
|
87
|
+
export function buildConversationDraft(input: ConversationDraftInput): Record<string, unknown>;
|
|
88
|
+
export function buildGroupMembershipForm(input: GroupMembershipFormInput): Record<string, unknown>;
|
|
89
|
+
export function buildGroupMembershipFormSubmission(input: GroupMembershipFormSubmissionInput): Record<string, unknown>;
|
|
90
|
+
export function buildMembershipFormPublicKeys(input: MembershipFormPublicKeysInput): Record<string, unknown>;
|
|
91
|
+
export function buildEncryptedJoinRequestPayload(input: EncryptedJoinRequestPayloadInput): Record<string, unknown>;
|
|
92
|
+
export function buildMusicLyrics(input: { lines: MusicMessageLyricLine[] }): Record<string, unknown>;
|
|
93
|
+
export function buildMusicMessage(input: MusicMessageContent): Record<string, unknown>;
|
|
94
|
+
export function buildStatusTemplateAttribution(input: StatusTemplateAttributionInput): Record<string, unknown>;
|
|
95
|
+
export function withStatusTemplateAttribution(content: StatusContent, template: StatusTemplateAttributionInput): StatusContent;
|
|
96
|
+
export interface NewsletterStatusContent {
|
|
97
|
+
text?: string;
|
|
98
|
+
backgroundColor?: string | number;
|
|
99
|
+
backgroundArgb?: number;
|
|
100
|
+
font?: StatusFont;
|
|
101
|
+
image?: unknown;
|
|
102
|
+
video?: unknown;
|
|
103
|
+
audio?: unknown;
|
|
104
|
+
ptt?: boolean;
|
|
105
|
+
caption?: string;
|
|
106
|
+
mimetype?: string;
|
|
107
|
+
seconds?: number;
|
|
108
|
+
contextInfo?: Record<string, unknown>;
|
|
109
|
+
messageContextInfo?: Record<string, unknown>;
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface NewsletterStatusSendOptions {
|
|
114
|
+
/** Optional status stanza id; generated automatically by default. */
|
|
115
|
+
messageId?: string;
|
|
116
|
+
/** Maximum time to wait for WhatsApp's status ACK. Defaults to 20 seconds. */
|
|
117
|
+
ackTimeoutMs?: number;
|
|
118
|
+
/** Wait for the separate status echo and resolve newsletterStatusServerId; defaults to true. */
|
|
119
|
+
resolveServerId?: boolean;
|
|
120
|
+
/** Maximum echo wait after ACK when resolveServerId is enabled. Defaults to 8 seconds. */
|
|
121
|
+
serverIdTimeoutMs?: number;
|
|
122
|
+
/** Maximum time for media upload, when content contains an image or video. */
|
|
123
|
+
mediaUploadTimeoutMs?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface NewsletterStatusEligibility {
|
|
127
|
+
canPost: boolean;
|
|
128
|
+
capabilities: string[];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface GroupStatusContent extends StatusContent {
|
|
132
|
+
groupStatus: true;
|
|
133
|
+
/** Select the legacy groupStatusMessage envelope for compatibility testing. */
|
|
134
|
+
groupStatusVersion?: 'legacy' | 'v1' | 'v2';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** One status distribution list entry as returned by `getStatusPrivacy`. */
|
|
138
|
+
export interface StatusPrivacyList {
|
|
139
|
+
type?: string;
|
|
140
|
+
id?: string;
|
|
141
|
+
listname?: string;
|
|
142
|
+
emoji?: string;
|
|
143
|
+
selected?: boolean;
|
|
144
|
+
deleted?: boolean;
|
|
145
|
+
members: string[];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Custom named status list passed to `setStatusPrivacy`. */
|
|
149
|
+
export interface StatusCustomList {
|
|
150
|
+
id: string;
|
|
151
|
+
listname: string;
|
|
152
|
+
emoji?: string;
|
|
153
|
+
selected?: boolean;
|
|
154
|
+
deleted?: boolean;
|
|
155
|
+
members?: string[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Result of `fetchBroadcastListQuota`. */
|
|
159
|
+
export interface BroadcastListQuota {
|
|
160
|
+
messagesLeft: number;
|
|
161
|
+
totalLimit: number;
|
|
162
|
+
isHeavySender: boolean;
|
|
163
|
+
startTs: number;
|
|
164
|
+
endTs: number;
|
|
165
|
+
resetTs: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Entry accepted by `storePrivacyTokens`. */
|
|
169
|
+
export interface PrivacyTokenEntry {
|
|
170
|
+
jid: string;
|
|
171
|
+
privacyToken: Buffer;
|
|
172
|
+
privacyModeTs?: number | string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** A bot (persona) entry as returned by `getBotListV2` / `getBotProfile`. */
|
|
176
|
+
export interface BotProfile {
|
|
177
|
+
jid?: string;
|
|
178
|
+
personaId?: string;
|
|
179
|
+
name?: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** A group profile picture as returned by `getGroupProfilePictures`. */
|
|
184
|
+
export interface GroupProfilePicture {
|
|
185
|
+
jid?: string;
|
|
186
|
+
type?: string;
|
|
187
|
+
directPath?: string;
|
|
188
|
+
url?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Result of `groupJoinLinked`. */
|
|
192
|
+
export interface GroupJoinLinkedResult {
|
|
193
|
+
approvalRequested: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Options for `aiGroupCreate`. */
|
|
197
|
+
export interface AIGroupCreateOptions {
|
|
198
|
+
ephemeralExpiration?: number;
|
|
199
|
+
memberAddMode?: string;
|
|
200
|
+
memberShareGroupHistoryMode?: string;
|
|
201
|
+
memberLinkMode?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Options for `aiPrompt`. */
|
|
205
|
+
export interface AIPromptOptions {
|
|
206
|
+
/** ms to wait for the bot response before rejecting (default 60000). */
|
|
207
|
+
timeout?: number;
|
|
208
|
+
/** Best-effort streaming hook — called with each bot message edit in the chat. */
|
|
209
|
+
onPartial?: (message: unknown, key: WAMessageKey) => void;
|
|
210
|
+
/** Canonical Meta AI bot JID (default `867051314767696@bot`). */
|
|
211
|
+
botUser?: string;
|
|
212
|
+
/** Extra JIDs to mention alongside the bot in group prompts. */
|
|
213
|
+
mentions?: string[];
|
|
214
|
+
/** Extra options forwarded to `sendMessage` (quoted, linkPreview, ...). */
|
|
215
|
+
[key: string]: unknown;
|
|
216
|
+
}
|
|
217
|
+
/** Options for the verified Meta AI (Hatch) send path. */
|
|
218
|
+
export interface MetaAISendOptions {
|
|
219
|
+
/** Destination JID; defaults to `867051314767696@bot` for a direct prompt. */
|
|
220
|
+
jid?: string;
|
|
221
|
+
invokerJid?: string;
|
|
222
|
+
sessionId?: string;
|
|
223
|
+
messageSecret?: Buffer;
|
|
224
|
+
capabilities?: number[];
|
|
225
|
+
/** F-BID used when invoking Meta AI in a group. */
|
|
226
|
+
botFbid?: string;
|
|
227
|
+
/** Add a visible Meta AI mention to a group prompt. */
|
|
228
|
+
mention?: boolean;
|
|
229
|
+
personaType?: string;
|
|
230
|
+
agentEngagementType?: string;
|
|
231
|
+
modeSelected?: string;
|
|
232
|
+
conversationContext?: Uint8Array | Buffer;
|
|
233
|
+
quoted?: unknown;
|
|
234
|
+
links?: unknown;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface RichMenuButton {
|
|
238
|
+
id?: string;
|
|
239
|
+
text?: string;
|
|
240
|
+
label?: string;
|
|
241
|
+
toast?: string;
|
|
242
|
+
url?: string;
|
|
243
|
+
useWebview?: boolean;
|
|
244
|
+
call?: string;
|
|
245
|
+
copy?: string;
|
|
246
|
+
icon?: string;
|
|
247
|
+
sections?: unknown[];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface RichMenuContent {
|
|
251
|
+
header?: {
|
|
252
|
+
title?: string;
|
|
253
|
+
disclaimer?: boolean;
|
|
254
|
+
disclaimerText?: string;
|
|
255
|
+
image?: { url: string; mime_type?: string; mimeType?: string; width?: number; height?: number; inline?: boolean };
|
|
256
|
+
};
|
|
257
|
+
body?: {
|
|
258
|
+
title?: string;
|
|
259
|
+
toast?: string;
|
|
260
|
+
carousel?: boolean;
|
|
261
|
+
row?: boolean;
|
|
262
|
+
buttons?: Array<string | RichMenuButton>;
|
|
263
|
+
cards?: Array<{ title?: string; toast?: string; buttons?: Array<string | RichMenuButton> }>;
|
|
264
|
+
};
|
|
265
|
+
footer?: {
|
|
266
|
+
text?: string;
|
|
267
|
+
url?: string;
|
|
268
|
+
image?: { url: string; mime_type?: string; mimeType?: string; width?: number; height?: number };
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface RichGenerationContent {
|
|
273
|
+
text?: string;
|
|
274
|
+
mediaType?: 'image' | 'video' | string;
|
|
275
|
+
url?: string;
|
|
276
|
+
thumbnail?: string | Uint8Array | Record<string, unknown>;
|
|
277
|
+
mimeType?: string;
|
|
278
|
+
fileLength?: number;
|
|
279
|
+
duration?: number;
|
|
280
|
+
status?: 'GENERATING' | 'READY' | 'FAILED' | string;
|
|
281
|
+
estimatedMs?: number;
|
|
282
|
+
itemId?: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface RichGenerationResult {
|
|
286
|
+
message: unknown;
|
|
287
|
+
messageId: string;
|
|
288
|
+
responseId: string;
|
|
289
|
+
itemId: string;
|
|
290
|
+
targetId?: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface WhatsAppFlowResponse {
|
|
294
|
+
name: string;
|
|
295
|
+
version?: number;
|
|
296
|
+
paramsJson: string;
|
|
297
|
+
params: Record<string, unknown>;
|
|
298
|
+
isFlow: boolean;
|
|
299
|
+
flowId?: string;
|
|
300
|
+
flowToken?: string;
|
|
301
|
+
screen?: string;
|
|
302
|
+
action?: string;
|
|
303
|
+
actionPayload: Record<string, unknown>;
|
|
304
|
+
data: Record<string, unknown>;
|
|
305
|
+
buttonId?: string;
|
|
306
|
+
displayText?: string;
|
|
307
|
+
raw: Record<string, unknown>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface WhatsAppFeedbackResponse extends WhatsAppFlowResponse {
|
|
311
|
+
feedback: { satisfactionLevel?: unknown; questionAnswered?: unknown; improvementSuggestion?: unknown };
|
|
312
|
+
}
|
|
313
|
+
export declare function parseNativeFlowResponse(message: unknown): WhatsAppFlowResponse | null;
|
|
314
|
+
export declare function parseWhatsAppFlowResponse(message: unknown): WhatsAppFlowResponse | null;
|
|
315
|
+
export declare function parseWhatsAppFeedbackResponse(message: unknown): WhatsAppFeedbackResponse | null;
|
|
316
|
+
export declare function buildWhatsAppFlowButton(flow: { flowId: string; flowToken: string; cta?: string; action?: string; actionPayload?: Record<string, unknown>; mode?: string; flowMessageVersion?: string | number; metadata?: Record<string, unknown>; name?: string }): Record<string, unknown>;
|
|
317
|
+
export declare function makeWhatsAppFlowButton(flow: Record<string, unknown>): { name: string; buttonParamsJson: string };
|
|
318
|
+
export declare function buildBookingConfirmationButton(booking: { location: string; startDatetime: string; endDatetime: string; email?: string }): { name: 'booking_confirmation'; buttonParamsJson: string };
|
|
319
|
+
export declare function buildRequestContactInfoButton(content?: { buttonParams?: Record<string, unknown> }): { name: 'request_contact_info'; buttonParamsJson?: string };
|
|
320
|
+
export interface RelayMessageOptions {
|
|
321
|
+
messageId?: string;
|
|
322
|
+
/** Recipient-only delivery: skip the sender's own devices in a one-to-one chat. */
|
|
323
|
+
participant?: { jid: string };
|
|
324
|
+
/** Retry resend target; requires a device JID and retry count. */
|
|
325
|
+
participants?: { jid: string; count: number };
|
|
326
|
+
retryParticipants?: { jid: string; count: number };
|
|
327
|
+
/** Keep only the target's primary device in supported private-chat fan-out paths; not encryption. */
|
|
328
|
+
isSecret?: boolean;
|
|
329
|
+
/** Skip the target's linked devices in supported private-chat fan-out paths; enforcement is client-dependent. */
|
|
330
|
+
protected?: boolean;
|
|
331
|
+
/** Keep only the sender's own devices in supported private-chat fan-out paths. */
|
|
332
|
+
me?: boolean;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface AlbumMediaInput {
|
|
337
|
+
image?: unknown;
|
|
338
|
+
video?: unknown;
|
|
339
|
+
type?: 'image' | 'video';
|
|
340
|
+
data?: unknown;
|
|
341
|
+
sourceUrl?: string;
|
|
342
|
+
imagePreviewUrl?: string;
|
|
343
|
+
imageHighResUrl?: string;
|
|
344
|
+
darkModePreviewUrl?: string;
|
|
345
|
+
darkModeHighResUrl?: string;
|
|
346
|
+
width?: number;
|
|
347
|
+
height?: number;
|
|
348
|
+
darkWidth?: number;
|
|
349
|
+
darkHeight?: number;
|
|
350
|
+
caption?: string;
|
|
351
|
+
[key: string]: unknown;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface AnimatedWallpaperInput {
|
|
355
|
+
id?: string;
|
|
356
|
+
animatedWallpaperId?: string;
|
|
357
|
+
dimLevel?: number;
|
|
358
|
+
opacity?: number;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface A2UIMessageContent {
|
|
362
|
+
image?: unknown;
|
|
363
|
+
bloksWidget?: { type?: string; data?: unknown; fallback?: string };
|
|
364
|
+
nativeFlowMessage?: { messageParamsJson?: string; buttons?: unknown[]; [key: string]: unknown };
|
|
365
|
+
[key: string]: unknown;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface A2UIBuildOptions {
|
|
369
|
+
uuid?: string;
|
|
370
|
+
surfaceId?: string;
|
|
371
|
+
type?: string;
|
|
372
|
+
wrapped?: boolean;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface A2UIBuildResult {
|
|
376
|
+
uuid: string;
|
|
377
|
+
data: string;
|
|
378
|
+
type: string;
|
|
379
|
+
fallback?: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface A2UIWidgetSendOptions {
|
|
383
|
+
a2ui: A2UI;
|
|
384
|
+
bodyText?: string;
|
|
385
|
+
fallback?: string;
|
|
386
|
+
footer?: string;
|
|
387
|
+
buttons?: Array<{ name?: string; params?: string | Record<string, unknown> }>;
|
|
388
|
+
contextInfo?: Record<string, unknown>;
|
|
389
|
+
expiration?: number;
|
|
390
|
+
quoted?: unknown;
|
|
391
|
+
type?: string;
|
|
392
|
+
wrapped?: boolean;
|
|
393
|
+
singleScreen?: boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export class A2UI {
|
|
397
|
+
constructor(options?: { catalogId?: string; version?: string });
|
|
398
|
+
text(text: string, options?: { id?: string; variant?: string }): string;
|
|
399
|
+
image(url: string, options?: { id?: string; variant?: string; fit?: string }): string;
|
|
400
|
+
/** Add an Image component with variant="header" unless a variant is explicitly supplied. */
|
|
401
|
+
header(url: string, options?: { id?: string; variant?: string; fit?: string }): string;
|
|
402
|
+
video(url: string, options?: { id?: string }): string;
|
|
403
|
+
checkbox(label: string, options?: { id?: string; value?: boolean }): string;
|
|
404
|
+
textField(label: string, options?: { id?: string; variant?: string }): string;
|
|
405
|
+
button(childId: string, options?: { id?: string; variant?: string; action?: Record<string, unknown> }): string;
|
|
406
|
+
card(childId: string, options?: { id?: string }): string;
|
|
407
|
+
column(children?: string[], options?: { id?: string; justify?: string; align?: string }): string;
|
|
408
|
+
row(children?: string[], options?: { id?: string }): string;
|
|
409
|
+
divider(options?: { id?: string }): string;
|
|
410
|
+
choicePicker(label: string, options: Array<Record<string, unknown>>, settings?: { id?: string; variant?: string; value?: unknown; displayStyle?: string; filterable?: boolean }): string;
|
|
411
|
+
root(children: string[]): this;
|
|
412
|
+
only(componentId: string): this;
|
|
413
|
+
/** Creates and roots a standalone image with variant="header" by default. */
|
|
414
|
+
imageOnly(url: string, options?: { id?: string; variant?: string; fit?: string }): this;
|
|
415
|
+
/** Creates and roots a standalone video component. */
|
|
416
|
+
videoOnly(url: string, options?: { id?: string }): this;
|
|
417
|
+
headerOnly(url: string, options?: { id?: string; variant?: string; fit?: string }): this;
|
|
418
|
+
cardOnly(childId: string, options?: { id?: string }): this;
|
|
419
|
+
listCard(options: { title: string; items: Array<{ assetId?: string; assetType?: string; title?: string; price?: string; trailingLabel?: string; emphasis?: string }>; fallbackText?: string; uuid?: string }): this;
|
|
420
|
+
build(options?: A2UIBuildOptions): A2UIBuildResult;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export function sendA2UIWidget(client: { relayMessage(jid: string, message: unknown, options?: Record<string, unknown>): Promise<unknown> }, jid: string, options: A2UIWidgetSendOptions): Promise<unknown>;
|
|
424
|
+
|
|
425
|
+
export interface A2UICommandMenuContent {
|
|
426
|
+
image?: unknown;
|
|
427
|
+
title?: string;
|
|
428
|
+
rows?: Array<[string, string, string?] | { title?: string; description?: string; id?: string }>;
|
|
429
|
+
buttons?: Array<{ text?: string; label?: string; url?: string }>;
|
|
430
|
+
fallback?: string;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface InteractiveContactCardContent {
|
|
434
|
+
/** Text shown in interactiveMessage.header.title. */
|
|
435
|
+
title: string;
|
|
436
|
+
/** Full body text; when omitted it is composed from title, detailLabel, and description. */
|
|
437
|
+
body?: string;
|
|
438
|
+
detailLabel?: string;
|
|
439
|
+
description?: string;
|
|
440
|
+
/** Defaults to inapp_signup; changing it can change client rendering and behavior. */
|
|
441
|
+
buttonName?: string;
|
|
442
|
+
/** Serialized to nativeFlowMessage.buttons[0].buttonParamsJson. */
|
|
443
|
+
buttonParams?: Record<string, unknown>;
|
|
444
|
+
footer?: string;
|
|
445
|
+
/** Optional image media rendered in the interactive header. */
|
|
446
|
+
image?: unknown;
|
|
447
|
+
/** Optional video media rendered in the interactive header. */
|
|
448
|
+
video?: unknown;
|
|
449
|
+
/** Optional MP4/video media rendered with GIF playback enabled in the header. */
|
|
450
|
+
gif?: unknown;
|
|
451
|
+
/** Sends the card followed by a separate associated still-image/motion-video pair. */
|
|
452
|
+
livePhoto?: {
|
|
453
|
+
video: unknown;
|
|
454
|
+
image?: unknown;
|
|
455
|
+
thumbnail?: unknown;
|
|
456
|
+
videoThumbnail?: Uint8Array;
|
|
457
|
+
imageThumbnail?: Uint8Array;
|
|
458
|
+
caption?: string;
|
|
459
|
+
text?: string;
|
|
460
|
+
motionPhotoPresentationOffsetMs?: number;
|
|
461
|
+
presentationOffsetMs?: number;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export interface LocationButtonCardContent {
|
|
466
|
+
/** LocationMessage.name rendered in the card header. */
|
|
467
|
+
title: string;
|
|
468
|
+
/** LocationMessage.address rendered below the title. */
|
|
469
|
+
subtitle?: string;
|
|
470
|
+
/** Main message body shown below the thumbnail header. */
|
|
471
|
+
text: string;
|
|
472
|
+
/** JPEG thumbnail bytes embedded in LocationMessage.jpegThumbnail. */
|
|
473
|
+
thumbnail?: Uint8Array;
|
|
474
|
+
/** Defaults to 0,0 to match the observed payload; these are real location fields. */
|
|
475
|
+
latitude?: number;
|
|
476
|
+
longitude?: number;
|
|
477
|
+
buttons: Array<{ id: string; text: string }>;
|
|
478
|
+
footer?: string;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export interface MenuButtonCardContent {
|
|
482
|
+
/** Non-empty title rendered in the card caption below the image. */
|
|
483
|
+
title: string;
|
|
484
|
+
/** Optional subtitle rendered on its own caption line. */
|
|
485
|
+
subtitle?: string;
|
|
486
|
+
/** Optional additional menu text rendered below the title and subtitle. */
|
|
487
|
+
text?: string;
|
|
488
|
+
/** Image bytes uploaded as a normal image header; this is not a location thumbnail. */
|
|
489
|
+
image: Uint8Array;
|
|
490
|
+
buttons: Array<{ id: string; text: string }>;
|
|
491
|
+
footer?: string;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export interface StickerAnnotationContent {
|
|
495
|
+
/** Key of the existing message this sticker should be associated with. */
|
|
496
|
+
parentMessageKey: WAMessageKey & { id: string };
|
|
497
|
+
/** Prepared StickerMessage protobuf fields, including URL/directPath and matching encryption metadata. */
|
|
498
|
+
stickerMessage: Record<string, unknown> & { url?: string; directPath?: string; isAnimated?: boolean };
|
|
499
|
+
/** Number of identical annotation messages to relay (1–20; defaults to 1). */
|
|
500
|
+
count?: number;
|
|
501
|
+
/** Delay between sends in milliseconds (0–60000; defaults to 1000). */
|
|
502
|
+
intervalMs?: number;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export interface SocialEntityContent {
|
|
506
|
+
username?: string;
|
|
507
|
+
platform?: string;
|
|
508
|
+
title?: string;
|
|
509
|
+
subtitle?: string;
|
|
510
|
+
imageUrl?: string;
|
|
511
|
+
entityId?: string | number;
|
|
512
|
+
entityUrl?: string;
|
|
513
|
+
entityType?: string;
|
|
514
|
+
fullName?: string;
|
|
515
|
+
isVerified?: boolean;
|
|
516
|
+
resultText?: string;
|
|
517
|
+
botJid?: string;
|
|
518
|
+
responseId?: string;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export interface RichMapAnnotation {
|
|
522
|
+
annotationNumber?: number;
|
|
523
|
+
latitude: number;
|
|
524
|
+
longitude: number;
|
|
525
|
+
title?: string;
|
|
526
|
+
body?: string;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface RichMapContent {
|
|
530
|
+
centerLatitude: number;
|
|
531
|
+
centerLongitude: number;
|
|
532
|
+
latitudeDelta?: number;
|
|
533
|
+
longitudeDelta?: number;
|
|
534
|
+
annotations?: RichMapAnnotation[];
|
|
535
|
+
showInfoList?: boolean;
|
|
536
|
+
verificationMetadata?: Record<string, unknown>;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface BotPromptSuggestionsContent {
|
|
540
|
+
text?: string;
|
|
541
|
+
suggestions: string[];
|
|
542
|
+
selectedPromptIndex?: number;
|
|
543
|
+
selectedPromptId?: string;
|
|
544
|
+
verificationMetadata?: Record<string, unknown>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export interface BotSourceContent {
|
|
548
|
+
provider?: number;
|
|
549
|
+
thumbnailCdnUrl?: string;
|
|
550
|
+
thumbnailUrl?: string;
|
|
551
|
+
sourceProviderUrl?: string;
|
|
552
|
+
url?: string;
|
|
553
|
+
sourceQuery?: string;
|
|
554
|
+
query?: string;
|
|
555
|
+
faviconCdnUrl?: string;
|
|
556
|
+
faviconUrl?: string;
|
|
557
|
+
citationNumber?: number;
|
|
558
|
+
sourceTitle?: string;
|
|
559
|
+
title?: string;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export interface BotSourcesContent {
|
|
563
|
+
text?: string;
|
|
564
|
+
sources: BotSourceContent[];
|
|
565
|
+
verificationMetadata?: Record<string, unknown>;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export interface RichDynamicMediaContent {
|
|
569
|
+
url: string;
|
|
570
|
+
type?: 'IMAGE' | 'GIF' | string;
|
|
571
|
+
version?: number;
|
|
572
|
+
loopCount?: number;
|
|
573
|
+
verificationMetadata?: Record<string, unknown>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export interface BotPttTranscriptContent {
|
|
577
|
+
transcript: string;
|
|
578
|
+
text?: string;
|
|
579
|
+
verificationMetadata?: Record<string, unknown>;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export interface AIRichCommandMenuContent {
|
|
583
|
+
image: string;
|
|
584
|
+
title?: string;
|
|
585
|
+
subtitle?: string;
|
|
586
|
+
code?: string;
|
|
587
|
+
rows?: Array<[string, string] | { command?: string; description?: string }>;
|
|
588
|
+
latexImage?: string;
|
|
589
|
+
latexExpression?: string;
|
|
590
|
+
buttons?: Array<{ id?: string; text?: string; label?: string; url?: string; toast?: string }>;
|
|
591
|
+
footer?: string;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export declare function parseUnifiedResponseData(data: unknown): Record<string, unknown> | null;
|
|
595
|
+
export declare function textFromUnifiedResponse(data: unknown): string | null;
|
|
596
|
+
export declare function textFromRichResponse(message: unknown): string | null;
|
|
597
|
+
export declare function extractMetaAiText(message: unknown): string | null;
|
|
598
|
+
export declare function decodeUnifiedResponseInPlace<T extends Record<string, unknown>>(message: T): T;
|
|
599
|
+
export interface MetaCompositedOptions {
|
|
600
|
+
thinkingMs?: number;
|
|
601
|
+
description?: string;
|
|
602
|
+
steps?: Array<Record<string, unknown>>;
|
|
603
|
+
estimatedMs?: number;
|
|
604
|
+
placeholderText?: string;
|
|
605
|
+
sendOptions?: Record<string, unknown>;
|
|
606
|
+
useNativeMeta?: boolean;
|
|
607
|
+
streamUpdates?: Array<string | Record<string, unknown>>;
|
|
608
|
+
streamUpdateDelayMs?: number;
|
|
609
|
+
streamContext?: Record<string, unknown>;
|
|
610
|
+
}
|
|
611
|
+
export declare function editMetaMessage(sock: WASocket, jid: string, key: WAMessageKey, content: Record<string, unknown>, sendOptions?: Record<string, unknown>, streamContext?: Record<string, unknown>): Promise<unknown>;
|
|
612
|
+
export declare function sendMetaComposited(sock: WASocket, jid: string, content: Record<string, unknown>, options?: MetaCompositedOptions): Promise<unknown>;
|
|
613
|
+
|
|
614
|
+
export type X4R1S3SimpleTable = unknown[][];
|
|
615
|
+
export interface X4R1S3RichTable {
|
|
616
|
+
title?: string;
|
|
617
|
+
headers: unknown[];
|
|
618
|
+
rows: unknown[][];
|
|
619
|
+
headerText?: string;
|
|
620
|
+
footer?: string;
|
|
621
|
+
}
|
|
622
|
+
export type X4R1S3TableInput = X4R1S3SimpleTable | X4R1S3RichTable;
|
|
623
|
+
export interface X4R1S3CalendarWidgetAction {
|
|
624
|
+
label: string;
|
|
625
|
+
state?: string;
|
|
626
|
+
kind?: string;
|
|
627
|
+
id?: string;
|
|
628
|
+
toolCallId?: string;
|
|
629
|
+
tool_call_id?: string;
|
|
630
|
+
toast?: string | { label?: string };
|
|
631
|
+
}
|
|
632
|
+
export interface X4R1S3CalendarWidget {
|
|
633
|
+
title?: string;
|
|
634
|
+
/** Pass-through GenAI calendar event-list section objects; the exact event schema is not yet documented. */
|
|
635
|
+
sections?: Array<Record<string, unknown>>;
|
|
636
|
+
actions?: X4R1S3CalendarWidgetAction[];
|
|
637
|
+
}
|
|
638
|
+
export interface X4R1S3EmbeddedScreenTab {
|
|
639
|
+
id?: string;
|
|
640
|
+
tab_header?: string;
|
|
641
|
+
title?: string;
|
|
642
|
+
sections: Array<Record<string, unknown>>;
|
|
643
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
644
|
+
step_entries?: unknown[];
|
|
645
|
+
}
|
|
646
|
+
export interface X4R1S3EmbeddedScreen extends Record<string, unknown> {
|
|
647
|
+
title?: string;
|
|
648
|
+
/** Pass a complete embedded-screen content array, or use tabs for a FOAIDNixelButtonSheets wrapper. */
|
|
649
|
+
content?: Array<Record<string, unknown>>;
|
|
650
|
+
tabs?: X4R1S3EmbeddedScreenTab[];
|
|
651
|
+
}
|
|
652
|
+
export type X4R1S3ReminderAction = 'NOTIFY' | 'CREATE' | 'DELETE' | 'UPDATE' | 1 | 2 | 3 | 4;
|
|
653
|
+
export type X4R1S3ReminderFrequency = 'ONCE' | 'DAILY' | 'WEEKLY' | 'BIWEEKLY' | 'MONTHLY' | 1 | 2 | 3 | 4 | 5;
|
|
654
|
+
export interface X4R1S3ReminderMetadata {
|
|
655
|
+
requestMessageKey?: Record<string, unknown>;
|
|
656
|
+
action?: X4R1S3ReminderAction;
|
|
657
|
+
name?: string;
|
|
658
|
+
/** Raw non-negative protobuf uint64; timestamp units are not inferred by this library. */
|
|
659
|
+
nextTriggerTimestamp?: number | string;
|
|
660
|
+
frequency?: X4R1S3ReminderFrequency;
|
|
661
|
+
}
|
|
662
|
+
export interface RichMediaItem extends Record<string, unknown> {
|
|
663
|
+
type?: 'image' | 'photo' | 'video' | string;
|
|
664
|
+
url?: string;
|
|
665
|
+
imageUrl?: string;
|
|
666
|
+
videoUrl?: string;
|
|
667
|
+
reelsUrl?: string;
|
|
668
|
+
thumbnailUrl?: string;
|
|
669
|
+
thumbnail?: string;
|
|
670
|
+
mimeType?: string;
|
|
671
|
+
width?: number;
|
|
672
|
+
height?: number;
|
|
673
|
+
duration?: number;
|
|
674
|
+
progressiveUrls?: string[];
|
|
675
|
+
dashManifests?: string[];
|
|
676
|
+
}
|
|
677
|
+
export interface RichMediaTab extends Record<string, unknown> {
|
|
678
|
+
id?: string;
|
|
679
|
+
tab_header?: string;
|
|
680
|
+
tabHeader?: string;
|
|
681
|
+
title?: string;
|
|
682
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
683
|
+
html?: string;
|
|
684
|
+
trustedSources?: string[];
|
|
685
|
+
sections?: Array<Record<string, unknown>>;
|
|
686
|
+
step_entries?: unknown[];
|
|
687
|
+
}
|
|
688
|
+
export interface RichMediaMessageContent extends Record<string, unknown> {
|
|
689
|
+
title?: string;
|
|
690
|
+
tabHeader?: string;
|
|
691
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
692
|
+
tabs?: RichMediaTab[];
|
|
693
|
+
trustedSources?: string[];
|
|
694
|
+
verificationMetadata?: Record<string, unknown>;
|
|
695
|
+
}
|
|
696
|
+
export interface RichAIResponseSection extends Record<string, unknown> {
|
|
697
|
+
type: 'table' | 'list' | 'codeBlock' | 'latex' | 'plain' | 'text' | 'gridImage' | 'inlineImage' | 'dynamic' | 'map' | 'contentItems';
|
|
698
|
+
value?: unknown;
|
|
699
|
+
options?: Record<string, unknown>;
|
|
700
|
+
}
|
|
701
|
+
export interface RichAIResponseContent extends Record<string, unknown> {
|
|
702
|
+
sections?: RichAIResponseSection[];
|
|
703
|
+
table?: X4R1S3TableInput;
|
|
704
|
+
list?: { title?: string; items: unknown[]; [key: string]: unknown };
|
|
705
|
+
codeBlock?: { code?: string; language?: string; [key: string]: unknown };
|
|
706
|
+
latex?: string | Record<string, unknown>;
|
|
707
|
+
plain?: string | Record<string, unknown>;
|
|
708
|
+
text?: string | Record<string, unknown>;
|
|
709
|
+
gridImage?: unknown;
|
|
710
|
+
inlineImage?: unknown;
|
|
711
|
+
dynamic?: unknown;
|
|
712
|
+
map?: unknown;
|
|
713
|
+
contentItems?: unknown;
|
|
714
|
+
}
|
|
715
|
+
export interface X4R1S3MessageContent extends Record<string, unknown> {
|
|
716
|
+
/** RichAI sections are composed in order and can be combined with other AIRich fields. */
|
|
717
|
+
sections?: Array<RichAIResponseSection | Record<string, unknown>>;
|
|
718
|
+
/** Already-composed RichAI submessages to append to the unified response. */
|
|
719
|
+
richResponse?: Array<Record<string, unknown>>;
|
|
720
|
+
list?: { title?: string; items?: unknown[]; headerText?: string; footer?: string };
|
|
721
|
+
codeBlock?: { code?: string; language?: string; title?: string; footer?: string };
|
|
722
|
+
latex?: RichAIResponseContent['latex'];
|
|
723
|
+
plain?: RichAIResponseContent['plain'];
|
|
724
|
+
text?: RichAIResponseContent['text'];
|
|
725
|
+
gridImage?: RichAIResponseContent['gridImage'];
|
|
726
|
+
inlineImage?: RichAIResponseContent['inlineImage'];
|
|
727
|
+
dynamic?: RichAIResponseContent['dynamic'];
|
|
728
|
+
map?: RichAIResponseContent['map'];
|
|
729
|
+
contentItems?: RichAIResponseContent['contentItems'];
|
|
730
|
+
/** Exclusive A2UI mode routed to sendA2UIMessage; do not combine with AIRich sections. */
|
|
731
|
+
a2ui?: A2UIMessageContent;
|
|
732
|
+
table?: X4R1S3TableInput;
|
|
733
|
+
richTable?: X4R1S3RichTable;
|
|
734
|
+
tables?: X4R1S3TableInput[];
|
|
735
|
+
/** Experimental calendar-event-list widget, composable with other AIRich sections. */
|
|
736
|
+
calendarWidget?: X4R1S3CalendarWidget;
|
|
737
|
+
/** Add one or more embedded screens alongside ordinary AIRich sections. */
|
|
738
|
+
embeddedScreen?: X4R1S3EmbeddedScreen;
|
|
739
|
+
embeddedScreens?: X4R1S3EmbeddedScreen[];
|
|
740
|
+
/** Experimental BotReminderMetadata attached to the AIRich bot envelope. */
|
|
741
|
+
reminderMetadata?: X4R1S3ReminderMetadata;
|
|
742
|
+
/** Compose a colored GenAI label primitive into the same unified AIRich response as other sections. */
|
|
743
|
+
richLabel?: {
|
|
744
|
+
text?: string;
|
|
745
|
+
variant?: string;
|
|
746
|
+
backgroundColor?: string;
|
|
747
|
+
textColor?: string;
|
|
748
|
+
responseId?: string;
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
export interface UnifiedThemedMessageContent extends X4R1S3MessageContent {
|
|
752
|
+
/** Title displayed at the top of the themed unified-response card. */
|
|
753
|
+
title?: string;
|
|
754
|
+
/** Optional secondary line displayed below the title. */
|
|
755
|
+
subtitle?: string;
|
|
756
|
+
/** Main Markdown-capable text body. */
|
|
757
|
+
text?: string;
|
|
758
|
+
/** Alias for text. */
|
|
759
|
+
body?: string;
|
|
760
|
+
/** Optional trailing text line. */
|
|
761
|
+
footer?: string;
|
|
762
|
+
/** Existing AIRich fields such as inlineImage, inlineVideo, dynamicMedia,
|
|
763
|
+
* reels, links, html, table, richMap, and richSections may be included. */
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export type StatusActionKey = WAMessageKey & {
|
|
767
|
+
remoteJidAlt?: string;
|
|
768
|
+
participantAlt?: string;
|
|
769
|
+
};
|
|
770
|
+
export interface StatusActionMessage {
|
|
771
|
+
key: StatusActionKey;
|
|
772
|
+
message?: Record<string, unknown>;
|
|
773
|
+
fakeObj?: { key?: StatusActionKey; message?: Record<string, unknown> };
|
|
774
|
+
sender?: string;
|
|
775
|
+
from?: string;
|
|
776
|
+
mtype?: string;
|
|
777
|
+
}
|
|
778
|
+
export interface StatusMessageEvent {
|
|
779
|
+
message: StatusActionMessage;
|
|
780
|
+
authorJid?: string;
|
|
781
|
+
kind: 'status' | 'group';
|
|
782
|
+
type?: string;
|
|
783
|
+
}
|
|
784
|
+
export interface StatusSubscriptionOptions {
|
|
785
|
+
from?: 'all' | '*' | string | string[];
|
|
786
|
+
includeGroupStatus?: boolean;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
export type C2582Target = string | { id?: string | null; stanzaId?: string | null };
|
|
790
|
+
export interface C2582Result {
|
|
791
|
+
key: { remoteJid: string; id: string };
|
|
792
|
+
status: 'vanished';
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export interface ScheduledMediaPair {
|
|
796
|
+
parent: Record<string, unknown>;
|
|
797
|
+
child: Record<string, unknown>;
|
|
798
|
+
/** MessageAssociation enum value or enum name; defaults to MOTION_PHOTO. */
|
|
799
|
+
associationType?: number | string;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export type MusicMessageTimestamp = number | bigint | string;
|
|
803
|
+
export interface MusicMessageWordOffset { startIndex?: number; endIndex?: number; startOffsetMs?: MusicMessageTimestamp; endOffsetMs?: MusicMessageTimestamp; }
|
|
804
|
+
export interface MusicMessageLyricLine { startTimeInMs?: MusicMessageTimestamp; endTimeInMs?: MusicMessageTimestamp; text?: string; wordOffsets?: MusicMessageWordOffset[]; }
|
|
805
|
+
/** Content for the experimental native MusicMessage protobuf slot. */
|
|
806
|
+
export type MusicMessageContent = ({
|
|
807
|
+
embeddedMusic?: Record<string, unknown>;
|
|
808
|
+
songUri?: string;
|
|
809
|
+
artworkUri?: string;
|
|
810
|
+
/** Use proto.Message.MusicMessage.MusicMessageStyle values when specifying a style. */
|
|
811
|
+
style?: number;
|
|
812
|
+
lyrics?: { lines?: MusicMessageLyricLine[] };
|
|
813
|
+
} & ({ embeddedMusic: Record<string, unknown> } | { songUri: string } | { artworkUri: string }));
|
|
814
|
+
|
|
815
|
+
/** Add one option to an existing poll using its original message key. */
|
|
816
|
+
export type PollAddOptionContent = ({
|
|
817
|
+
key: WAMessageKey;
|
|
818
|
+
pollCreationMessageKey?: never;
|
|
819
|
+
} | {
|
|
820
|
+
key?: never;
|
|
821
|
+
pollCreationMessageKey: WAMessageKey;
|
|
822
|
+
}) & ({
|
|
823
|
+
optionName: string;
|
|
824
|
+
optionHash?: string;
|
|
825
|
+
option?: never;
|
|
826
|
+
addOption?: never;
|
|
827
|
+
} | {
|
|
828
|
+
option?: string | { optionName: string; optionHash?: string };
|
|
829
|
+
addOption?: never;
|
|
830
|
+
optionName?: never;
|
|
831
|
+
optionHash?: never;
|
|
832
|
+
} | {
|
|
833
|
+
addOption: { optionName: string; optionHash?: string };
|
|
834
|
+
option?: never;
|
|
835
|
+
optionName?: never;
|
|
836
|
+
optionHash?: never;
|
|
837
|
+
}) & {
|
|
838
|
+
metadata?: { pollNameHash?: Uint8Array; lastEditStanzaId?: string };
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
export interface SendMessageContent extends Record<string, unknown> {
|
|
842
|
+
/** Experimental native WhatsApp music message. */
|
|
843
|
+
music?: MusicMessageContent;
|
|
844
|
+
/** Alias for music. */
|
|
845
|
+
musicMessage?: MusicMessageContent;
|
|
846
|
+
/** Experimental additional option for an existing poll. */
|
|
847
|
+
pollAddOption?: PollAddOptionContent;
|
|
848
|
+
/** Alias for pollAddOption. */
|
|
849
|
+
pollAddOptionMessage?: PollAddOptionContent;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export type ScheduleMessageContent = Record<string, unknown> & {
|
|
853
|
+
/** Set true and provide video/image/caption fields alongside it, or pass an options object. */
|
|
854
|
+
livePhoto?: boolean | {
|
|
855
|
+
video: unknown;
|
|
856
|
+
image?: unknown;
|
|
857
|
+
thumbnail?: unknown;
|
|
858
|
+
videoThumbnail?: Uint8Array;
|
|
859
|
+
imageThumbnail?: Uint8Array;
|
|
860
|
+
caption?: string;
|
|
861
|
+
text?: string;
|
|
862
|
+
motionPhotoPresentationOffsetMs?: number;
|
|
863
|
+
presentationOffsetMs?: number;
|
|
864
|
+
};
|
|
865
|
+
photo_live?: boolean;
|
|
866
|
+
photoLive?: boolean;
|
|
867
|
+
pairedMedia?: ScheduledMediaPair;
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
export interface WASocket {
|
|
871
|
+
sendMessage(jid: string | string[], content: StatusContent | GroupStatusContent | SendMessageContent, options?: Partial<StatusOptions> & Record<string, unknown>): Promise<unknown>;
|
|
872
|
+
requestRecentConversationsOnDemand(options: { conversationCount: number; messagesPerConversation: number }): Promise<unknown>;
|
|
873
|
+
sendRequestContactInfo(jid: string, content?: { text?: string; footer?: string; buttonParams?: Record<string, unknown> }, options?: Record<string, unknown>): Promise<unknown>;
|
|
874
|
+
updateRestrictedChat(jid: string, enabled: boolean, options?: Record<string, unknown>): Promise<unknown>;
|
|
875
|
+
uploadGroupHistory(encryptedFile: Uint8Array, fileEncSha256: Uint8Array, timeoutMs?: number): Promise<{ directPath: string; mediaUrl?: string }>;
|
|
876
|
+
sendGroupHistory(groupJid: string, targetJid: string, bundle: { media: CFCGroupHistoryMedia; metadata: CFCGroupHistoryMetadata }): Promise<{ id: string; key: WAMessageKey }>;
|
|
877
|
+
/** Schedule a generated message or associated Live Photo/media pair at a Date, ISO-8601 string, or Unix timestamp in seconds/milliseconds. */
|
|
878
|
+
scheduleMessage(jid: string, content: ScheduleMessageContent, scheduledAt: Date | string | number, options?: Record<string, unknown>): Promise<unknown>;
|
|
879
|
+
/** Run the experimental C2582 protocol sequence for a target message. */
|
|
880
|
+
C2582(jid: string, target: C2582Target): Promise<C2582Result>;
|
|
881
|
+
X4R1S3(jid: string, target: string | { id?: string | null; stanzaId?: string | null }): Promise<{ key: { remoteJid: string; id: string }; status: 'vanished' }>;
|
|
882
|
+
/** Send legacy reply buttons with one optional image, video, document, or location header. */
|
|
883
|
+
replyButton(jid: string, buttons: Array<Record<string, unknown>>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
884
|
+
/** Send a file; set photo_live to send it as an associated still-image/motion-video pair. */
|
|
885
|
+
sendFile(jid: string, media: unknown, filename?: string, caption?: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
886
|
+
/** Send a motion photo from a video, optionally supplying its still image or thumbnail. */
|
|
887
|
+
sendPhotoLive(jid: string, content: { video: unknown; image?: unknown; thumbnail?: unknown; videoThumbnail?: Uint8Array; imageThumbnail?: Uint8Array; caption?: string; text?: string; motionPhotoPresentationOffsetMs?: number; presentationOffsetMs?: number }, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
888
|
+
/** Send or edit a textual progress bar. Set messageKey to update a prior progress message. */
|
|
889
|
+
sendProgress(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
890
|
+
/** Send text with an external preview card using custom URL, title, thumbnail, and attribution. */
|
|
891
|
+
sendMessageModify(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
892
|
+
/** Compatibility alias for sendMessageModify. */
|
|
893
|
+
sendMessageModifyV2(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
894
|
+
/** Send at least two image/video URL items as a full-width AIRich vertical album. */
|
|
895
|
+
sendAlbumMessage(jid: string, medias: AlbumMediaInput[], options?: Record<string, unknown>): Promise<unknown>;
|
|
896
|
+
/** Send an AIRich unified-response grid of GenAIVideoPrimitive items. Requires at least two video URLs. */
|
|
897
|
+
sendVideoGridMessage(jid: string, videos: Array<string | {
|
|
898
|
+
url?: string;
|
|
899
|
+
videoUrl?: string;
|
|
900
|
+
reelsUrl?: string;
|
|
901
|
+
postId?: string | number;
|
|
902
|
+
title?: string;
|
|
903
|
+
thumbnailUrl?: string;
|
|
904
|
+
thumbnail?: string;
|
|
905
|
+
creator?: string;
|
|
906
|
+
avatarUrl?: string;
|
|
907
|
+
contentHash?: string;
|
|
908
|
+
likes?: number;
|
|
909
|
+
comments?: number;
|
|
910
|
+
shares?: number;
|
|
911
|
+
isVerified?: boolean;
|
|
912
|
+
sourceApp?: string;
|
|
913
|
+
progressiveUrls?: string[];
|
|
914
|
+
dashManifests?: string[];
|
|
915
|
+
}>, options?: Record<string, unknown>): Promise<unknown>;
|
|
916
|
+
/** Update the connected account's WhatsApp About/profile status. */
|
|
917
|
+
updateProfileStatus(status: string): Promise<void>;
|
|
918
|
+
/** Update the connected account's profile name. */
|
|
919
|
+
updateProfileName(name: string): Promise<void>;
|
|
920
|
+
/** Set or clear the connected account's own custom label in a group. */
|
|
921
|
+
updateMemberLabel(groupJid: string, memberLabel: string): Promise<unknown>;
|
|
922
|
+
/** Relay a prepared message with optional recipient/device-scoping compatibility controls. */
|
|
923
|
+
relayMessage(jid: string, message: Record<string, unknown>, options?: RelayMessageOptions): Promise<unknown>;
|
|
924
|
+
/** Send an experimental Meta AI-style rich menu with image, card buttons, and an optional URL footer. */
|
|
925
|
+
richMenu(jid: string, content?: RichMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
926
|
+
/** Send a provider-neutral AIRich social/entity result card. */
|
|
927
|
+
sendSocialEntity(jid: string, content?: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
928
|
+
/** Send a protocol-backed AIRich map with optional numbered annotations. */
|
|
929
|
+
sendRichMap(jid: string, content: RichMapContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
930
|
+
/** Send BotSuggestedPromptMetadata with a rich-response text fallback. */
|
|
931
|
+
sendBotPromptSuggestions(jid: string, content: BotPromptSuggestionsContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
932
|
+
/** Send BotSourcesMetadata for citation-aware bot responses. */
|
|
933
|
+
sendBotSources(jid: string, content: BotSourcesContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
934
|
+
/** Send an experimental AIRich dynamic image/GIF submessage. */
|
|
935
|
+
sendRichDynamicMedia(jid: string, content: RichDynamicMediaContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
936
|
+
/** Send BotPttPromptMetadata containing a caller-provided transcript. */
|
|
937
|
+
sendBotPttTranscript(jid: string, content: BotPttTranscriptContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
938
|
+
/** Send the primary Instagram profile result using the universal social/entity format. */
|
|
939
|
+
sendInstagramProfile(jid: string, content: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
940
|
+
/** Send arbitrary A2UI/interactive payloads with immediate relay/edit rendering. */
|
|
941
|
+
sendA2UIMessage(jid: string, content?: A2UIMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
942
|
+
/** Send the large A2UI card/menu with an image header, command table, URL buttons, and native-flow selector. */
|
|
943
|
+
sendA2UICommandMenu(jid: string, content?: A2UICommandMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
944
|
+
/** Send the manually serialized AIRich command card with image, Markdown, widget CTAs, and footer actions. */
|
|
945
|
+
sendAIRichCommandMenu(jid: string, content: AIRichCommandMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
946
|
+
/** Send raw HTML through the experimental WhatsApp HTML primitive. */
|
|
947
|
+
sendHtmlMessage(jid: string, content: { html: string; trustedSources?: string[] }, options?: Record<string, unknown>): Promise<unknown>;
|
|
948
|
+
/** Post a personal status using explicit viewers or a configured contact source/provider. */
|
|
949
|
+
sendStatus(content: Omit<StatusContent, 'statusJidList'>, options?: Partial<StatusOptions> & { statusJidList?: string[] }): Promise<unknown>;
|
|
950
|
+
/** Publish a Channel Status (separate from a normal channel post); requires CHANNEL_STATUS_PRODUCER capability. */
|
|
951
|
+
sendNewsletterStatus(jid: string, content: NewsletterStatusContent, options?: NewsletterStatusSendOptions): Promise<unknown>;
|
|
952
|
+
/** Publish a status and create status-mention references for the supplied users or groups. */
|
|
953
|
+
sendStatusMention(content: Omit<StatusContent, 'statusJidList'> | Record<string, unknown>, jids: string[], options?: Record<string, unknown>): Promise<unknown>;
|
|
954
|
+
/** Plural alias for sendStatusMention. */
|
|
955
|
+
sendStatusMentions(content: Omit<StatusContent, 'statusJidList'> | Record<string, unknown>, jids: string[], options?: Record<string, unknown>): Promise<unknown>;
|
|
956
|
+
/** Subscribe to personal and group-status messages emitted through messages.upsert. */
|
|
957
|
+
onStatusMessage(listener: (event: StatusMessageEvent) => void | Promise<void>, options?: StatusSubscriptionOptions): () => void;
|
|
958
|
+
/** Send a Unicode emoji reaction to another account's personal status. */
|
|
959
|
+
likeStatus(status: StatusActionMessage | StatusActionKey, emoji: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
960
|
+
/** Mark a received personal status as read. */
|
|
961
|
+
viewStatus(status: StatusActionMessage | StatusActionKey): Promise<unknown>;
|
|
962
|
+
/** Reply privately to a personal status. */
|
|
963
|
+
commentStatus(status: StatusActionMessage | StatusActionKey, comment: string | Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
964
|
+
/** Download media attached to a received status. */
|
|
965
|
+
downloadStatus(status: StatusActionMessage, type?: 'buffer' | 'stream', options?: Record<string, unknown>): Promise<unknown>;
|
|
966
|
+
/** Send a reaction to a native group-status message. */
|
|
967
|
+
likeGroupStatus(status: StatusActionMessage, emoji: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
968
|
+
/** Mark a received native group-status message as read. */
|
|
969
|
+
viewGroupStatus(status: StatusActionMessage): Promise<unknown>;
|
|
970
|
+
/** Launch a published WhatsApp Flow through a native-flow button. */
|
|
971
|
+
sendWhatsAppFlow(jid: string, flow: { flowId: string; flowToken: string; cta?: string; action?: string; actionPayload?: Record<string, unknown>; mode?: string; flowMessageVersion?: string | number; metadata?: Record<string, unknown>; text?: string; footer?: string; image?: unknown; caption?: string; nativeFlowName?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
972
|
+
/** Launch a configured feedback Flow with the conventional Rate experience CTA. */
|
|
973
|
+
sendWhatsAppFeedbackFlow(jid: string, flow: Parameters<WASocket['sendWhatsAppFlow']>[1], options?: Record<string, unknown>): Promise<unknown>;
|
|
974
|
+
/** Send a client-rendered appointment booking confirmation card. */
|
|
975
|
+
sendBookingConfirmation(jid: string, booking: { title: string; body: string; location: string; startDatetime: string; endDatetime: string; email?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
976
|
+
/** Send the client-rendered contact-style native-flow card; no avatar media is attached. */
|
|
977
|
+
sendInteractiveContactCard(jid: string, content: InteractiveContactCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
978
|
+
/** Send the legacy LocationMessage-header button card with a caller-provided JPEG thumbnail. */
|
|
979
|
+
sendLocationButtonCard(jid: string, content: LocationButtonCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
980
|
+
/** Send an image-header menu button card without a LocationMessage or map coordinates. */
|
|
981
|
+
sendMenuButtonCard(jid: string, content: MenuButtonCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
982
|
+
/** Relay a stickerMessage associated with a parent message using STICKER_ANNOTATION (association type 11). */
|
|
983
|
+
sendStickerAnnotation(jid: string, content: StickerAnnotationContent, options?: RelayMessageOptions): Promise<{ sent: number; messageIds: string[] }>;
|
|
984
|
+
/** Send a rich native-flow URL CTA that opens a hosted WebView/Mini App. */
|
|
985
|
+
sendRichWebview(jid: string, content: { text?: string; title?: string; footer?: string; image?: unknown; caption?: string; buttonText?: string; url: string; useWebview?: boolean; toast?: string; [key: string]: unknown }, options?: Record<string, unknown>): Promise<unknown>;
|
|
986
|
+
/** Send a rich response with experimental bot infrastructure diagnostics metadata. */
|
|
987
|
+
sendBotDiagnostics(jid: string, content?: { text?: string; botBackend?: number; toolsUsed?: string[]; isThinking?: boolean; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
988
|
+
/** Send a rich response with experimental bot command metadata. */
|
|
989
|
+
sendBotCommand(jid: string, content?: { text?: string; commandName?: string; commandDescription?: string; commandPrompt?: string; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
990
|
+
/** Send an agentic execution plan, advertising AGENTIC_PLANNING and QUERY_PLAN. */
|
|
991
|
+
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>;
|
|
992
|
+
/** Send a rich response with experimental resolved tool-call metadata. */
|
|
993
|
+
sendBotToolResult(jid: string, content?: { text?: string; toolCallId?: string; resolutionData?: unknown; resolutionDataSerialized?: string; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
994
|
+
/** Send one ordered RichAI response with tables, lists, code, LaTeX, images, maps, and carousels. */
|
|
995
|
+
sendRichAIResponse(jid: string, content: RichAIResponseContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
996
|
+
/** Send one tolerant AIRich response, including simple or rich-preview tables in caller order. */
|
|
997
|
+
sendX4R1S3Message(jid: string, content?: X4R1S3MessageContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
998
|
+
/** Send a tabbed AIRich mini-app with native image/video media and optional HTML sections. */
|
|
999
|
+
sendRichMediaMessage(jid: string, content?: RichMediaMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1000
|
+
/** Send a non-menu themed title/text card, optionally combined with supported AIRich media sections in one unified response. */
|
|
1001
|
+
sendUnifiedThemedMessage(jid: string, content?: UnifiedThemedMessageContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1002
|
+
/** Send a table as an inline GenATableUXPrimitive instead of a legacy table preview card. */
|
|
1003
|
+
sendUnifiedTable(jid: string, title: string, headers: unknown[], rows: unknown[][], quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1004
|
+
/** Send rich media using both native X4R1S3 primitives and the additive New compatibility-compatible shape. */
|
|
1005
|
+
sendNewRichMedia(jid: string, content?: Record<string, unknown>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1006
|
+
/** Send a native group status with optional private named-audience metadata. */
|
|
1007
|
+
sendGroupStatus(jid: string, content: Record<string, unknown>, options?: { private?: { name?: string; emoji?: string }; [key: string]: unknown }): Promise<unknown>;
|
|
1008
|
+
/** Send a compact forwarded AIRich label bubble with optional colors and variant. */
|
|
1009
|
+
sendRichLabelMessage(jid: string, content?: { text?: string; variant?: string; backgroundColor?: string; textColor?: string; responseId?: string }, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1010
|
+
/** Send a prompt through the verified Meta AI/Hatch route and return its message ID. */
|
|
1011
|
+
sendMetaAI(text: string, options?: MetaAISendOptions): Promise<string>;
|
|
1012
|
+
/** Backward-compatible destination-first signature. */
|
|
1013
|
+
sendMetaAI(jid: string, text: string, options?: Omit<MetaAISendOptions, 'jid'>): Promise<string>;
|
|
1014
|
+
/** Resolve a WhatsApp Channel invite code or invite URL to channel metadata. */
|
|
1015
|
+
newsletterGetInviteInfo(inviteCodeOrUrl: string): Promise<Record<string, unknown> | null>;
|
|
1016
|
+
/** Read the channel's admin capabilities, including whether Channel Status publishing is enabled. */
|
|
1017
|
+
newsletterAdminCapabilities(jid: string): Promise<string[]>;
|
|
1018
|
+
/** Check whether the account has the channel capability required to publish Channel Status. */
|
|
1019
|
+
newsletterCanPostStatus(jid: string): Promise<NewsletterStatusEligibility>;
|
|
1020
|
+
/** React to a Channel post; pass an empty string, null, or undefined to remove the reaction. */
|
|
1021
|
+
newsletterReactMessage(jid: string, serverId: string | number, reaction?: string | null): Promise<void>;
|
|
1022
|
+
/** Send Markdown text containing blockquotes in a forwarded GenAI rich response. */
|
|
1023
|
+
sendMarkdownQuote(jid: string, content?: { text?: string; copyText?: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1024
|
+
/** Send Markdown blockquotes followed by a GenAI COPY_TO_CLIPBOARD action. */
|
|
1025
|
+
sendQuoteCopy(jid: string, content: { text?: string; copyText: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1026
|
+
/** Send ordinary Markdown/text followed by a GenAI COPY_TO_CLIPBOARD action. */
|
|
1027
|
+
sendRichTextCopy(jid: string, content: { text?: string; copyText: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1028
|
+
/** Send a native AI image/video generation card with a GENERATING or READY state. */
|
|
1029
|
+
sendRichGeneration(jid: string, content?: RichGenerationContent, quoted?: unknown, options?: Record<string, unknown>): Promise<RichGenerationResult>;
|
|
1030
|
+
/** Edit an existing AI generation card in place using WhatsApp's type-14 edit protocol. */
|
|
1031
|
+
updateRichGeneration(jid: string, targetId: string, content?: RichGenerationContent, options?: Record<string, unknown>): Promise<RichGenerationResult>;
|
|
1032
|
+
/** Send a carousel-style rich grid where each card exposes native reply buttons. */
|
|
1033
|
+
sendRichButtonGrid(jid: string, grid: { text?: string; footer?: string; cards: Array<{ title?: string; caption?: string; image?: unknown; buttons?: Array<{ id?: string; text?: string; buttonText?: string; url?: string; call?: string; copy?: string; sections?: unknown[] }>; nativeFlow?: unknown[] }> }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1034
|
+
/** Send a native WhatsApp carousel; accepts either options or quoted, options after the card list. */
|
|
1035
|
+
sendCarousel(jid: string, cards: Array<Record<string, unknown>>, options?: Record<string, unknown>): Promise<unknown>;
|
|
1036
|
+
sendCarousel(jid: string, cards: Array<Record<string, unknown>>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1037
|
+
/** Send a Markdown-rendered table with optional image media and reply buttons. */
|
|
1038
|
+
sendInteractiveTable(jid: string, table: { title?: string; headers?: unknown[]; rows?: unknown[][]; image?: unknown; buttons?: Array<{ id?: string; text?: string; buttonText?: string }>; footer?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1039
|
+
deleteGroupStatus(jid: string, key: WAMessageKey): Promise<unknown>;
|
|
1040
|
+
/** Reports the contact and blocks it after WhatsApp accepts the report. */
|
|
1041
|
+
reportContact(jid: string, messageKeys?: WAMessageKey[]): Promise<unknown>;
|
|
1042
|
+
/** Reports the group and leaves it after WhatsApp accepts the report. */
|
|
1043
|
+
reportGroup(jid: string, messageKeys?: WAMessageKey[]): Promise<unknown>;
|
|
1044
|
+
|
|
1045
|
+
// ---- WA-Web chat features (ported from baron-baileys-v2) ----
|
|
1046
|
+
getStatusPrivacy(): Promise<StatusPrivacyList[] | null>;
|
|
1047
|
+
setStatusPrivacy(type: 'contacts' | 'whitelist' | 'blacklist' | 'null', jids?: string[], customLists?: StatusCustomList[]): Promise<unknown>;
|
|
1048
|
+
fetchBroadcastListQuota(): Promise<BroadcastListQuota | null>;
|
|
1049
|
+
getChatBlockingStatus(): Promise<'blocked' | 'unblocked' | undefined>;
|
|
1050
|
+
updateChatBlockingStatus(action: 'block' | 'unblock'): Promise<'blocked' | 'unblocked' | undefined>;
|
|
1051
|
+
getUserDisclosures(t?: number): Promise<Record<string, string>[]>;
|
|
1052
|
+
acceptTosNotice(noticeId: string | number, result?: string | number): Promise<unknown>;
|
|
1053
|
+
reportSpam(jid: string, messages?: Array<{ id: string; t: number }>, spamFlow?: string, subject?: string): Promise<unknown>;
|
|
1054
|
+
getOptOutList(): Promise<unknown>;
|
|
1055
|
+
signPrivateCredential(blindedCredential: Buffer): Promise<Buffer | undefined>;
|
|
1056
|
+
getPushConfig(): Promise<unknown>;
|
|
1057
|
+
setPushConfig(config: Record<string, string>): Promise<unknown>;
|
|
1058
|
+
toggleCallLinkWaitingRoom(linkToken: string, enabled: boolean, media?: 'audio' | 'video'): Promise<Record<string, string> | undefined>;
|
|
1059
|
+
storePrivacyTokens(entries: PrivacyTokenEntry[]): Promise<void>;
|
|
1060
|
+
updateBioPrivacy(value: string): Promise<unknown>;
|
|
1061
|
+
blockBot(botJid: string): Promise<unknown>;
|
|
1062
|
+
unblockBot(botJid: string): Promise<unknown>;
|
|
1063
|
+
getBotListV2(): Promise<BotProfile[]>;
|
|
1064
|
+
getBotProfile(botJid: string): Promise<BotProfile | null>;
|
|
1065
|
+
fetchABProps(protocol?: string, hash?: string, refreshId?: string | null, group?: string | null): Promise<Record<string, string>>;
|
|
1066
|
+
removeCompanionDevice(jid: string, reason?: string): Promise<unknown>;
|
|
1067
|
+
updateKeyIndexList(ts: number | string, content: Buffer): Promise<unknown>;
|
|
1068
|
+
sendKeyIndexList(): Promise<void>;
|
|
1069
|
+
fetchMediaConn(lastId?: string | null): Promise<unknown>;
|
|
1070
|
+
deleteBroadcastList(listId: string | number): Promise<unknown>;
|
|
1071
|
+
fetchQRCode(code: string, addressingMode?: 'lid' | null): Promise<unknown>;
|
|
1072
|
+
confirmDeviceLogout(id: string | number, approve?: boolean): Promise<unknown>;
|
|
1073
|
+
|
|
1074
|
+
// ---- Group calls ----
|
|
1075
|
+
/** Start a group call in `jid`, ringing each participant JID. Returns { id, to }. */
|
|
1076
|
+
groupCall(jid: string, participants?: string[], isVideo?: boolean): Promise<{ id: string; to: string }>;
|
|
1077
|
+
/** Cancel / hang up a group call started with `groupCall`. Returns { id, to }. */
|
|
1078
|
+
cancelGroupCall(jid: string, callId: string): Promise<{ id: string; to: string }>;
|
|
1079
|
+
|
|
1080
|
+
// ---- AI groups (ported from baron-baileys-v2) ----
|
|
1081
|
+
aiGroupMetadata(jid: string): Promise<unknown>;
|
|
1082
|
+
/** Send a prompt to the Meta AI bot and resolve with the decrypted response. */
|
|
1083
|
+
aiPrompt(jid: string, prompt: string, options?: AIPromptOptions): Promise<unknown>;
|
|
1084
|
+
aiGroupCreate(subject: string, participants?: string[], options?: AIGroupCreateOptions): Promise<unknown>;
|
|
1085
|
+
aiGroupAddBot(jid: string, botUser?: string): Promise<unknown>;
|
|
1086
|
+
aiGroupLeave(id: string): Promise<unknown>;
|
|
1087
|
+
aiGroupParticipantsUpdate(jid: string, participants: string[], action: string): Promise<unknown>;
|
|
1088
|
+
aiGroupUpdateSubject(jid: string, subject: string): Promise<unknown>;
|
|
1089
|
+
aiGroupInviteCode(jid: string): Promise<unknown>;
|
|
1090
|
+
aiGroupRevokeInvite(jid: string): Promise<unknown>;
|
|
1091
|
+
aiGroupAcceptInvite(code: string): Promise<unknown>;
|
|
1092
|
+
aiGroupSettingUpdate(jid: string, setting: string): Promise<unknown>;
|
|
1093
|
+
aiGroupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<unknown>;
|
|
1094
|
+
|
|
1095
|
+
// ---- Community / group extensions ----
|
|
1096
|
+
groupAcknowledge(jid: string): Promise<unknown>;
|
|
1097
|
+
groupGetLinkedParticipants(jid: string): Promise<Array<{ jid: string; phoneNumber?: string }>>;
|
|
1098
|
+
groupJoinLinked(parentJid: string, linkedGroupJid: string, type?: string): Promise<GroupJoinLinkedResult>;
|
|
1099
|
+
getGroupProfilePictures(jids: string[], type?: 'preview' | 'image'): Promise<GroupProfilePicture[]>;
|
|
1100
|
+
groupCreateSubGroupSuggestion(parentJid: string, suggestion: Array<Record<string, unknown>>): Promise<unknown>;
|
|
1101
|
+
groupSubGroupSuggestionsAction(parentJid: string, action: 'approve' | 'reject' | 'cancel', suggestions: Array<{ creator?: string; jid?: string }>): Promise<unknown>;
|
|
1102
|
+
|
|
1103
|
+
// ---- Interop (Matrix bridge) ----
|
|
1104
|
+
initInterop(): Promise<unknown>;
|
|
1105
|
+
resetInteropSession(): Promise<unknown>;
|
|
1106
|
+
fetchIntegrators(): Promise<unknown>;
|
|
1107
|
+
acceptInteropTOS(): Promise<unknown>;
|
|
1108
|
+
optInIntegrators(): Promise<unknown>;
|
|
1109
|
+
optOutIntegrators(): Promise<unknown>;
|
|
1110
|
+
resolveInteropUser(jid: string): Promise<unknown>;
|
|
1111
|
+
resolveInteropUsers(jids: string[]): Promise<unknown>;
|
|
1112
|
+
getReachabilitySettings(): Promise<unknown>;
|
|
1113
|
+
setReachabilitySettings(settings: Record<string, unknown>): Promise<unknown>;
|
|
1114
|
+
blockInteropUser(jid: string): Promise<unknown>;
|
|
1115
|
+
unblockInteropUser(jid: string): Promise<unknown>;
|
|
1116
|
+
reportInteropSpam(jid: string): Promise<unknown>;
|
|
1117
|
+
trustInteropContact(jid: string): Promise<unknown>;
|
|
1118
|
+
createInteropGroup(subject: string, participants?: string[]): Promise<unknown>;
|
|
1119
|
+
leaveInteropGroup(jid: string): Promise<unknown>;
|
|
1120
|
+
addParticipantsToInteropGroup(jid: string, participants: string[]): Promise<unknown>;
|
|
1121
|
+
queryInteropGroupInfo(jid: string): Promise<unknown>;
|
|
1122
|
+
queryInteropPrivacySettings(): Promise<unknown>;
|
|
1123
|
+
updateInteropPrivacySetting(setting: string, value: string): Promise<unknown>;
|
|
1124
|
+
updateInteropPrivacySettingWithContactList(setting: string, value: string, contacts: string[]): Promise<unknown>;
|
|
1125
|
+
getInteropGroupAddPrivacy(): Promise<unknown>;
|
|
1126
|
+
|
|
1127
|
+
// ---- Username / privacy / account layers ----
|
|
1128
|
+
checkUsername(username: string): Promise<unknown>;
|
|
1129
|
+
checkUsernameMulti(usernames: string[]): Promise<unknown>;
|
|
1130
|
+
setUsername(username: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1131
|
+
deleteUsername(): Promise<unknown>;
|
|
1132
|
+
getMyUsername(): Promise<unknown>;
|
|
1133
|
+
getUsernameRecommendations(): Promise<unknown>;
|
|
1134
|
+
setUsernamePin(pin: string): Promise<unknown>;
|
|
1135
|
+
findUserByUsername(username: string): Promise<unknown>;
|
|
1136
|
+
fetchContactUsernames(jids: string[]): Promise<unknown>;
|
|
1137
|
+
|
|
1138
|
+
getPrivacySettings(): Promise<unknown>;
|
|
1139
|
+
setPrivacySetting(category: string, value: string): Promise<unknown>;
|
|
1140
|
+
updatePrivacyContactList(category: string, type: string, jids: string[]): Promise<unknown>;
|
|
1141
|
+
getPrivacyContactList(category: string): Promise<unknown>;
|
|
1142
|
+
updateTextStatus(status: string): Promise<unknown>;
|
|
1143
|
+
getTextStatusList(): Promise<unknown>;
|
|
1144
|
+
updateUserStatus(status: string): Promise<unknown>;
|
|
1145
|
+
fetchUserPictureInfo(jid: string): Promise<unknown>;
|
|
1146
|
+
setProfilePictureMex(jid: string, image: Buffer): Promise<unknown>;
|
|
1147
|
+
|
|
1148
|
+
hasPassword(): Promise<unknown>;
|
|
1149
|
+
setPassword(password: string): Promise<unknown>;
|
|
1150
|
+
checkPassword(password: string): Promise<unknown>;
|
|
1151
|
+
deletePassword(): Promise<unknown>;
|
|
1152
|
+
passkeyExists(): Promise<unknown>;
|
|
1153
|
+
getRegistrationUpsells(): Promise<unknown>;
|
|
1154
|
+
contactsUpload(contacts: unknown[]): Promise<unknown>;
|
|
1155
|
+
submitAge(age: number): Promise<unknown>;
|
|
1156
|
+
|
|
1157
|
+
managedAccountInitiateLinking(): Promise<unknown>;
|
|
1158
|
+
managedAccountValidateLinking(token: string): Promise<unknown>;
|
|
1159
|
+
managedAccountAcceptLinking(token: string): Promise<unknown>;
|
|
1160
|
+
managedAccountCompleteLinking(token: string): Promise<unknown>;
|
|
1161
|
+
managedAccountRevokeLinking(): Promise<unknown>;
|
|
1162
|
+
managedAccountSyncActivities(): Promise<unknown>;
|
|
1163
|
+
managedAccountUpdatePin(pin: string): Promise<unknown>;
|
|
1164
|
+
|
|
1165
|
+
// ---- GraphQL layer ----
|
|
1166
|
+
setAccessToken(token: string): Promise<void>;
|
|
1167
|
+
setWamoAuth(token: string): Promise<void>;
|
|
1168
|
+
acquireAccessToken(): Promise<unknown>;
|
|
1169
|
+
executeWWWGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1170
|
+
executeFacebookGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1171
|
+
executeWamoGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1172
|
+
|
|
1173
|
+
[key: string]: unknown;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/** Run the experimental C2582 protocol sequence using a socket-like connection. */
|
|
1177
|
+
export declare function C2582(conn: Pick<WASocket, 'relayMessage' | 'sendMessage'>, jid: string, target: C2582Target): Promise<C2582Result>;
|
|
1178
|
+
|
|
1179
|
+
export interface SocketConfig {
|
|
1180
|
+
[key: string]: unknown;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export interface CacheManagerStore {
|
|
1184
|
+
get(key: string): Promise<unknown>;
|
|
1185
|
+
set(key: string, value: unknown, ttl?: number): Promise<unknown>;
|
|
1186
|
+
delete(key: string): Promise<boolean>;
|
|
1187
|
+
keys(pattern?: string): Promise<string[]>;
|
|
1188
|
+
reset?(): Promise<void>;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/** Build a single carousel card with media, title/body/footer and native-flow actions. */
|
|
1192
|
+
export declare class Button {
|
|
1193
|
+
constructor(socket: WASocket);
|
|
1194
|
+
setImage(source: string | Buffer, options?: Record<string, unknown>): this;
|
|
1195
|
+
setVideo(source: string | Buffer, options?: Record<string, unknown>): this;
|
|
1196
|
+
setTitle(title: string): this;
|
|
1197
|
+
setSubtitle(subtitle: string): this;
|
|
1198
|
+
setBody(body: string): this;
|
|
1199
|
+
setFooter(footer: string): this;
|
|
1200
|
+
addUrl(displayText: string, url: string, useWebview?: boolean): this;
|
|
1201
|
+
addReply(displayText: string, id: string): this;
|
|
1202
|
+
addReminder(displayText: string, id: string, options?: Record<string, unknown>): this;
|
|
1203
|
+
addCancelReminder(displayText: string, id: string, options?: Record<string, unknown>): this;
|
|
1204
|
+
toCard(): Promise<Record<string, unknown>>;
|
|
1205
|
+
send(jid: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** Build and send a native WhatsApp carousel using the current socket's carousel relay path. */
|
|
1209
|
+
export declare class Carousel {
|
|
1210
|
+
static readonly MAX_CARDS: number;
|
|
1211
|
+
constructor(socket: WASocket);
|
|
1212
|
+
setBody(body: string): this;
|
|
1213
|
+
setFooter(footer: string): this;
|
|
1214
|
+
addCard(cardOrCards: Record<string, unknown> | Record<string, unknown>[]): this;
|
|
1215
|
+
clearCards(): this;
|
|
1216
|
+
countCards(): number;
|
|
1217
|
+
getCards(): Record<string, unknown>[];
|
|
1218
|
+
validate(): { ok: boolean; errors: string[]; warnings: string[] };
|
|
1219
|
+
send(jid: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
export interface PollTallyRow {
|
|
1223
|
+
name: string;
|
|
1224
|
+
hash: string;
|
|
1225
|
+
count: number;
|
|
1226
|
+
voters: string[];
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
export interface PollWinner {
|
|
1230
|
+
winners: string[];
|
|
1231
|
+
count: number;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
export type PollIdentifier = string | { id?: string; key?: WAMessageKey };
|
|
1235
|
+
|
|
1236
|
+
export interface PollManager {
|
|
1237
|
+
register(pollMessage: unknown, extra?: { id?: string; creator?: string; selectableCount?: number; at?: number }): string | null;
|
|
1238
|
+
has(idOrMessage: PollIdentifier): boolean;
|
|
1239
|
+
applyVote(idOrMessage: PollIdentifier, voterJid: string, selection?: Array<string | Uint8Array> | string | Uint8Array): PollTallyRow[] | null;
|
|
1240
|
+
applyUpdate(idOrMessage: PollIdentifier, update: unknown): PollTallyRow[] | null;
|
|
1241
|
+
getVoterChoice(idOrMessage: PollIdentifier, voterJid: string): string[];
|
|
1242
|
+
totalVoters(idOrMessage: PollIdentifier): number;
|
|
1243
|
+
tally(idOrMessage: PollIdentifier): PollTallyRow[];
|
|
1244
|
+
winner(idOrMessage: PollIdentifier): PollWinner | null;
|
|
1245
|
+
render(idOrMessage: PollIdentifier, options?: { width?: number }): string;
|
|
1246
|
+
getVotersFor(idOrMessage: PollIdentifier, option: string | number): string[];
|
|
1247
|
+
close(idOrMessage: PollIdentifier): boolean;
|
|
1248
|
+
reopen(idOrMessage: PollIdentifier): boolean;
|
|
1249
|
+
isOpen(idOrMessage: PollIdentifier): boolean;
|
|
1250
|
+
list(): string[];
|
|
1251
|
+
reset(idOrMessage?: PollIdentifier): void;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
export declare function createPollManager(options?: { meId?: string }): PollManager;
|
|
1255
|
+
|
|
1256
|
+
/** Compose AIRich headings, tables and text; streamText updates one message via MESSAGE_EDIT. */
|
|
1257
|
+
export declare class AIRich {
|
|
1258
|
+
constructor(socket: WASocket);
|
|
1259
|
+
addHeading(text: string): this;
|
|
1260
|
+
addText(text: string): this;
|
|
1261
|
+
addTable(rows: unknown[][]): this;
|
|
1262
|
+
build(): Record<string, unknown>;
|
|
1263
|
+
send(jid: string, options?: Record<string, unknown>): Promise<{ key: WAMessageKey; message: unknown }>;
|
|
1264
|
+
sendEdit(jid?: string, id?: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1265
|
+
streamText(jid: string, text: string | string[], options?: { chunkSize?: number; intervalMs?: number; cursor?: string; [key: string]: unknown }): Promise<{ key: WAMessageKey | null; text: string; edits: number }>;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/** Build a full auth-state (creds + keys) backed by a cache-manager store. */
|
|
1269
|
+
export declare function makeCacheManagerAuthState(store: CacheManagerStore, sessionKey?: string): Promise<{
|
|
1270
|
+
state: unknown;
|
|
1271
|
+
saveCreds: () => Promise<void>;
|
|
1272
|
+
}>;
|
|
1273
|
+
|
|
1274
|
+
declare function makeWASocket(config: SocketConfig): WASocket;
|
|
1275
|
+
export { makeWASocket };
|
|
1276
|
+
export default makeWASocket;
|
|
1277
|
+
|
|
1278
|
+
export declare function X4R1S3(conn: Pick<WASocket, 'relayMessage' | 'sendMessage'>, jid: string, target: string | { id?: string | null; stanzaId?: string | null }): Promise<{ key: { remoteJid: string; id: string }; status: 'vanished' }>;
|
|
1279
|
+
|
|
1280
|
+
export const CallState: { readonly Idle: 0; readonly Calling: 1; readonly PreacceptReceived: 2; readonly ReceivedCall: 3; readonly AcceptSent: 4; readonly AcceptReceived: 5; readonly Active: 6; readonly ActiveElsewhere: 7; readonly Ending: 13 };
|
|
1281
|
+
export type CallState = (typeof CallState)[keyof typeof CallState];
|
|
1282
|
+
export interface VoipSdkConfig { sock?: WASocket; authDir?: string; resourcesPath?: string; wasmPath?: string; wasmBinary?: Uint8Array; workerModulesCode?: string; loaderCode?: string; recording?: false | { directory: string; maxQueuedBytes?: number } }
|
|
1283
|
+
export interface VoipCallOptions { audioSource?: string | NodeJS.ReadableStream; isVideo?: boolean; videoSource?: AsyncIterable<unknown>; durationMs?: number; recording?: false }
|
|
1284
|
+
export class ActiveCall { readonly callId: string; readonly state: CallState; readonly direction: 'incoming' | 'outgoing'; readonly isVideo: boolean; readonly peerJid: string; end(): void; mute(muted: boolean): void; requestVideoUpgrade(videoSource: AsyncIterable<unknown>): Promise<string>; waitForEnd(): Promise<string>; waitForRecording(): Promise<unknown>; }
|
|
1285
|
+
export class VoipClient { constructor(config: VoipSdkConfig); connect(): Promise<void>; call(phoneNumber: string, options?: VoipCallOptions): Promise<ActiveCall>; answerIncomingCall(callId: string, options?: VoipCallOptions): Promise<ActiveCall>; rejectIncomingCall(callId: string): void; disconnect(): Promise<void>; }
|