@x4r1s3/baileys 0.0.0-stage → 1.0.1
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 +1245 -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/astralena-v3.mjs +96 -0
- package/lib/Call/audio-feeder.mjs +201 -0
- package/lib/Call/audio-recorder.mjs +250 -0
- package/lib/Call/fetch-wasm-resources.mjs +104 -0
- package/lib/Call/index.mjs +707 -0
- package/lib/Call/relay-transport.mjs +563 -0
- package/lib/Call/signaling.mjs +660 -0
- package/lib/Call/types.mjs +17 -0
- package/lib/Call/video-feeder.mjs +94 -0
- package/lib/Call/voip-resources.mjs +259 -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 +2193 -0
- package/lib/Socket/messages-send.js +4141 -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 +1042 -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 +104 -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 +221 -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 +1895 -0
- package/lib/index.js +41 -0
- package/package.json +125 -4
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,1895 @@
|
|
|
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 const CallState: {
|
|
14
|
+
readonly Idle: 0;
|
|
15
|
+
readonly Calling: 1;
|
|
16
|
+
readonly PreacceptReceived: 2;
|
|
17
|
+
readonly ReceivedCall: 3;
|
|
18
|
+
readonly AcceptSent: 4;
|
|
19
|
+
readonly AcceptReceived: 5;
|
|
20
|
+
readonly Active: 6;
|
|
21
|
+
readonly ActiveElsewhere: 7;
|
|
22
|
+
readonly Ending: 13;
|
|
23
|
+
};
|
|
24
|
+
export type CallState = (typeof CallState)[keyof typeof CallState];
|
|
25
|
+
|
|
26
|
+
export interface VoipAutoRecordingOptions {
|
|
27
|
+
/** Required destination directory; no recording occurs unless this is configured. */
|
|
28
|
+
directory: string;
|
|
29
|
+
/** Maximum queued audio bytes per WAV track (default 2 MiB). */
|
|
30
|
+
maxQueuedBytes?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CallRecordingFiles {
|
|
33
|
+
inbound: string;
|
|
34
|
+
outbound: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CallRecordingResult {
|
|
37
|
+
callId: string;
|
|
38
|
+
startedAt: Date;
|
|
39
|
+
endedAt: Date;
|
|
40
|
+
sampleRate: number;
|
|
41
|
+
channels: number;
|
|
42
|
+
formats: {
|
|
43
|
+
inbound: { sampleRate: number; channels: number };
|
|
44
|
+
outbound: { sampleRate: number; channels: number };
|
|
45
|
+
};
|
|
46
|
+
files: CallRecordingFiles;
|
|
47
|
+
bytesWritten: { inbound: number; outbound: number };
|
|
48
|
+
complete: boolean;
|
|
49
|
+
errors: Array<{ direction: 'inbound' | 'outbound'; error: string }>;
|
|
50
|
+
}
|
|
51
|
+
export interface CallRecordingError {
|
|
52
|
+
callId: string;
|
|
53
|
+
direction: 'inbound' | 'outbound' | 'both';
|
|
54
|
+
error: Error;
|
|
55
|
+
}
|
|
56
|
+
export interface VoipResourceManifest {
|
|
57
|
+
wasmUrl?: string;
|
|
58
|
+
workerUrl?: string;
|
|
59
|
+
wasmBinary?: Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
60
|
+
workerModulesCode?: string;
|
|
61
|
+
loaderCode?: string;
|
|
62
|
+
wasm?: { url?: string; bytes?: Uint8Array | ArrayBuffer | ArrayBufferView };
|
|
63
|
+
worker?: { url?: string; code?: string };
|
|
64
|
+
loader?: { code?: string };
|
|
65
|
+
}
|
|
66
|
+
export interface VoipResourceStatus {
|
|
67
|
+
resourcesPath: string;
|
|
68
|
+
wasm: boolean;
|
|
69
|
+
worker: boolean;
|
|
70
|
+
loader: boolean;
|
|
71
|
+
complete: boolean;
|
|
72
|
+
files: { wasm: string; worker: string; loader: string };
|
|
73
|
+
source?: 'cache' | 'provider' | 'session' | 'runtime-package' | 'remote-url' | 'browser';
|
|
74
|
+
}
|
|
75
|
+
export interface VoipSessionResourceCapability {
|
|
76
|
+
supported: boolean;
|
|
77
|
+
method?: 'fetchVoipResources' | 'voipResources';
|
|
78
|
+
reason?: string;
|
|
79
|
+
}
|
|
80
|
+
export type VoipResourceProvider = (context: { sock?: WASocket }) => VoipResourceManifest | Promise<VoipResourceManifest>;
|
|
81
|
+
export interface VoipResourceUrls {
|
|
82
|
+
wasmUrl: string;
|
|
83
|
+
workerUrl: string;
|
|
84
|
+
loaderUrl?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface EnsureVoipResourcesOptions {
|
|
87
|
+
resourcesPath?: string;
|
|
88
|
+
sock?: WASocket;
|
|
89
|
+
resourceProvider?: VoipResourceProvider;
|
|
90
|
+
runtimePackage?: string;
|
|
91
|
+
resourceUrls?: VoipResourceUrls;
|
|
92
|
+
debuggerUrl?: string;
|
|
93
|
+
wasmId?: string;
|
|
94
|
+
force?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export class VoipResourceError extends Error {
|
|
97
|
+
code: string;
|
|
98
|
+
capabilities?: VoipSessionResourceCapability;
|
|
99
|
+
}
|
|
100
|
+
export const VOIP_RESOURCE_FILES: Readonly<{ wasm: string; worker: string; loader: string }>;
|
|
101
|
+
export function inspectVoipResources(resourcesPath?: string): VoipResourceStatus;
|
|
102
|
+
export function inspectSessionVoipResources(sock?: WASocket): VoipSessionResourceCapability;
|
|
103
|
+
export function ensureVoipResources(options?: EnsureVoipResourcesOptions): Promise<VoipResourceStatus>;
|
|
104
|
+
export function fetchVoipResourcesFromBrowser(options?: { debuggerUrl?: string; wasmId?: string }): Promise<VoipResourceManifest>;
|
|
105
|
+
export function fetchVoipResourcesFromUrls(urls: VoipResourceUrls): Promise<VoipResourceManifest>;
|
|
106
|
+
export function loadVoipResourcesFromPackage(packageName: string): Promise<VoipResourceManifest>;
|
|
107
|
+
|
|
108
|
+
export interface IncomingCallInfo {
|
|
109
|
+
callId: string;
|
|
110
|
+
peerJid: string;
|
|
111
|
+
callerJid: string;
|
|
112
|
+
isVideo: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface VoipClientEvents {
|
|
115
|
+
incomingCall: [call: IncomingCallInfo];
|
|
116
|
+
incomingCallEnded: [info: { callId: string; reason: string }];
|
|
117
|
+
recordingStarted: [info: { callId: string; files: CallRecordingFiles }];
|
|
118
|
+
recordingComplete: [result: CallRecordingResult];
|
|
119
|
+
recordingError: [details: CallRecordingError];
|
|
120
|
+
videoError: [details: { callId: string; error: Error }];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface VoipSdkConfig {
|
|
124
|
+
/** Reuse a connected Baileys socket; this client will not close it on disconnect. */
|
|
125
|
+
sock?: WASocket;
|
|
126
|
+
/** Required only when creating a separate Baileys socket instead of supplying `sock`. */
|
|
127
|
+
authDir?: string;
|
|
128
|
+
/** Directory containing `assets/wasm/whatsapp.wasm` and `assets/wasm/worker-modules.js`. */
|
|
129
|
+
resourcesPath?: string;
|
|
130
|
+
wasmPath?: string;
|
|
131
|
+
wasmBinary?: Uint8Array;
|
|
132
|
+
workerModulesCode?: string;
|
|
133
|
+
loaderCode?: string;
|
|
134
|
+
/** Resolve missing resources before connecting; disabled by default. */
|
|
135
|
+
autoFetchResources?: boolean;
|
|
136
|
+
resourceProvider?: VoipResourceProvider;
|
|
137
|
+
runtimePackage?: string;
|
|
138
|
+
resourceUrls?: VoipResourceUrls;
|
|
139
|
+
debuggerUrl?: string;
|
|
140
|
+
wasmId?: string;
|
|
141
|
+
/** Automatically record both audio directions for calls; omitted/false keeps recording disabled. */
|
|
142
|
+
recording?: false | VoipAutoRecordingOptions;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type VoipAudioSource = string | NodeJS.ReadableStream;
|
|
146
|
+
export interface VoipCallOptions {
|
|
147
|
+
/** File path, `lavfi:<filter>`, or a Readable emitting little-endian Float32 PCM. */
|
|
148
|
+
audioSource?: VoipAudioSource;
|
|
149
|
+
/** Set true for outgoing video; requires videoSource. A supplied videoSource also enables video. */
|
|
150
|
+
isVideo?: boolean;
|
|
151
|
+
/** Async iterable of tightly packed NV12 frames for local video capture. */
|
|
152
|
+
videoSource?: AsyncIterable<VoipVideoFrameInput>;
|
|
153
|
+
/** Auto-hangup after this many milliseconds (default 120000). */
|
|
154
|
+
durationMs?: number;
|
|
155
|
+
/** Disable client-level automatic recording for this call. */
|
|
156
|
+
recording?: false;
|
|
157
|
+
}
|
|
158
|
+
export interface VoipVideoFrameInput {
|
|
159
|
+
/** NV12 bytes: Y plane followed by interleaved UV, exactly width * height * 1.5 bytes. */
|
|
160
|
+
data: Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
161
|
+
width: number;
|
|
162
|
+
height: number;
|
|
163
|
+
/** Frame rate metadata, 1–60 (default 30). */
|
|
164
|
+
fps?: number;
|
|
165
|
+
/** WASM video format enum (default 0, NV12). */
|
|
166
|
+
format?: number;
|
|
167
|
+
orientation?: number;
|
|
168
|
+
/** Timestamp in microseconds; defaults to current time. */
|
|
169
|
+
timestamp?: number;
|
|
170
|
+
}
|
|
171
|
+
export interface VoipVideoFrame {
|
|
172
|
+
userJid: string;
|
|
173
|
+
frameBuffer: Uint8Array;
|
|
174
|
+
width: number;
|
|
175
|
+
height: number;
|
|
176
|
+
orientation: number;
|
|
177
|
+
format: number;
|
|
178
|
+
timestamp: number;
|
|
179
|
+
isKeyFrame: boolean;
|
|
180
|
+
}
|
|
181
|
+
export interface VoipCallEvents {
|
|
182
|
+
ringing: [];
|
|
183
|
+
connected: [];
|
|
184
|
+
audio: [pcm: Float32Array];
|
|
185
|
+
/** Decoded remote video frame bytes and metadata from the WASM callback. */
|
|
186
|
+
videoFrame: [frame: VoipVideoFrame];
|
|
187
|
+
videoError: [error: Error];
|
|
188
|
+
ended: [reason: string];
|
|
189
|
+
recordingComplete: [result: CallRecordingResult];
|
|
190
|
+
recordingError: [details: CallRecordingError];
|
|
191
|
+
}
|
|
192
|
+
export type VoipVideoUpgradeResult = 'accepted' | 'rejected' | 'rejected_by_timeout' | 'timeout' | 'cancelled' | 'failed';
|
|
193
|
+
export class ActiveCall {
|
|
194
|
+
readonly callId: string;
|
|
195
|
+
readonly state: CallState;
|
|
196
|
+
readonly direction: 'incoming' | 'outgoing';
|
|
197
|
+
readonly isVideo: boolean;
|
|
198
|
+
readonly peerJid: string;
|
|
199
|
+
readonly recordingDone: Promise<CallRecordingResult | undefined>;
|
|
200
|
+
end(): void;
|
|
201
|
+
mute(muted: boolean): void;
|
|
202
|
+
/** Queue interleaved Float32 PCM for playback on the active call. */
|
|
203
|
+
writeAudio(pcm: Float32Array | ArrayBuffer | ArrayBufferView): void;
|
|
204
|
+
/** Request local video on an active audio call; frames are sent only after acceptance. */
|
|
205
|
+
requestVideoUpgrade(videoSource: AsyncIterable<VoipVideoFrameInput>): Promise<VoipVideoUpgradeResult>;
|
|
206
|
+
waitForEnd(): Promise<string>;
|
|
207
|
+
waitForRecording(): Promise<CallRecordingResult | undefined>;
|
|
208
|
+
on<K extends keyof VoipCallEvents>(event: K, listener: (...args: VoipCallEvents[K]) => void): this;
|
|
209
|
+
once<K extends keyof VoipCallEvents>(event: K, listener: (...args: VoipCallEvents[K]) => void): this;
|
|
210
|
+
off<K extends keyof VoipCallEvents>(event: K, listener: (...args: VoipCallEvents[K]) => void): this;
|
|
211
|
+
}
|
|
212
|
+
/** Experimental 1:1 audio/video media client using WhatsApp Web's VoIP WASM stack. */
|
|
213
|
+
export class VoipClient {
|
|
214
|
+
constructor(config: VoipSdkConfig);
|
|
215
|
+
connect(): Promise<void>;
|
|
216
|
+
call(phoneNumber: string, options?: VoipCallOptions): Promise<ActiveCall>;
|
|
217
|
+
answerIncomingCall(callId: string, options?: VoipCallOptions): Promise<ActiveCall>;
|
|
218
|
+
rejectIncomingCall(callId: string): void;
|
|
219
|
+
disconnect(): Promise<void>;
|
|
220
|
+
on<K extends keyof VoipClientEvents>(event: K, listener: (...args: VoipClientEvents[K]) => void): this;
|
|
221
|
+
once<K extends keyof VoipClientEvents>(event: K, listener: (...args: VoipClientEvents[K]) => void): this;
|
|
222
|
+
off<K extends keyof VoipClientEvents>(event: K, listener: (...args: VoipClientEvents[K]) => void): this;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface WAMessageKey {
|
|
226
|
+
remoteJid?: string | null;
|
|
227
|
+
fromMe?: boolean | null;
|
|
228
|
+
id?: string | null;
|
|
229
|
+
participant?: string | null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type GroupThemeScope = 'everyone' | 'me';
|
|
233
|
+
|
|
234
|
+
export interface GroupWallpaperOptions {
|
|
235
|
+
/** 'everyone' publishes a group message; 'me' is rejected because no verified local-only operation exists. */
|
|
236
|
+
scope?: GroupThemeScope;
|
|
237
|
+
dimLevel?: number;
|
|
238
|
+
mediaUploadTimeoutMs?: number;
|
|
239
|
+
settingTimestampMs?: number;
|
|
240
|
+
messageId?: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface GroupWallpaperResetOptions {
|
|
244
|
+
/** 'everyone' publishes a group message; 'me' is rejected because no verified local-only operation exists. */
|
|
245
|
+
scope?: GroupThemeScope;
|
|
246
|
+
isDoodleEnabled?: boolean;
|
|
247
|
+
settingTimestampMs?: number;
|
|
248
|
+
messageId?: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface DirectChatWallpaperOptions {
|
|
252
|
+
/** 'me' is rejected; WAProto has no per-chat You/Everyone scope field. */
|
|
253
|
+
scope?: GroupThemeScope;
|
|
254
|
+
dimLevel?: number;
|
|
255
|
+
mediaUploadTimeoutMs?: number;
|
|
256
|
+
settingTimestampMs?: number;
|
|
257
|
+
messageId?: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface DirectChatWallpaperResetOptions {
|
|
261
|
+
/** 'me' is rejected; WAProto has no per-chat You/Everyone scope field. */
|
|
262
|
+
scope?: GroupThemeScope;
|
|
263
|
+
isDoodleEnabled?: boolean;
|
|
264
|
+
settingTimestampMs?: number;
|
|
265
|
+
messageId?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface ChatThemeResult {
|
|
269
|
+
key: WAMessageKey;
|
|
270
|
+
message: Record<string, unknown>;
|
|
271
|
+
/** The stanza was written to the socket; this does not mean WhatsApp accepted or applied it. */
|
|
272
|
+
submissionStatus: 'written';
|
|
273
|
+
/** Always unconfirmed when this helper resolves; later negative ACKs are emitted as messages.update errors. */
|
|
274
|
+
serverOutcome: 'unconfirmed';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface GroupWallpaperResult extends ChatThemeResult {}
|
|
278
|
+
|
|
279
|
+
export interface GroupColorSchemeOptions {
|
|
280
|
+
/** Must be explicitly set to 'everyone'; 'me' is unsupported and does not fall back. */
|
|
281
|
+
scope: GroupThemeScope;
|
|
282
|
+
/** Required acknowledgement that preserving the omitted wallpaper field is not verified. */
|
|
283
|
+
allowUnverifiedPartialUpdate: true;
|
|
284
|
+
settingTimestampMs?: number;
|
|
285
|
+
messageId?: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface DirectChatColorSchemeOptions {
|
|
289
|
+
/** Must be explicitly set to 'everyone'; 'me' is rejected and scope is not serialized. */
|
|
290
|
+
scope: GroupThemeScope;
|
|
291
|
+
/** Required acknowledgement that preserving the omitted wallpaper field is not verified. */
|
|
292
|
+
allowUnverifiedPartialUpdate: true;
|
|
293
|
+
settingTimestampMs?: number;
|
|
294
|
+
messageId?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function setGroupWallpaper(sock: WASocket, jid: string, image: Buffer | string | { url: string }, options?: GroupWallpaperOptions): Promise<GroupWallpaperResult>;
|
|
298
|
+
export function setGroupWallpaper(sock: WASocket, jid: string, image: null, options?: GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
299
|
+
/** Reset a group's wallpaper to the WhatsApp default for everyone in the group. */
|
|
300
|
+
export function resetGroupWallpaper(sock: WASocket, jid: string, options?: GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
301
|
+
/** Request a colorSchemeId-only group update. Requires explicit scope and opt-in to unverified partial-update semantics. */
|
|
302
|
+
export function setGroupColorScheme(sock: WASocket, jid: string, colorSchemeId: string, options: GroupColorSchemeOptions): Promise<GroupWallpaperResult>;
|
|
303
|
+
/** Upload and request a custom wallpaper for a one-to-one chat; protocol scope and server application remain unconfirmed. */
|
|
304
|
+
export function setDirectChatWallpaper(sock: WASocket, jid: string, image: Buffer | string | { url: string }, options?: DirectChatWallpaperOptions): Promise<ChatThemeResult>;
|
|
305
|
+
export function setDirectChatWallpaper(sock: WASocket, jid: string, image: null, options?: DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
306
|
+
/** Request the default wallpaper for a one-to-one chat; protocol scope and server application remain unconfirmed. */
|
|
307
|
+
export function resetDirectChatWallpaper(sock: WASocket, jid: string, options?: DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
308
|
+
/** Request a colorSchemeId-only direct-chat update; requires opt-in to unverified partial-update semantics. */
|
|
309
|
+
export function setDirectChatColorScheme(sock: WASocket, jid: string, colorSchemeId: string, options: DirectChatColorSchemeOptions): Promise<ChatThemeResult>;
|
|
310
|
+
|
|
311
|
+
export interface CFCMessageOptions {
|
|
312
|
+
participant: string;
|
|
313
|
+
timestamp: number;
|
|
314
|
+
fromMe?: boolean;
|
|
315
|
+
messageId?: string;
|
|
316
|
+
pushName?: string;
|
|
317
|
+
quoted?: string | CFCMessageEntry | Record<string, unknown>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface CFCMessageEntry {
|
|
321
|
+
key: WAMessageKey;
|
|
322
|
+
message: Record<string, unknown>;
|
|
323
|
+
messageTimestamp: number;
|
|
324
|
+
participant: string;
|
|
325
|
+
pushName?: string;
|
|
326
|
+
addText(text: string, options: CFCMessageOptions): CFCMessageEntry;
|
|
327
|
+
addImage(source: unknown, options: CFCMessageOptions & { caption?: string }): Promise<CFCMessageEntry>;
|
|
328
|
+
addRaw(options: CFCMessageOptions & { message: Record<string, unknown> }): CFCMessageEntry;
|
|
329
|
+
addReaction(emoji: string, options: CFCMessageOptions): CFCMessageEntry;
|
|
330
|
+
send(groupJid: string, targetJid: string): Promise<CFCResult>;
|
|
331
|
+
builder: CFCBuilder;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface CFCGroupHistoryMedia {
|
|
335
|
+
mimetype: string;
|
|
336
|
+
fileSha256: Uint8Array;
|
|
337
|
+
mediaKey: Uint8Array;
|
|
338
|
+
fileEncSha256: Uint8Array;
|
|
339
|
+
directPath: string;
|
|
340
|
+
mediaKeyTimestamp: number;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface CFCGroupHistoryMetadata {
|
|
344
|
+
historyReceivers: string[];
|
|
345
|
+
nonHistoryReceivers: string[];
|
|
346
|
+
messageCount: number;
|
|
347
|
+
oldestMessageTimestampInWindow: number;
|
|
348
|
+
oldestMessageTimestampInBundle: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface CFCResult {
|
|
352
|
+
id: string;
|
|
353
|
+
key?: WAMessageKey;
|
|
354
|
+
group: string;
|
|
355
|
+
target: string;
|
|
356
|
+
messages: number;
|
|
357
|
+
reactions: number;
|
|
358
|
+
media: CFCGroupHistoryMedia;
|
|
359
|
+
metadata: CFCGroupHistoryMetadata;
|
|
360
|
+
encodedBytes: number;
|
|
361
|
+
compressedBytes: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export type StatusFont = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
365
|
+
|
|
366
|
+
export interface StatusOptions {
|
|
367
|
+
/** Users allowed to receive the status. At least one valid user JID is required. */
|
|
368
|
+
statusJidList: string[];
|
|
369
|
+
/** Hex, named, or ARGB status background color. */
|
|
370
|
+
backgroundColor?: string | number;
|
|
371
|
+
font?: StatusFont;
|
|
372
|
+
messageId?: string;
|
|
373
|
+
additionalAttributes?: Record<string, string>;
|
|
374
|
+
additionalNodes?: unknown[];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface PollVoteEvent {
|
|
378
|
+
pollUpdateMessageKey: WAMessageKey;
|
|
379
|
+
pollCreationMessageKey: WAMessageKey;
|
|
380
|
+
vote: unknown;
|
|
381
|
+
voterJid?: string;
|
|
382
|
+
pollCreatorJid?: string;
|
|
383
|
+
selectedOptions: string[];
|
|
384
|
+
selectedOptionHashes: string[];
|
|
385
|
+
unselectedOptions: string[];
|
|
386
|
+
senderTimestampMs?: number;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface StatusContent {
|
|
390
|
+
/** Convenience flag; alternatively send to `status@broadcast`. */
|
|
391
|
+
status?: true;
|
|
392
|
+
statusJidList?: string[];
|
|
393
|
+
backgroundColor?: string | number;
|
|
394
|
+
font?: StatusFont;
|
|
395
|
+
text?: string;
|
|
396
|
+
image?: unknown;
|
|
397
|
+
video?: unknown;
|
|
398
|
+
audio?: unknown;
|
|
399
|
+
caption?: string;
|
|
400
|
+
mimetype?: string;
|
|
401
|
+
ptt?: boolean;
|
|
402
|
+
seconds?: number;
|
|
403
|
+
waveform?: Uint8Array;
|
|
404
|
+
[key: string]: unknown;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface DraftMessageSyncInput {
|
|
408
|
+
chatJid: string;
|
|
409
|
+
altChatJid?: string;
|
|
410
|
+
action: number;
|
|
411
|
+
editTimestampMs: number;
|
|
412
|
+
draft?: Record<string, unknown>;
|
|
413
|
+
clearReason?: number;
|
|
414
|
+
}
|
|
415
|
+
export interface ConversationDraftInput {
|
|
416
|
+
content: Record<string, unknown>;
|
|
417
|
+
editTimestampMs: number | bigint | string;
|
|
418
|
+
editorDeviceId?: number;
|
|
419
|
+
}
|
|
420
|
+
export interface GroupMembershipFormQuestion {
|
|
421
|
+
text: string;
|
|
422
|
+
[key: string]: unknown;
|
|
423
|
+
}
|
|
424
|
+
export interface GroupMembershipFormInput {
|
|
425
|
+
questions: GroupMembershipFormQuestion[];
|
|
426
|
+
memberTagPrompt?: string;
|
|
427
|
+
schemaVersion?: number;
|
|
428
|
+
}
|
|
429
|
+
export interface GroupMembershipFormSubmissionInput {
|
|
430
|
+
questionAnswers?: Array<{ question: GroupMembershipFormQuestion; answer: string; [key: string]: unknown }>;
|
|
431
|
+
memberTagAnswer?: { prompt: string; memberTag: string; [key: string]: unknown };
|
|
432
|
+
schemaVersion?: number;
|
|
433
|
+
}
|
|
434
|
+
export interface StatusTemplateAttributionInput {
|
|
435
|
+
templateId: string;
|
|
436
|
+
templateName?: string;
|
|
437
|
+
thumbnailUrl?: string;
|
|
438
|
+
}
|
|
439
|
+
export interface MembershipFormPublicKeysInput {
|
|
440
|
+
mlKemPublicKey: Uint8Array;
|
|
441
|
+
x25519PublicKey: Uint8Array;
|
|
442
|
+
}
|
|
443
|
+
export interface EncryptedJoinRequestPayloadInput {
|
|
444
|
+
encryptedAnswers: Uint8Array;
|
|
445
|
+
encIv: Uint8Array;
|
|
446
|
+
signalIdentityPublicKey: Uint8Array;
|
|
447
|
+
kemCiphertext: Uint8Array;
|
|
448
|
+
}
|
|
449
|
+
/** Build protocolMessage.draftMessageSync only; no WhatsApp transport is implied. */
|
|
450
|
+
export function buildDraftMessageSync(input: DraftMessageSyncInput): Record<string, unknown>;
|
|
451
|
+
/** Build ConversationDraft only; no app-state persistence or WhatsApp transport is implied. */
|
|
452
|
+
export function buildConversationDraft(input: ConversationDraftInput): Record<string, unknown>;
|
|
453
|
+
/** Build a group membership form protobuf only; no publish transport is implied. */
|
|
454
|
+
export function buildGroupMembershipForm(input: GroupMembershipFormInput): Record<string, unknown>;
|
|
455
|
+
/** Build a group membership form submission protobuf only; no submission transport is implied. */
|
|
456
|
+
export function buildGroupMembershipFormSubmission(input: GroupMembershipFormSubmissionInput): Record<string, unknown>;
|
|
457
|
+
/** Build the membership public-key container; does not generate or exchange keys. */
|
|
458
|
+
export function buildMembershipFormPublicKeys(input: MembershipFormPublicKeysInput): Record<string, unknown>;
|
|
459
|
+
/** Build an already-encrypted membership payload; does not perform encryption. */
|
|
460
|
+
export function buildEncryptedJoinRequestPayload(input: EncryptedJoinRequestPayloadInput): Record<string, unknown>;
|
|
461
|
+
/** Build experimental MusicMessage lyrics metadata; client rendering is unverified. */
|
|
462
|
+
export function buildMusicLyrics(input: { lines: MusicMessageLyricLine[] }): Record<string, unknown>;
|
|
463
|
+
/** Build a MusicMessage with experimental styles/lyrics; client rendering is unverified. */
|
|
464
|
+
export function buildMusicMessage(input: MusicMessageContent): Record<string, unknown>;
|
|
465
|
+
/** Build schema-backed experimental status-template attribution metadata. */
|
|
466
|
+
export function buildStatusTemplateAttribution(input: StatusTemplateAttributionInput): Record<string, unknown>;
|
|
467
|
+
/** Return a shallow copy of status content with template attribution appended to contextInfo. */
|
|
468
|
+
export function withStatusTemplateAttribution(content: StatusContent, template: StatusTemplateAttributionInput): StatusContent;
|
|
469
|
+
|
|
470
|
+
export interface NewsletterStatusContent {
|
|
471
|
+
text?: string;
|
|
472
|
+
backgroundColor?: string | number;
|
|
473
|
+
/** Optional voice-note tile color; defaults to 0xff1e88e5 for PTT audio. */
|
|
474
|
+
backgroundArgb?: number;
|
|
475
|
+
font?: StatusFont;
|
|
476
|
+
image?: unknown;
|
|
477
|
+
video?: unknown;
|
|
478
|
+
audio?: unknown;
|
|
479
|
+
/** Set true with `audio` to post a voice-note status. Ordinary audio is unsupported. */
|
|
480
|
+
ptt?: boolean;
|
|
481
|
+
caption?: string;
|
|
482
|
+
mimetype?: string;
|
|
483
|
+
seconds?: number;
|
|
484
|
+
contextInfo?: Record<string, unknown>;
|
|
485
|
+
[key: string]: unknown;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface NewsletterStatusSendOptions {
|
|
489
|
+
/** Optional status stanza id; generated automatically by default. */
|
|
490
|
+
messageId?: string;
|
|
491
|
+
/** Maximum time to wait for WhatsApp's status ACK. Defaults to 20 seconds. */
|
|
492
|
+
ackTimeoutMs?: number;
|
|
493
|
+
/** Wait for the separate status echo and resolve newsletterStatusServerId; defaults to true. */
|
|
494
|
+
resolveServerId?: boolean;
|
|
495
|
+
/** Maximum echo wait after ACK when resolveServerId is enabled. Defaults to 8 seconds. */
|
|
496
|
+
serverIdTimeoutMs?: number;
|
|
497
|
+
/** Maximum time for media upload, when content contains image, video, or PTT audio. */
|
|
498
|
+
mediaUploadTimeoutMs?: number;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export interface NewsletterStatusEligibility {
|
|
502
|
+
/** True only when the server reports CHANNEL_STATUS_PRODUCER for this account and channel. */
|
|
503
|
+
canPost: boolean;
|
|
504
|
+
/** Server-reported admin capabilities for the authenticated account on this channel. */
|
|
505
|
+
capabilities: string[];
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export interface NewsletterLiveUpdateMessage {
|
|
509
|
+
serverId: number;
|
|
510
|
+
forwardsCount?: number;
|
|
511
|
+
reactions?: Array<{ code: string; count: number }>;
|
|
512
|
+
/** Hex SHA-256 of the voted option's text. */
|
|
513
|
+
votes?: Array<{ optionHash: string; count: number }>;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export interface NewsletterLiveUpdate {
|
|
517
|
+
newsletter: string;
|
|
518
|
+
/** First event after subscribing is a snapshot; subsequent events contain changed messages only. */
|
|
519
|
+
messages: NewsletterLiveUpdateMessage[];
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Advisory alert when a direct-chat delivery/read/played receipt references IDs absent from the recent sent-ID store. */
|
|
523
|
+
export interface FakeChatEvent {
|
|
524
|
+
jid: string;
|
|
525
|
+
ids: string[];
|
|
526
|
+
type: 'delivery' | 'read' | 'played';
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface GroupStatusContent extends StatusContent {
|
|
530
|
+
groupStatus: true;
|
|
531
|
+
/** Select the legacy groupStatusMessage envelope for compatibility testing. */
|
|
532
|
+
groupStatusVersion?: 'legacy' | 'v1' | 'v2';
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** One status distribution list entry as returned by `getStatusPrivacy`. */
|
|
536
|
+
export interface StatusPrivacyList {
|
|
537
|
+
type?: string;
|
|
538
|
+
id?: string;
|
|
539
|
+
listname?: string;
|
|
540
|
+
emoji?: string;
|
|
541
|
+
selected?: boolean;
|
|
542
|
+
deleted?: boolean;
|
|
543
|
+
members: string[];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/** Custom named status list passed to `setStatusPrivacy`. */
|
|
547
|
+
export interface StatusCustomList {
|
|
548
|
+
id: string;
|
|
549
|
+
listname: string;
|
|
550
|
+
emoji?: string;
|
|
551
|
+
selected?: boolean;
|
|
552
|
+
deleted?: boolean;
|
|
553
|
+
members?: string[];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/** Result of `fetchBroadcastListQuota`. */
|
|
557
|
+
export interface BroadcastListQuota {
|
|
558
|
+
messagesLeft: number;
|
|
559
|
+
totalLimit: number;
|
|
560
|
+
isHeavySender: boolean;
|
|
561
|
+
startTs: number;
|
|
562
|
+
endTs: number;
|
|
563
|
+
resetTs: number;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** Entry accepted by `storePrivacyTokens`. */
|
|
567
|
+
export interface PrivacyTokenEntry {
|
|
568
|
+
jid: string;
|
|
569
|
+
privacyToken: Buffer;
|
|
570
|
+
privacyModeTs?: number | string;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** A bot (persona) entry as returned by `getBotListV2` / `getBotProfile`. */
|
|
574
|
+
export interface BotProfile {
|
|
575
|
+
jid?: string;
|
|
576
|
+
personaId?: string;
|
|
577
|
+
name?: string;
|
|
578
|
+
description?: string;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/** A group profile picture as returned by `getGroupProfilePictures`. */
|
|
582
|
+
export interface GroupProfilePicture {
|
|
583
|
+
jid?: string;
|
|
584
|
+
type?: string;
|
|
585
|
+
directPath?: string;
|
|
586
|
+
url?: string;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** Result of `groupJoinLinked`. */
|
|
590
|
+
export interface GroupJoinLinkedResult {
|
|
591
|
+
approvalRequested: boolean;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/** Options for `aiGroupCreate`. */
|
|
595
|
+
export interface AIGroupCreateOptions {
|
|
596
|
+
ephemeralExpiration?: number;
|
|
597
|
+
memberAddMode?: string;
|
|
598
|
+
memberShareGroupHistoryMode?: string;
|
|
599
|
+
memberLinkMode?: string;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Options for `aiPrompt`. */
|
|
603
|
+
export interface AIPromptOptions {
|
|
604
|
+
/** ms to wait for the bot response before rejecting (default 60000). */
|
|
605
|
+
timeout?: number;
|
|
606
|
+
/** Best-effort streaming hook — called with each bot message edit in the chat. */
|
|
607
|
+
onPartial?: (message: unknown, key: WAMessageKey) => void;
|
|
608
|
+
/** Canonical Meta AI bot JID (default `867051314767696@bot`). */
|
|
609
|
+
botUser?: string;
|
|
610
|
+
/** Extra JIDs to mention alongside the bot in group prompts. */
|
|
611
|
+
mentions?: string[];
|
|
612
|
+
/** Extra options forwarded to `sendMessage` (quoted, linkPreview, ...). */
|
|
613
|
+
[key: string]: unknown;
|
|
614
|
+
}
|
|
615
|
+
/** Options for the verified Meta AI (Hatch) send path. */
|
|
616
|
+
export interface MetaAISendOptions {
|
|
617
|
+
/** Destination JID; defaults to `867051314767696@bot` for a direct prompt. */
|
|
618
|
+
jid?: string;
|
|
619
|
+
invokerJid?: string;
|
|
620
|
+
sessionId?: string;
|
|
621
|
+
messageSecret?: Buffer;
|
|
622
|
+
capabilities?: number[];
|
|
623
|
+
/** F-BID used when invoking Meta AI in a group. */
|
|
624
|
+
botFbid?: string;
|
|
625
|
+
/** Add a visible Meta AI mention to a group prompt. */
|
|
626
|
+
mention?: boolean;
|
|
627
|
+
personaType?: string;
|
|
628
|
+
agentEngagementType?: string;
|
|
629
|
+
modeSelected?: string;
|
|
630
|
+
conversationContext?: Uint8Array | Buffer;
|
|
631
|
+
quoted?: unknown;
|
|
632
|
+
links?: unknown;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export interface RichMenuButton {
|
|
636
|
+
id?: string;
|
|
637
|
+
text?: string;
|
|
638
|
+
label?: string;
|
|
639
|
+
toast?: string;
|
|
640
|
+
url?: string;
|
|
641
|
+
useWebview?: boolean;
|
|
642
|
+
call?: string;
|
|
643
|
+
copy?: string;
|
|
644
|
+
icon?: string;
|
|
645
|
+
sections?: unknown[];
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export interface RichMenuContent {
|
|
649
|
+
header?: {
|
|
650
|
+
title?: string;
|
|
651
|
+
disclaimer?: boolean;
|
|
652
|
+
disclaimerText?: string;
|
|
653
|
+
image?: { url: string; mime_type?: string; mimeType?: string; width?: number; height?: number; inline?: boolean };
|
|
654
|
+
};
|
|
655
|
+
body?: {
|
|
656
|
+
title?: string;
|
|
657
|
+
toast?: string;
|
|
658
|
+
carousel?: boolean;
|
|
659
|
+
row?: boolean;
|
|
660
|
+
buttons?: Array<string | RichMenuButton>;
|
|
661
|
+
cards?: Array<{ title?: string; toast?: string; buttons?: Array<string | RichMenuButton> }>;
|
|
662
|
+
};
|
|
663
|
+
footer?: {
|
|
664
|
+
text?: string;
|
|
665
|
+
url?: string;
|
|
666
|
+
image?: { url: string; mime_type?: string; mimeType?: string; width?: number; height?: number };
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface RichGenerationContent {
|
|
671
|
+
text?: string;
|
|
672
|
+
mediaType?: 'image' | 'video' | string;
|
|
673
|
+
url?: string;
|
|
674
|
+
thumbnail?: string | Uint8Array | Record<string, unknown>;
|
|
675
|
+
mimeType?: string;
|
|
676
|
+
fileLength?: number;
|
|
677
|
+
duration?: number;
|
|
678
|
+
status?: 'GENERATING' | 'READY' | 'FAILED' | string;
|
|
679
|
+
estimatedMs?: number;
|
|
680
|
+
itemId?: string;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface RichGenerationResult {
|
|
684
|
+
message: unknown;
|
|
685
|
+
messageId: string;
|
|
686
|
+
responseId: string;
|
|
687
|
+
itemId: string;
|
|
688
|
+
targetId?: string;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
export interface WhatsAppFlowResponse {
|
|
692
|
+
name: string;
|
|
693
|
+
version?: number;
|
|
694
|
+
paramsJson: string;
|
|
695
|
+
params: Record<string, unknown>;
|
|
696
|
+
isFlow: boolean;
|
|
697
|
+
flowId?: string;
|
|
698
|
+
flowToken?: string;
|
|
699
|
+
flowTokenPayload?: Record<string, unknown>;
|
|
700
|
+
flowName?: string;
|
|
701
|
+
flowTitle?: string;
|
|
702
|
+
flowCreationSource?: string;
|
|
703
|
+
screen?: string;
|
|
704
|
+
action?: string;
|
|
705
|
+
actionPayload: Record<string, unknown>;
|
|
706
|
+
data: Record<string, unknown>;
|
|
707
|
+
flowResponse?: Record<string, unknown>;
|
|
708
|
+
screens: unknown[];
|
|
709
|
+
formData: Record<string, unknown>;
|
|
710
|
+
buttonId?: string;
|
|
711
|
+
displayText?: string;
|
|
712
|
+
raw: Record<string, unknown>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export interface WhatsAppFeedbackResponse extends WhatsAppFlowResponse {
|
|
716
|
+
feedback: {
|
|
717
|
+
satisfactionLevel?: string;
|
|
718
|
+
questionAnswered?: string;
|
|
719
|
+
improvementSuggestion?: string;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/** Decode a native-flow response, including Meta's nested appointment-flow response envelope. */
|
|
724
|
+
export declare function parseWhatsAppFlowResponse(message: unknown): WhatsAppFlowResponse | null;
|
|
725
|
+
/** Decode a submitted WhatsApp support/CSAT feedback Flow. */
|
|
726
|
+
export declare function parseWhatsAppFeedbackResponse(message: unknown): WhatsAppFeedbackResponse | null;
|
|
727
|
+
/** Build WhatsApp's native booking_confirmation button payload. */
|
|
728
|
+
export declare function buildBookingConfirmationButton(booking: {
|
|
729
|
+
location: string;
|
|
730
|
+
startDatetime: string;
|
|
731
|
+
endDatetime: string;
|
|
732
|
+
email?: string;
|
|
733
|
+
}): { name: 'booking_confirmation'; buttonParamsJson: string };
|
|
734
|
+
/** Build WhatsApp's native request_contact_info button payload. */
|
|
735
|
+
export declare function buildRequestContactInfoButton(content?: {
|
|
736
|
+
buttonParams?: Record<string, unknown>;
|
|
737
|
+
}): { name: 'request_contact_info'; buttonParamsJson?: string };
|
|
738
|
+
|
|
739
|
+
export interface RelayMessageOptions {
|
|
740
|
+
messageId?: string;
|
|
741
|
+
/** Recipient-only delivery: skip the sender's own devices in a one-to-one chat. */
|
|
742
|
+
participant?: { jid: string };
|
|
743
|
+
/** Retry resend target; requires a device JID and retry count. */
|
|
744
|
+
participants?: { jid: string; count: number };
|
|
745
|
+
retryParticipants?: { jid: string; count: number };
|
|
746
|
+
/** Keep only the target's primary device in supported private-chat fan-out paths; not encryption. */
|
|
747
|
+
isSecret?: boolean;
|
|
748
|
+
/** Skip the target's linked devices in supported private-chat fan-out paths; enforcement is client-dependent. */
|
|
749
|
+
protected?: boolean;
|
|
750
|
+
/** Keep only the sender's own devices in supported private-chat fan-out paths. */
|
|
751
|
+
me?: boolean;
|
|
752
|
+
[key: string]: unknown;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
export interface AlbumMediaInput {
|
|
756
|
+
image?: unknown;
|
|
757
|
+
video?: unknown;
|
|
758
|
+
type?: 'image' | 'video';
|
|
759
|
+
data?: unknown;
|
|
760
|
+
sourceUrl?: string;
|
|
761
|
+
imagePreviewUrl?: string;
|
|
762
|
+
imageHighResUrl?: string;
|
|
763
|
+
darkModePreviewUrl?: string;
|
|
764
|
+
darkModeHighResUrl?: string;
|
|
765
|
+
width?: number;
|
|
766
|
+
height?: number;
|
|
767
|
+
darkWidth?: number;
|
|
768
|
+
darkHeight?: number;
|
|
769
|
+
caption?: string;
|
|
770
|
+
[key: string]: unknown;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface AnimatedWallpaperInput {
|
|
774
|
+
id?: string;
|
|
775
|
+
animatedWallpaperId?: string;
|
|
776
|
+
dimLevel?: number;
|
|
777
|
+
opacity?: number;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export interface ChatThemeInput {
|
|
781
|
+
settingTimestampMs?: number;
|
|
782
|
+
clearTheme?: boolean;
|
|
783
|
+
colorSchemeId?: string;
|
|
784
|
+
chatThemeId?: string;
|
|
785
|
+
dimLevel?: number;
|
|
786
|
+
defaultWallpaper?: boolean | { isDoodleEnabled?: boolean };
|
|
787
|
+
solidColor?: string | number | {
|
|
788
|
+
color?: string | number;
|
|
789
|
+
colorLight?: string | number;
|
|
790
|
+
colorDark?: string | number;
|
|
791
|
+
doodleColorLight?: string | number;
|
|
792
|
+
doodleColorDark?: string | number;
|
|
793
|
+
isDoodleEnabled?: boolean;
|
|
794
|
+
};
|
|
795
|
+
stockImage?: { id?: string; stockImageId?: string; dimLevel?: number; opacity?: number };
|
|
796
|
+
animatedWallpaper?: AnimatedWallpaperInput;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface A2UIMessageContent {
|
|
800
|
+
image?: unknown;
|
|
801
|
+
bloksWidget?: { type?: string; data?: unknown; fallback?: string };
|
|
802
|
+
nativeFlowMessage?: { messageParamsJson?: string; buttons?: unknown[]; [key: string]: unknown };
|
|
803
|
+
[key: string]: unknown;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export interface A2UIBuildOptions {
|
|
807
|
+
uuid?: string;
|
|
808
|
+
surfaceId?: string;
|
|
809
|
+
type?: string;
|
|
810
|
+
wrapped?: boolean;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export interface A2UIBuildResult {
|
|
814
|
+
uuid: string;
|
|
815
|
+
data: string;
|
|
816
|
+
type: string;
|
|
817
|
+
fallback?: string;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
export interface A2UIWidgetSendOptions {
|
|
821
|
+
a2ui: A2UI;
|
|
822
|
+
bodyText?: string;
|
|
823
|
+
fallback?: string;
|
|
824
|
+
footer?: string;
|
|
825
|
+
buttons?: Array<{ name?: string; params?: string | Record<string, unknown> }>;
|
|
826
|
+
contextInfo?: Record<string, unknown>;
|
|
827
|
+
expiration?: number;
|
|
828
|
+
quoted?: unknown;
|
|
829
|
+
type?: string;
|
|
830
|
+
wrapped?: boolean;
|
|
831
|
+
singleScreen?: boolean;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export class A2UI {
|
|
835
|
+
constructor(options?: { catalogId?: string; version?: string });
|
|
836
|
+
text(text: string, options?: { id?: string; variant?: string }): string;
|
|
837
|
+
image(url: string, options?: { id?: string; variant?: string; fit?: string }): string;
|
|
838
|
+
/** Add an Image component with variant="header" unless a variant is explicitly supplied. */
|
|
839
|
+
header(url: string, options?: { id?: string; variant?: string; fit?: string }): string;
|
|
840
|
+
video(url: string, options?: { id?: string }): string;
|
|
841
|
+
checkbox(label: string, options?: { id?: string; value?: boolean }): string;
|
|
842
|
+
textField(label: string, options?: { id?: string; variant?: string }): string;
|
|
843
|
+
button(childId: string, options?: { id?: string; variant?: string; action?: Record<string, unknown> }): string;
|
|
844
|
+
card(childId: string, options?: { id?: string }): string;
|
|
845
|
+
column(children?: string[], options?: { id?: string; justify?: string; align?: string }): string;
|
|
846
|
+
row(children?: string[], options?: { id?: string }): string;
|
|
847
|
+
divider(options?: { id?: string }): string;
|
|
848
|
+
choicePicker(label: string, options: Array<Record<string, unknown>>, settings?: { id?: string; variant?: string; value?: unknown; displayStyle?: string; filterable?: boolean }): string;
|
|
849
|
+
root(children: string[]): this;
|
|
850
|
+
only(componentId: string): this;
|
|
851
|
+
/** Creates and roots a standalone image with variant="header" by default. */
|
|
852
|
+
imageOnly(url: string, options?: { id?: string; variant?: string; fit?: string }): this;
|
|
853
|
+
/** Creates and roots a standalone video component. */
|
|
854
|
+
videoOnly(url: string, options?: { id?: string }): this;
|
|
855
|
+
headerOnly(url: string, options?: { id?: string; variant?: string; fit?: string }): this;
|
|
856
|
+
cardOnly(childId: string, options?: { id?: string }): this;
|
|
857
|
+
listCard(options: { title: string; items: Array<{ assetId?: string; assetType?: string; title?: string; price?: string; trailingLabel?: string; emphasis?: string }>; fallbackText?: string; uuid?: string }): this;
|
|
858
|
+
build(options?: A2UIBuildOptions): A2UIBuildResult;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
export function sendA2UIWidget(client: { relayMessage(jid: string, message: unknown, options?: Record<string, unknown>): Promise<unknown> }, jid: string, options: A2UIWidgetSendOptions): Promise<unknown>;
|
|
862
|
+
|
|
863
|
+
export interface A2UICommandMenuContent {
|
|
864
|
+
image?: unknown;
|
|
865
|
+
title?: string;
|
|
866
|
+
rows?: Array<[string, string, string?] | { title?: string; description?: string; id?: string }>;
|
|
867
|
+
buttons?: Array<{ text?: string; label?: string; url?: string }>;
|
|
868
|
+
fallback?: string;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export interface InteractiveContactCardContent {
|
|
872
|
+
/** Text shown in interactiveMessage.header.title. */
|
|
873
|
+
title: string;
|
|
874
|
+
/** Full body text; when omitted it is composed from title, detailLabel, and description. */
|
|
875
|
+
body?: string;
|
|
876
|
+
detailLabel?: string;
|
|
877
|
+
description?: string;
|
|
878
|
+
/** Defaults to inapp_signup; changing it can change client rendering and behavior. */
|
|
879
|
+
buttonName?: string;
|
|
880
|
+
/** Serialized to nativeFlowMessage.buttons[0].buttonParamsJson. */
|
|
881
|
+
buttonParams?: Record<string, unknown>;
|
|
882
|
+
footer?: string;
|
|
883
|
+
/** Optional image media rendered in the interactive header. */
|
|
884
|
+
image?: unknown;
|
|
885
|
+
/** Optional video media rendered in the interactive header. */
|
|
886
|
+
video?: unknown;
|
|
887
|
+
/** Optional MP4/video media rendered with GIF playback enabled in the header. */
|
|
888
|
+
gif?: unknown;
|
|
889
|
+
/** Sends the card followed by a separate associated still-image/motion-video pair. */
|
|
890
|
+
livePhoto?: {
|
|
891
|
+
video: unknown;
|
|
892
|
+
image?: unknown;
|
|
893
|
+
thumbnail?: unknown;
|
|
894
|
+
videoThumbnail?: Uint8Array;
|
|
895
|
+
imageThumbnail?: Uint8Array;
|
|
896
|
+
caption?: string;
|
|
897
|
+
text?: string;
|
|
898
|
+
motionPhotoPresentationOffsetMs?: number;
|
|
899
|
+
presentationOffsetMs?: number;
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
export interface LocationButtonCardContent {
|
|
904
|
+
/** LocationMessage.name rendered in the card header. */
|
|
905
|
+
title: string;
|
|
906
|
+
/** LocationMessage.address rendered below the title. */
|
|
907
|
+
subtitle?: string;
|
|
908
|
+
/** Main message body shown below the thumbnail header. */
|
|
909
|
+
text: string;
|
|
910
|
+
/** JPEG thumbnail bytes embedded in LocationMessage.jpegThumbnail. */
|
|
911
|
+
thumbnail?: Uint8Array;
|
|
912
|
+
/** Defaults to 0,0 to match the observed payload; these are real location fields. */
|
|
913
|
+
latitude?: number;
|
|
914
|
+
longitude?: number;
|
|
915
|
+
buttons: Array<{ id: string; text: string }>;
|
|
916
|
+
footer?: string;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export interface MenuButtonCardContent {
|
|
920
|
+
/** Non-empty title rendered in the card caption below the image. */
|
|
921
|
+
title: string;
|
|
922
|
+
/** Optional subtitle rendered on its own caption line. */
|
|
923
|
+
subtitle?: string;
|
|
924
|
+
/** Optional additional menu text rendered below the title and subtitle. */
|
|
925
|
+
text?: string;
|
|
926
|
+
/** Image bytes uploaded as a normal image header; this is not a location thumbnail. */
|
|
927
|
+
image: Uint8Array;
|
|
928
|
+
buttons: Array<{ id: string; text: string }>;
|
|
929
|
+
footer?: string;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
export interface StickerAnnotationContent {
|
|
933
|
+
/** Key of the existing message this sticker should be associated with. */
|
|
934
|
+
parentMessageKey: WAMessageKey & { id: string };
|
|
935
|
+
/** Prepared StickerMessage protobuf fields, including URL/directPath and matching encryption metadata. */
|
|
936
|
+
stickerMessage: Record<string, unknown> & { url?: string; directPath?: string; isAnimated?: boolean };
|
|
937
|
+
/** Number of identical annotation messages to relay (1–20; defaults to 1). */
|
|
938
|
+
count?: number;
|
|
939
|
+
/** Delay between sends in milliseconds (0–60000; defaults to 1000). */
|
|
940
|
+
intervalMs?: number;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export interface SocialEntityContent {
|
|
944
|
+
username?: string;
|
|
945
|
+
platform?: string;
|
|
946
|
+
title?: string;
|
|
947
|
+
subtitle?: string;
|
|
948
|
+
imageUrl?: string;
|
|
949
|
+
entityId?: string | number;
|
|
950
|
+
entityUrl?: string;
|
|
951
|
+
entityType?: string;
|
|
952
|
+
fullName?: string;
|
|
953
|
+
isVerified?: boolean;
|
|
954
|
+
resultText?: string;
|
|
955
|
+
botJid?: string;
|
|
956
|
+
responseId?: string;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export interface RichMapAnnotation {
|
|
960
|
+
annotationNumber?: number;
|
|
961
|
+
latitude: number;
|
|
962
|
+
longitude: number;
|
|
963
|
+
title?: string;
|
|
964
|
+
body?: string;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export interface RichMapContent {
|
|
968
|
+
centerLatitude: number;
|
|
969
|
+
centerLongitude: number;
|
|
970
|
+
latitudeDelta?: number;
|
|
971
|
+
longitudeDelta?: number;
|
|
972
|
+
annotations?: RichMapAnnotation[];
|
|
973
|
+
showInfoList?: boolean;
|
|
974
|
+
verificationMetadata?: Record<string, unknown>;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export interface BotPromptSuggestionInput {
|
|
978
|
+
prompt?: string;
|
|
979
|
+
promptId?: string;
|
|
980
|
+
text?: string;
|
|
981
|
+
id?: string;
|
|
982
|
+
}
|
|
983
|
+
export interface BotPromptSuggestionsContent {
|
|
984
|
+
text?: string;
|
|
985
|
+
suggestions: Array<string | BotPromptSuggestionInput>;
|
|
986
|
+
selectedPromptIndex?: number;
|
|
987
|
+
selectedPromptId?: string;
|
|
988
|
+
verificationMetadata?: Record<string, unknown>;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export interface BotSourceContent {
|
|
992
|
+
provider?: number;
|
|
993
|
+
thumbnailCdnUrl?: string;
|
|
994
|
+
thumbnailUrl?: string;
|
|
995
|
+
sourceProviderUrl?: string;
|
|
996
|
+
url?: string;
|
|
997
|
+
sourceQuery?: string;
|
|
998
|
+
query?: string;
|
|
999
|
+
faviconCdnUrl?: string;
|
|
1000
|
+
faviconUrl?: string;
|
|
1001
|
+
citationNumber?: number;
|
|
1002
|
+
sourceTitle?: string;
|
|
1003
|
+
title?: string;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export interface BotSourcesContent {
|
|
1007
|
+
text?: string;
|
|
1008
|
+
sources: BotSourceContent[];
|
|
1009
|
+
verificationMetadata?: Record<string, unknown>;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export interface RichDynamicMediaContent {
|
|
1013
|
+
url: string;
|
|
1014
|
+
type?: 'IMAGE' | 'GIF' | string;
|
|
1015
|
+
version?: number;
|
|
1016
|
+
loopCount?: number;
|
|
1017
|
+
verificationMetadata?: Record<string, unknown>;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
export interface BotPttTranscriptContent {
|
|
1021
|
+
transcript: string;
|
|
1022
|
+
text?: string;
|
|
1023
|
+
verificationMetadata?: Record<string, unknown>;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
export interface AIRichCommandMenuContent {
|
|
1027
|
+
image: string;
|
|
1028
|
+
title?: string;
|
|
1029
|
+
subtitle?: string;
|
|
1030
|
+
code?: string;
|
|
1031
|
+
rows?: Array<[string, string] | { command?: string; description?: string }>;
|
|
1032
|
+
latexImage?: string;
|
|
1033
|
+
latexExpression?: string;
|
|
1034
|
+
buttons?: Array<{ id?: string; text?: string; label?: string; url?: string; toast?: string }>;
|
|
1035
|
+
footer?: string;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export declare function parseUnifiedResponseData(data: unknown): Record<string, unknown> | null;
|
|
1039
|
+
export declare function textFromUnifiedResponse(data: unknown): string | null;
|
|
1040
|
+
export declare function textFromRichResponse(message: unknown): string | null;
|
|
1041
|
+
export declare function extractMetaAiText(message: unknown): string | null;
|
|
1042
|
+
export declare function decodeUnifiedResponseInPlace<T extends Record<string, unknown>>(message: T): T;
|
|
1043
|
+
export interface MetaCompositedOptions {
|
|
1044
|
+
thinkingMs?: number;
|
|
1045
|
+
description?: string;
|
|
1046
|
+
steps?: Array<Record<string, unknown>>;
|
|
1047
|
+
estimatedMs?: number;
|
|
1048
|
+
placeholderText?: string;
|
|
1049
|
+
sendOptions?: Record<string, unknown>;
|
|
1050
|
+
useNativeMeta?: boolean;
|
|
1051
|
+
streamUpdates?: Array<string | Record<string, unknown>>;
|
|
1052
|
+
streamUpdateDelayMs?: number;
|
|
1053
|
+
streamContext?: Record<string, unknown>;
|
|
1054
|
+
}
|
|
1055
|
+
export declare function editMetaMessage(sock: WASocket, jid: string, key: WAMessageKey, content: Record<string, unknown>, sendOptions?: Record<string, unknown>, streamContext?: Record<string, unknown>): Promise<unknown>;
|
|
1056
|
+
export declare function sendMetaComposited(sock: WASocket, jid: string, content: Record<string, unknown>, options?: MetaCompositedOptions): Promise<unknown>;
|
|
1057
|
+
|
|
1058
|
+
export type PlogmeSimpleTable = unknown[][];
|
|
1059
|
+
export interface PlogmeRichTable {
|
|
1060
|
+
title?: string;
|
|
1061
|
+
headers: unknown[];
|
|
1062
|
+
rows: unknown[][];
|
|
1063
|
+
headerText?: string;
|
|
1064
|
+
footer?: string;
|
|
1065
|
+
}
|
|
1066
|
+
export type PlogmeTableInput = PlogmeSimpleTable | PlogmeRichTable;
|
|
1067
|
+
export interface PlogmeCalendarWidgetAction {
|
|
1068
|
+
label: string;
|
|
1069
|
+
state?: string;
|
|
1070
|
+
kind?: string;
|
|
1071
|
+
id?: string;
|
|
1072
|
+
toolCallId?: string;
|
|
1073
|
+
tool_call_id?: string;
|
|
1074
|
+
toast?: string | { label?: string };
|
|
1075
|
+
}
|
|
1076
|
+
export interface PlogmeCalendarWidget {
|
|
1077
|
+
title?: string;
|
|
1078
|
+
/** Pass-through GenAI calendar event-list section objects; the exact event schema is not yet documented. */
|
|
1079
|
+
sections?: Array<Record<string, unknown>>;
|
|
1080
|
+
actions?: PlogmeCalendarWidgetAction[];
|
|
1081
|
+
}
|
|
1082
|
+
export interface PlogmeEmbeddedScreenTab {
|
|
1083
|
+
id?: string;
|
|
1084
|
+
tab_header?: string;
|
|
1085
|
+
title?: string;
|
|
1086
|
+
sections: Array<Record<string, unknown>>;
|
|
1087
|
+
/** Native image/video items appended to this tab using the standard media primitive builders. */
|
|
1088
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
1089
|
+
step_entries?: unknown[];
|
|
1090
|
+
}
|
|
1091
|
+
export interface PlogmeEmbeddedScreen extends Record<string, unknown> {
|
|
1092
|
+
title?: string;
|
|
1093
|
+
/** Pass a complete embedded-screen content array, or use tabs for a FOAIDNixelButtonSheets wrapper. */
|
|
1094
|
+
content?: Array<Record<string, unknown>>;
|
|
1095
|
+
tabs?: PlogmeEmbeddedScreenTab[];
|
|
1096
|
+
}
|
|
1097
|
+
export interface RichMediaItem extends Record<string, unknown> {
|
|
1098
|
+
type?: 'image' | 'photo' | 'video' | string;
|
|
1099
|
+
url?: string;
|
|
1100
|
+
imageUrl?: string;
|
|
1101
|
+
videoUrl?: string;
|
|
1102
|
+
reelsUrl?: string;
|
|
1103
|
+
thumbnailUrl?: string;
|
|
1104
|
+
thumbnail?: string;
|
|
1105
|
+
mimeType?: string;
|
|
1106
|
+
width?: number;
|
|
1107
|
+
height?: number;
|
|
1108
|
+
duration?: number;
|
|
1109
|
+
progressiveUrls?: string[];
|
|
1110
|
+
dashManifests?: string[];
|
|
1111
|
+
}
|
|
1112
|
+
export interface RichMediaTab extends Record<string, unknown> {
|
|
1113
|
+
id?: string;
|
|
1114
|
+
tab_header?: string;
|
|
1115
|
+
tabHeader?: string;
|
|
1116
|
+
title?: string;
|
|
1117
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
1118
|
+
html?: string;
|
|
1119
|
+
trustedSources?: string[];
|
|
1120
|
+
sections?: Array<Record<string, unknown>>;
|
|
1121
|
+
step_entries?: unknown[];
|
|
1122
|
+
}
|
|
1123
|
+
export interface RichMediaMessageContent extends Record<string, unknown> {
|
|
1124
|
+
title?: string;
|
|
1125
|
+
tabHeader?: string;
|
|
1126
|
+
media?: RichMediaItem | string | Array<RichMediaItem | string>;
|
|
1127
|
+
tabs?: RichMediaTab[];
|
|
1128
|
+
trustedSources?: string[];
|
|
1129
|
+
verificationMetadata?: Record<string, unknown>;
|
|
1130
|
+
}
|
|
1131
|
+
export type PlogmeReminderAction = 'NOTIFY' | 'CREATE' | 'DELETE' | 'UPDATE' | 1 | 2 | 3 | 4;
|
|
1132
|
+
export type PlogmeReminderFrequency = 'ONCE' | 'DAILY' | 'WEEKLY' | 'BIWEEKLY' | 'MONTHLY' | 1 | 2 | 3 | 4 | 5;
|
|
1133
|
+
export interface PlogmeReminderMetadata {
|
|
1134
|
+
requestMessageKey?: Record<string, unknown>;
|
|
1135
|
+
action?: PlogmeReminderAction;
|
|
1136
|
+
name?: string;
|
|
1137
|
+
/** Raw non-negative protobuf uint64; timestamp units are not inferred by this library. */
|
|
1138
|
+
nextTriggerTimestamp?: number | string;
|
|
1139
|
+
frequency?: PlogmeReminderFrequency;
|
|
1140
|
+
}
|
|
1141
|
+
export type RichAIImageURL = string | {
|
|
1142
|
+
imagePreviewUrl?: string;
|
|
1143
|
+
imageHighResUrl?: string;
|
|
1144
|
+
sourceUrl?: string;
|
|
1145
|
+
url?: string;
|
|
1146
|
+
[key: string]: unknown;
|
|
1147
|
+
};
|
|
1148
|
+
export type RichAIResponseSection =
|
|
1149
|
+
| { type: 'table'; title?: string; headers?: unknown[]; rows?: unknown[][]; headerText?: string; footer?: string; value?: unknown; options?: Record<string, unknown> }
|
|
1150
|
+
| { type: 'list'; title?: string; items?: unknown[]; headerText?: string; footer?: string; value?: unknown; options?: Record<string, unknown> }
|
|
1151
|
+
| { type: 'codeBlock'; code?: string; language?: string; title?: string; footer?: string; value?: unknown; options?: Record<string, unknown> }
|
|
1152
|
+
| { type: 'latex'; text?: string; expressions?: Array<Record<string, unknown>>; headerText?: string; footer?: string; value?: string | Record<string, unknown>; options?: Record<string, unknown> }
|
|
1153
|
+
| { type: 'plain' | 'text'; text?: string; messageText?: string; inlineEntities?: Array<Record<string, unknown>>; value?: string; options?: Record<string, unknown> }
|
|
1154
|
+
| { type: 'gridImage'; imageUrls?: RichAIImageURL[]; images?: RichAIImageURL[]; gridImageUrl?: RichAIImageURL; value?: RichAIImageURL[] | Record<string, unknown>; options?: Record<string, unknown> }
|
|
1155
|
+
| { type: 'inlineImage'; imageUrl?: RichAIImageURL; url?: string; image?: RichAIImageURL; imageText?: string; text?: string; alignment?: number | string; tapLinkUrl?: string; value?: RichAIImageURL | Record<string, unknown>; options?: Record<string, unknown> }
|
|
1156
|
+
| { type: 'dynamic'; url?: string; imageUrl?: string; mediaUrl?: string; mediaType?: 'IMAGE' | 'GIF'; dynamicType?: 'IMAGE' | 'GIF'; kind?: 'IMAGE' | 'GIF'; version?: number; loopCount?: number; value?: string | Record<string, unknown>; options?: Record<string, unknown> }
|
|
1157
|
+
| { type: 'map'; centerLatitude?: number; centerLongitude?: number; latitudeDelta?: number; longitudeDelta?: number; annotations?: Array<Record<string, unknown>>; showInfoList?: boolean; text?: string; value?: Record<string, unknown>; options?: Record<string, unknown> }
|
|
1158
|
+
| { type: 'contentItems'; items?: Array<Record<string, unknown>>; itemsMetadata?: Array<Record<string, unknown>>; contentType?: number | string; value?: Array<Record<string, unknown>> | Record<string, unknown>; options?: Record<string, unknown> };
|
|
1159
|
+
export interface RichAIResponseContent extends Record<string, unknown> {
|
|
1160
|
+
/** Ordered mixed rich blocks. Use this array when the order matters. */
|
|
1161
|
+
sections?: RichAIResponseSection[];
|
|
1162
|
+
/** Legacy shorthand forms; multiple supplied keys are composed in table/list/codeBlock/latex/plain/text/gridImage/inlineImage/dynamic/map/contentItems order. */
|
|
1163
|
+
table?: { title?: string; headers?: unknown[]; rows?: unknown[][]; headerText?: string; footer?: string };
|
|
1164
|
+
list?: { title?: string; items?: unknown[]; headerText?: string; footer?: string };
|
|
1165
|
+
codeBlock?: { code?: string; language?: string; title?: string; footer?: string };
|
|
1166
|
+
latex?: string | { text?: string; expressions?: Array<Record<string, unknown>>; headerText?: string; footer?: string; [key: string]: unknown };
|
|
1167
|
+
plain?: string | { text?: string; messageText?: string; inlineEntities?: Array<Record<string, unknown>> };
|
|
1168
|
+
text?: string | { text?: string; messageText?: string; inlineEntities?: Array<Record<string, unknown>> };
|
|
1169
|
+
gridImage?: { imageUrls?: RichAIImageURL[]; images?: RichAIImageURL[]; gridImageUrl?: RichAIImageURL } | RichAIImageURL[];
|
|
1170
|
+
inlineImage?: RichAIImageURL | { imageUrl?: RichAIImageURL; url?: string; image?: RichAIImageURL; imageText?: string; text?: string; alignment?: number | string; tapLinkUrl?: string };
|
|
1171
|
+
dynamic?: { url?: string; imageUrl?: string; mediaUrl?: string; mediaType?: 'IMAGE' | 'GIF'; dynamicType?: 'IMAGE' | 'GIF'; kind?: 'IMAGE' | 'GIF'; version?: number; loopCount?: number } | string;
|
|
1172
|
+
map?: { centerLatitude: number; centerLongitude: number; latitudeDelta?: number; longitudeDelta?: number; annotations?: Array<Record<string, unknown>>; showInfoList?: boolean; text?: string };
|
|
1173
|
+
contentItems?: { items?: Array<Record<string, unknown>>; itemsMetadata?: Array<Record<string, unknown>>; contentType?: number | string } | Array<Record<string, unknown>>;
|
|
1174
|
+
}
|
|
1175
|
+
export interface PlogmeMessageContent extends Record<string, unknown> {
|
|
1176
|
+
/** Exclusive A2UI mode routed to sendA2UIMessage; do not combine with AIRich sections. */
|
|
1177
|
+
a2ui?: A2UIMessageContent;
|
|
1178
|
+
table?: PlogmeTableInput;
|
|
1179
|
+
richTable?: PlogmeRichTable;
|
|
1180
|
+
tables?: PlogmeTableInput[];
|
|
1181
|
+
/** Experimental calendar-event-list widget, composable with other AIRich sections. */
|
|
1182
|
+
calendarWidget?: PlogmeCalendarWidget;
|
|
1183
|
+
/** Add one or more embedded screens alongside ordinary AIRich sections. */
|
|
1184
|
+
embeddedScreen?: PlogmeEmbeddedScreen;
|
|
1185
|
+
embeddedScreens?: PlogmeEmbeddedScreen[];
|
|
1186
|
+
/** Experimental BotReminderMetadata attached to the AIRich bot envelope. */
|
|
1187
|
+
reminderMetadata?: PlogmeReminderMetadata;
|
|
1188
|
+
/** Compose one or more colored GenAI label primitives into the same unified AIRich response as other sections. */
|
|
1189
|
+
richLabel?: {
|
|
1190
|
+
text?: string;
|
|
1191
|
+
variant?: string;
|
|
1192
|
+
backgroundColor?: string;
|
|
1193
|
+
textColor?: string;
|
|
1194
|
+
responseId?: string;
|
|
1195
|
+
} | Array<{
|
|
1196
|
+
text?: string;
|
|
1197
|
+
variant?: string;
|
|
1198
|
+
backgroundColor?: string;
|
|
1199
|
+
textColor?: string;
|
|
1200
|
+
responseId?: string;
|
|
1201
|
+
}>;
|
|
1202
|
+
/** Alias for supplying multiple colored labels without overloading richLabel. */
|
|
1203
|
+
richLabels?: Array<{
|
|
1204
|
+
text?: string;
|
|
1205
|
+
variant?: string;
|
|
1206
|
+
backgroundColor?: string;
|
|
1207
|
+
textColor?: string;
|
|
1208
|
+
responseId?: string;
|
|
1209
|
+
}>;
|
|
1210
|
+
/** Compose one or more native bot prompt suggestion sets in the unified response. */
|
|
1211
|
+
suggestedPrompt?: BotPromptSuggestionsContent | BotPromptSuggestionsContent[];
|
|
1212
|
+
/** Legacy alias; object form is rendered as real prompt metadata, while true is ignored rather than shown as a sentinel. */
|
|
1213
|
+
suggested?: boolean | BotPromptSuggestionsContent | BotPromptSuggestionsContent[];
|
|
1214
|
+
}
|
|
1215
|
+
export interface SendPlogmeContent extends PlogmeMessageContent {
|
|
1216
|
+
/** RichAI blocks use sendRichAIResponse's submessage composer and preserve this order. */
|
|
1217
|
+
sections?: Array<RichAIResponseSection | Record<string, unknown>>;
|
|
1218
|
+
list?: { title?: string; items?: unknown[]; headerText?: string; footer?: string };
|
|
1219
|
+
codeBlock?: { code?: string; language?: string; title?: string; footer?: string };
|
|
1220
|
+
latex?: RichAIResponseContent['latex'];
|
|
1221
|
+
plain?: RichAIResponseContent['plain'];
|
|
1222
|
+
text?: RichAIResponseContent['text'];
|
|
1223
|
+
gridImage?: RichAIResponseContent['gridImage'];
|
|
1224
|
+
inlineImage?: RichAIResponseContent['inlineImage'];
|
|
1225
|
+
dynamic?: RichAIResponseContent['dynamic'];
|
|
1226
|
+
map?: RichAIResponseContent['map'];
|
|
1227
|
+
contentItems?: RichAIResponseContent['contentItems'];
|
|
1228
|
+
richResponse?: Array<Record<string, unknown>>;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** Fluent native-flow card builder. Reminder actions use relayMessage and a view-once envelope; client support may vary. */
|
|
1232
|
+
export declare class Button {
|
|
1233
|
+
constructor(socket: Pick<WASocket, 'sendMessage'> & Partial<Pick<WASocket, 'relayMessage'>>);
|
|
1234
|
+
setImage(source: unknown, options?: Record<string, unknown>): this;
|
|
1235
|
+
setVideo(source: unknown, options?: Record<string, unknown>): this;
|
|
1236
|
+
setTitle(title: string): this;
|
|
1237
|
+
setSubtitle(subtitle: string): this;
|
|
1238
|
+
setBody(body: string): this;
|
|
1239
|
+
setFooter(footer: string): this;
|
|
1240
|
+
addUrl(displayText: string, url: string, useWebview?: boolean): this;
|
|
1241
|
+
addReply(displayText: string, id: string): this;
|
|
1242
|
+
addReminder(displayText: string, id: string, options?: Record<string, unknown>): this;
|
|
1243
|
+
addCancelReminder(displayText: string, id: string, options?: Record<string, unknown>): this;
|
|
1244
|
+
toCard(): Promise<Record<string, unknown>>;
|
|
1245
|
+
send(jid: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1246
|
+
}
|
|
1247
|
+
export interface UnifiedThemedMessageContent extends PlogmeMessageContent {
|
|
1248
|
+
/** Title displayed at the top of the themed unified-response card. */
|
|
1249
|
+
title?: string;
|
|
1250
|
+
/** Optional secondary line displayed below the title. */
|
|
1251
|
+
subtitle?: string;
|
|
1252
|
+
/** Main Markdown-capable text body. */
|
|
1253
|
+
text?: string;
|
|
1254
|
+
/** Alias for text. */
|
|
1255
|
+
body?: string;
|
|
1256
|
+
/** Optional trailing text line. */
|
|
1257
|
+
footer?: string;
|
|
1258
|
+
/** Existing AIRich fields such as inlineImage, inlineVideo, dynamicMedia,
|
|
1259
|
+
* reels, links, html, table, richMap, and richSections may be included. */
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
export type C2582Target = string | { id?: string | null; stanzaId?: string | null };
|
|
1263
|
+
export interface C2582Result {
|
|
1264
|
+
key: { remoteJid: string; id: string };
|
|
1265
|
+
status: 'vanished';
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
export interface ScheduledMediaPair {
|
|
1269
|
+
parent: Record<string, unknown>;
|
|
1270
|
+
child: Record<string, unknown>;
|
|
1271
|
+
/** MessageAssociation enum value or enum name; defaults to MOTION_PHOTO. */
|
|
1272
|
+
associationType?: number | string;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/** Timestamp values used by experimental native MusicMessage lyrics. */
|
|
1276
|
+
export type MusicMessageTimestamp = number | bigint | string;
|
|
1277
|
+
export interface MusicMessageWordOffset {
|
|
1278
|
+
startIndex?: number;
|
|
1279
|
+
endIndex?: number;
|
|
1280
|
+
startOffsetMs?: MusicMessageTimestamp;
|
|
1281
|
+
endOffsetMs?: MusicMessageTimestamp;
|
|
1282
|
+
}
|
|
1283
|
+
export interface MusicMessageLyricLine {
|
|
1284
|
+
startTimeInMs?: MusicMessageTimestamp;
|
|
1285
|
+
endTimeInMs?: MusicMessageTimestamp;
|
|
1286
|
+
text?: string;
|
|
1287
|
+
wordOffsets?: MusicMessageWordOffset[];
|
|
1288
|
+
}
|
|
1289
|
+
/** Content for the experimental native MusicMessage protobuf slot. Lyrics are serialization-only and may not render. */
|
|
1290
|
+
export type MusicMessageContent = ({
|
|
1291
|
+
embeddedMusic?: Record<string, unknown>;
|
|
1292
|
+
songUri?: string;
|
|
1293
|
+
artworkUri?: string;
|
|
1294
|
+
/** Use proto.Message.MusicMessage.MusicMessageStyle values; MESSAGE_BUBBLE and LYRICS are experimental. */
|
|
1295
|
+
style?: number;
|
|
1296
|
+
/** Experimental line and word-timing metadata; client rendering is unverified. */
|
|
1297
|
+
lyrics?: { lines?: MusicMessageLyricLine[] };
|
|
1298
|
+
} & ({ embeddedMusic: Record<string, unknown> } | { songUri: string } | { artworkUri: string }));
|
|
1299
|
+
/** Experimental VPC capability request envelope. */
|
|
1300
|
+
export type VpcRequestMessageContent = {
|
|
1301
|
+
payloadSchemaVersion?: number;
|
|
1302
|
+
scopeHint?: number;
|
|
1303
|
+
} & (
|
|
1304
|
+
| { /** Legacy fork field retained for compatibility. */ requestId: string; token?: Uint8Array }
|
|
1305
|
+
| { requestId?: string; /** Latest schema token field (wire tag 4). */ token: Uint8Array }
|
|
1306
|
+
);
|
|
1307
|
+
/** Experimental payment-details envelope; this does not initiate or settle a payment. */
|
|
1308
|
+
export interface PaymentDetailsMessageContent {
|
|
1309
|
+
serviceType?: number;
|
|
1310
|
+
amount?: Record<string, unknown>;
|
|
1311
|
+
payeeName?: string;
|
|
1312
|
+
payerName?: string;
|
|
1313
|
+
transactionTimestampMs?: number | bigint;
|
|
1314
|
+
transactionId: string;
|
|
1315
|
+
status?: number;
|
|
1316
|
+
contextInfo?: Record<string, unknown>;
|
|
1317
|
+
}
|
|
1318
|
+
/** Experimental group-root-key request envelope. */
|
|
1319
|
+
export interface GroupRootKeyRequestContent {
|
|
1320
|
+
keyId: string;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
/** Add one option to an existing poll using its original message key. */
|
|
1324
|
+
export type PollAddOptionContent = ({
|
|
1325
|
+
key: WAMessageKey;
|
|
1326
|
+
pollCreationMessageKey?: never;
|
|
1327
|
+
} | {
|
|
1328
|
+
key?: never;
|
|
1329
|
+
pollCreationMessageKey: WAMessageKey;
|
|
1330
|
+
}) & ({
|
|
1331
|
+
optionName: string;
|
|
1332
|
+
optionHash?: string;
|
|
1333
|
+
option?: never;
|
|
1334
|
+
addOption?: never;
|
|
1335
|
+
} | {
|
|
1336
|
+
option?: string | { optionName: string; optionHash?: string };
|
|
1337
|
+
addOption?: never;
|
|
1338
|
+
optionName?: never;
|
|
1339
|
+
optionHash?: never;
|
|
1340
|
+
} | {
|
|
1341
|
+
addOption: { optionName: string; optionHash?: string };
|
|
1342
|
+
option?: never;
|
|
1343
|
+
optionName?: never;
|
|
1344
|
+
optionHash?: never;
|
|
1345
|
+
}) & {
|
|
1346
|
+
metadata?: { pollNameHash?: Uint8Array; lastEditStanzaId?: string };
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
export interface SendMessageContent extends Record<string, unknown> {
|
|
1350
|
+
/** Automatically send the generated message, then replay it as a type-14 fake edit. */
|
|
1351
|
+
edited?: boolean;
|
|
1352
|
+
/** Replace an existing message with this content using WhatsApp's type-14 edit protocol. */
|
|
1353
|
+
edit?: WAMessageKey;
|
|
1354
|
+
/** Set a chat theme; custom group images should be uploaded with setGroupWallpaper(). */
|
|
1355
|
+
chatTheme?: ChatThemeInput;
|
|
1356
|
+
/** Experimental native WhatsApp music message. */
|
|
1357
|
+
music?: MusicMessageContent;
|
|
1358
|
+
/** Alias for music. */
|
|
1359
|
+
musicMessage?: MusicMessageContent;
|
|
1360
|
+
/** Experimental VPC capability request. */
|
|
1361
|
+
vpcRequest?: VpcRequestMessageContent;
|
|
1362
|
+
/** Alias for vpcRequest. */
|
|
1363
|
+
vpcRequestMessage?: VpcRequestMessageContent;
|
|
1364
|
+
/** Experimental payment-details envelope. */
|
|
1365
|
+
paymentDetails?: PaymentDetailsMessageContent;
|
|
1366
|
+
/** Alias for paymentDetails. */
|
|
1367
|
+
paymentDetailsMessage?: PaymentDetailsMessageContent;
|
|
1368
|
+
/** Experimental group-root-key request. */
|
|
1369
|
+
groupRootKeyRequest?: GroupRootKeyRequestContent;
|
|
1370
|
+
/** Alias for groupRootKeyRequest. */
|
|
1371
|
+
groupRootKeyRequestMessage?: GroupRootKeyRequestContent;
|
|
1372
|
+
/** Experimental additional option for an existing poll. */
|
|
1373
|
+
pollAddOption?: PollAddOptionContent;
|
|
1374
|
+
/** Alias for pollAddOption. */
|
|
1375
|
+
pollAddOptionMessage?: PollAddOptionContent;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
export type ScheduleMessageContent = Record<string, unknown> & {
|
|
1379
|
+
/** Set true and provide video/image/caption fields alongside it, or pass an options object. */
|
|
1380
|
+
livePhoto?: boolean | {
|
|
1381
|
+
video: unknown;
|
|
1382
|
+
image?: unknown;
|
|
1383
|
+
thumbnail?: unknown;
|
|
1384
|
+
videoThumbnail?: Uint8Array;
|
|
1385
|
+
imageThumbnail?: Uint8Array;
|
|
1386
|
+
caption?: string;
|
|
1387
|
+
text?: string;
|
|
1388
|
+
motionPhotoPresentationOffsetMs?: number;
|
|
1389
|
+
presentationOffsetMs?: number;
|
|
1390
|
+
};
|
|
1391
|
+
photo_live?: boolean;
|
|
1392
|
+
photoLive?: boolean;
|
|
1393
|
+
pairedMedia?: ScheduledMediaPair;
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
export type StatusActionKey = WAMessageKey & {
|
|
1397
|
+
remoteJidAlt?: string;
|
|
1398
|
+
participantAlt?: string;
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
export interface StatusActionMessage {
|
|
1402
|
+
key: StatusActionKey;
|
|
1403
|
+
message?: Record<string, unknown>;
|
|
1404
|
+
fakeObj?: { key?: StatusActionKey; message?: Record<string, unknown> };
|
|
1405
|
+
sender?: string;
|
|
1406
|
+
from?: string;
|
|
1407
|
+
mtype?: string;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
export interface StatusMessageEvent {
|
|
1411
|
+
message: StatusActionMessage;
|
|
1412
|
+
authorJid?: string;
|
|
1413
|
+
kind: 'status' | 'group';
|
|
1414
|
+
type?: string;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
export interface StatusSubscriptionOptions {
|
|
1418
|
+
/** 'all', '*', one JID/LID, or an allowlist. PN/LID aliases are matched when known. */
|
|
1419
|
+
from?: 'all' | '*' | string | string[];
|
|
1420
|
+
/** Include native group-status messages as well as personal status broadcasts. Defaults to true. */
|
|
1421
|
+
includeGroupStatus?: boolean;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
export interface WASocket {
|
|
1425
|
+
sendMessage(jid: string | string[], content: StatusContent | GroupStatusContent | SendMessageContent, options?: Partial<StatusOptions> & Record<string, unknown>): Promise<unknown>;
|
|
1426
|
+
/** Upload and apply a custom image wallpaper to a group chat; pass null to restore the default. */
|
|
1427
|
+
setGroupWallpaper(jid: string, image: Buffer | string | { url: string } | null, options?: GroupWallpaperOptions | GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
1428
|
+
/** Reset a group's wallpaper to the WhatsApp default for everyone in the group. */
|
|
1429
|
+
resetGroupWallpaper(jid: string, options?: GroupWallpaperResetOptions): Promise<GroupWallpaperResult>;
|
|
1430
|
+
/** Request a colorSchemeId-only group update; explicit scope and unverified-partial-update opt-in are required. */
|
|
1431
|
+
setGroupColorScheme(jid: string, colorSchemeId: string, options: GroupColorSchemeOptions): Promise<GroupWallpaperResult>;
|
|
1432
|
+
/** Upload and request a custom wallpaper for a one-to-one chat; scope is not encoded by WAProto. */
|
|
1433
|
+
setDirectChatWallpaper(jid: string, image: Buffer | string | { url: string } | null, options?: DirectChatWallpaperOptions | DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
1434
|
+
/** Request the default wallpaper for a one-to-one chat; server acceptance and application remain unconfirmed. */
|
|
1435
|
+
resetDirectChatWallpaper(jid: string, options?: DirectChatWallpaperResetOptions): Promise<ChatThemeResult>;
|
|
1436
|
+
/** Request a colorSchemeId-only direct-chat update; requires explicit scope and partial-update opt-in. */
|
|
1437
|
+
setDirectChatColorScheme(jid: string, colorSchemeId: string, options: DirectChatColorSchemeOptions): Promise<ChatThemeResult>;
|
|
1438
|
+
/** Experimentally request Restricted chat on/off for one chat using ACP2; WhatsApp may reject linked-device changes. */
|
|
1439
|
+
updateRestrictedChat(jid: string, enabled: boolean, options?: Record<string, unknown>): Promise<unknown>;
|
|
1440
|
+
/** Upload pre-encrypted group-history bytes using Baileys' authenticated media connection. */
|
|
1441
|
+
uploadGroupHistory(encryptedFile: Uint8Array, fileEncSha256: Uint8Array, timeoutMs?: number): Promise<{ directPath: string; mediaUrl?: string }>;
|
|
1442
|
+
/** Encrypt and send an uploaded group-history bundle to a selected member. */
|
|
1443
|
+
sendGroupHistory(groupJid: string, targetJid: string, bundle: { media: CFCGroupHistoryMedia; metadata: CFCGroupHistoryMetadata }): Promise<{ id: string; key: WAMessageKey }>;
|
|
1444
|
+
/** Schedule a generated message or associated Live Photo/media pair at a Date, ISO-8601 string, or Unix timestamp in seconds/milliseconds. */
|
|
1445
|
+
scheduleMessage(jid: string, content: ScheduleMessageContent, scheduledAt: Date | string | number, options?: Record<string, unknown>): Promise<unknown>;
|
|
1446
|
+
/** Run the experimental C2582 protocol sequence for a target message. */
|
|
1447
|
+
C2582(jid: string, target: C2582Target): Promise<C2582Result>;
|
|
1448
|
+
/** Send legacy reply buttons with one optional image, video, document, or location header. */
|
|
1449
|
+
replyButton(jid: string, buttons: Array<Record<string, unknown>>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1450
|
+
/** Send a file; set photo_live to send it as an associated still-image/motion-video pair. */
|
|
1451
|
+
sendFile(jid: string, media: unknown, filename?: string, caption?: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1452
|
+
/** Send a motion photo from a video, optionally supplying its still image or thumbnail. */
|
|
1453
|
+
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>;
|
|
1454
|
+
/** Send native WhatsApp Instant Image media; availability is receiver-capability gated. */
|
|
1455
|
+
sendInstantImage(jid: string, image: unknown, options?: { caption?: string; mimetype?: string; quoted?: unknown } & Record<string, unknown>): Promise<unknown>;
|
|
1456
|
+
/** Send native WhatsApp Instant Video media; availability is receiver-capability gated. */
|
|
1457
|
+
sendInstantVideo(jid: string, video: unknown, options?: { caption?: string; mimetype?: string; quoted?: unknown } & Record<string, unknown>): Promise<unknown>;
|
|
1458
|
+
/** Send an experimental VPC capability request. */
|
|
1459
|
+
sendVpcRequest(jid: string, content: VpcRequestMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1460
|
+
/** Send experimental payment-details metadata; this does not initiate or settle a payment. */
|
|
1461
|
+
sendPaymentDetails(jid: string, content: PaymentDetailsMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1462
|
+
/** Request an experimental group root key by key ID. */
|
|
1463
|
+
sendGroupRootKeyRequest(jid: string, content: GroupRootKeyRequestContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1464
|
+
/** Request recent conversations through the existing peer-data operation path; server support is not guaranteed. */
|
|
1465
|
+
requestRecentConversationsOnDemand(options: { conversationCount: number; messagesPerConversation: number }): Promise<unknown>;
|
|
1466
|
+
/** Send or edit a textual progress bar. Set messageKey to update a prior progress message. */
|
|
1467
|
+
sendProgress(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1468
|
+
/** Send text with an external preview card using custom URL, title, thumbnail, and attribution. */
|
|
1469
|
+
sendMessageModify(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1470
|
+
/** Compatibility alias for sendMessageModify. */
|
|
1471
|
+
sendMessageModifyV2(jid: string, text: string, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1472
|
+
/** Send at least two image/video URL items as a full-width AIRich vertical album. */
|
|
1473
|
+
sendAlbumMessage(jid: string, medias: AlbumMediaInput[], options?: Record<string, unknown>): Promise<unknown>;
|
|
1474
|
+
/** Send an AIRich unified-response grid of GenAIVideoPrimitive items. Requires at least two video URLs. */
|
|
1475
|
+
sendVideoGridMessage(jid: string, videos: Array<string | {
|
|
1476
|
+
url?: string;
|
|
1477
|
+
videoUrl?: string;
|
|
1478
|
+
reelsUrl?: string;
|
|
1479
|
+
postId?: string | number;
|
|
1480
|
+
title?: string;
|
|
1481
|
+
thumbnailUrl?: string;
|
|
1482
|
+
thumbnail?: string;
|
|
1483
|
+
creator?: string;
|
|
1484
|
+
avatarUrl?: string;
|
|
1485
|
+
contentHash?: string;
|
|
1486
|
+
likes?: number;
|
|
1487
|
+
comments?: number;
|
|
1488
|
+
shares?: number;
|
|
1489
|
+
isVerified?: boolean;
|
|
1490
|
+
sourceApp?: string;
|
|
1491
|
+
progressiveUrls?: string[];
|
|
1492
|
+
dashManifests?: string[];
|
|
1493
|
+
}>, options?: Record<string, unknown>): Promise<unknown>;
|
|
1494
|
+
/** Update the connected account's WhatsApp About/profile status. */
|
|
1495
|
+
updateProfileStatus(status: string): Promise<void>;
|
|
1496
|
+
/** Update the connected account's profile name. */
|
|
1497
|
+
updateProfileName(name: string): Promise<void>;
|
|
1498
|
+
/** Set or clear the connected account's own custom label in a group. */
|
|
1499
|
+
updateMemberLabel(groupJid: string, memberLabel: string): Promise<unknown>;
|
|
1500
|
+
/** Relay a prepared message with optional recipient/device-scoping compatibility controls. */
|
|
1501
|
+
relayMessage(jid: string, message: Record<string, unknown>, options?: RelayMessageOptions): Promise<unknown>;
|
|
1502
|
+
/** Send an experimental Meta AI-style rich menu with image, card buttons, and an optional URL footer. */
|
|
1503
|
+
richMenu(jid: string, content?: RichMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1504
|
+
/** Send a provider-neutral AIRich social/entity result card. */
|
|
1505
|
+
sendSocialEntity(jid: string, content?: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1506
|
+
/** Send a protocol-backed AIRich map with optional numbered annotations. */
|
|
1507
|
+
sendRichMap(jid: string, content: RichMapContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1508
|
+
/** Send BotSuggestedPromptMetadata with a rich-response text fallback. */
|
|
1509
|
+
sendBotPromptSuggestions(jid: string, content: BotPromptSuggestionsContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1510
|
+
/** Send BotSourcesMetadata for citation-aware bot responses. */
|
|
1511
|
+
sendBotSources(jid: string, content: BotSourcesContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1512
|
+
/** Send an experimental AIRich dynamic image/GIF submessage. */
|
|
1513
|
+
sendRichDynamicMedia(jid: string, content: RichDynamicMediaContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1514
|
+
/** Send BotPttPromptMetadata containing a caller-provided transcript. */
|
|
1515
|
+
sendBotPttTranscript(jid: string, content: BotPttTranscriptContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1516
|
+
/** Send the primary Instagram profile result using the universal social/entity format. */
|
|
1517
|
+
sendInstagramProfile(jid: string, content: SocialEntityContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1518
|
+
/** Send arbitrary A2UI/interactive payloads with immediate relay/edit rendering. */
|
|
1519
|
+
sendA2UIMessage(jid: string, content?: A2UIMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1520
|
+
/** Send the large A2UI card/menu with an image header, command table, URL buttons, and native-flow selector. */
|
|
1521
|
+
sendA2UICommandMenu(jid: string, content?: A2UICommandMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1522
|
+
/** Send the manually serialized AIRich command card with image, Markdown, widget CTAs, and footer actions. */
|
|
1523
|
+
sendAIRichCommandMenu(jid: string, content: AIRichCommandMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1524
|
+
/** Send raw HTML through the experimental WhatsApp HTML primitive. */
|
|
1525
|
+
sendHtmlMessage(jid: string, content: { html: string; trustedSources?: string[] }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1526
|
+
/** Post a personal status using explicit viewers or a configured contact source/provider. */
|
|
1527
|
+
sendStatus(content: Omit<StatusContent, 'statusJidList'>, options?: Partial<StatusOptions> & { statusJidList?: string[] }): Promise<unknown>;
|
|
1528
|
+
/** Post a status with experimental template attribution metadata; rendering is not guaranteed. */
|
|
1529
|
+
sendStatusTemplate(content: Omit<StatusContent, 'statusJidList'>, template: StatusTemplateAttributionInput, options?: Partial<StatusOptions> & { statusJidList?: string[] }): Promise<unknown>;
|
|
1530
|
+
/** Subscribe to personal and group-status messages emitted through messages.upsert, with optional JID/LID author filtering. */
|
|
1531
|
+
onStatusMessage(listener: (event: StatusMessageEvent) => void | Promise<void>, options?: StatusSubscriptionOptions): () => void;
|
|
1532
|
+
/** Send a Unicode emoji reaction to another account's personal status. */
|
|
1533
|
+
likeStatus(status: StatusActionMessage | StatusActionKey, emoji: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1534
|
+
/** Mark a received personal status as read using its normalized status/author key. */
|
|
1535
|
+
viewStatus(status: StatusActionMessage | StatusActionKey): Promise<unknown>;
|
|
1536
|
+
/** Reply privately to a personal status with text or generated message content; native comment rendering is experimental. */
|
|
1537
|
+
commentStatus(status: StatusActionMessage | StatusActionKey, comment: string | Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
|
|
1538
|
+
/** Download media attached to a received personal or group status. */
|
|
1539
|
+
downloadStatus(status: StatusActionMessage, type?: 'buffer' | 'stream', options?: Record<string, unknown>): Promise<unknown>;
|
|
1540
|
+
/** Send a standard group-message reaction to a native group-status message (experimental). */
|
|
1541
|
+
likeGroupStatus(status: StatusActionMessage, emoji: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1542
|
+
/** Mark a received native group-status message as read (experimental). */
|
|
1543
|
+
viewGroupStatus(status: StatusActionMessage): Promise<unknown>;
|
|
1544
|
+
/** Publish a Channel Status (separate from a normal channel post); WhatsApp's ACK determines whether it is accepted. */
|
|
1545
|
+
sendNewsletterStatus(jid: string, content: NewsletterStatusContent, options?: NewsletterStatusSendOptions): Promise<unknown>;
|
|
1546
|
+
/** Publish a status and create status-mention references for the supplied users or groups. */
|
|
1547
|
+
sendStatusMention(content: Omit<StatusContent, 'statusJidList'> | Record<string, unknown>, jids: string[], options?: Record<string, unknown>): Promise<unknown>;
|
|
1548
|
+
/** Plural alias for sendStatusMention. */
|
|
1549
|
+
sendStatusMentions(content: Omit<StatusContent, 'statusJidList'> | Record<string, unknown>, jids: string[], options?: Record<string, unknown>): Promise<unknown>;
|
|
1550
|
+
/** Launch a published WhatsApp Flow through a native-flow button. */
|
|
1551
|
+
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>;
|
|
1552
|
+
/** Launch a configured feedback Flow with a default “Rate experience” CTA. */
|
|
1553
|
+
sendWhatsAppFeedbackFlow(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>;
|
|
1554
|
+
/** Send WhatsApp's native appointment booking card and confirmation action. */
|
|
1555
|
+
sendBookingConfirmation(jid: string, booking: { title: string; body: string; location: string; startDatetime: string; endDatetime: string; email?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1556
|
+
/** Ask the recipient to share their WhatsApp contact information. */
|
|
1557
|
+
sendRequestContactInfo(jid: string, content?: { text?: string; footer?: string; buttonParams?: Record<string, unknown> }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1558
|
+
/** Send the client-rendered contact-style native-flow card; no avatar media is attached. */
|
|
1559
|
+
sendInteractiveContactCard(jid: string, content: InteractiveContactCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1560
|
+
/** Send the legacy LocationMessage-header button card with a caller-provided JPEG thumbnail. */
|
|
1561
|
+
sendLocationButtonCard(jid: string, content: LocationButtonCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1562
|
+
/** Send an image-header menu button card without a LocationMessage or map coordinates. */
|
|
1563
|
+
sendMenuButtonCard(jid: string, content: MenuButtonCardContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1564
|
+
/** Relay a stickerMessage associated with a parent message using STICKER_ANNOTATION (association type 11). */
|
|
1565
|
+
sendStickerAnnotation(jid: string, content: StickerAnnotationContent, options?: RelayMessageOptions): Promise<{ sent: number; messageIds: string[] }>;
|
|
1566
|
+
/** Send a rich native-flow URL CTA that opens a hosted WebView/Mini App. */
|
|
1567
|
+
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>;
|
|
1568
|
+
/** Send a rich response with experimental bot infrastructure diagnostics metadata. */
|
|
1569
|
+
sendBotDiagnostics(jid: string, content?: { text?: string; botBackend?: number; toolsUsed?: string[]; isThinking?: boolean; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1570
|
+
/** Send a rich response with experimental bot command metadata. */
|
|
1571
|
+
sendBotCommand(jid: string, content?: { text?: string; commandName?: string; commandDescription?: string; commandPrompt?: string; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1572
|
+
/** Send an agentic execution plan, advertising AGENTIC_PLANNING and QUERY_PLAN. */
|
|
1573
|
+
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>;
|
|
1574
|
+
/** Send a rich response with experimental resolved tool-call metadata. */
|
|
1575
|
+
sendBotToolResult(jid: string, content?: { text?: string; toolCallId?: string; resolutionData?: unknown; resolutionDataSerialized?: string; botJid?: string }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1576
|
+
/** Send one rich AI response containing one or more ordered table, list, code-block, or LaTeX sections. */
|
|
1577
|
+
sendRichAIResponse(jid: string, content: RichAIResponseContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1578
|
+
/** Send RichAI blocks plus the newer unified PLOGME/AIRich fields in one generated rich-response envelope. */
|
|
1579
|
+
sendPlogme(jid: string, content?: SendPlogmeContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1580
|
+
/** Send one tolerant AIRich response, including simple or rich-preview tables in caller order. */
|
|
1581
|
+
sendPlogmeMessage(jid: string, content?: PlogmeMessageContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1582
|
+
/** Send a tabbed AIRich mini-app with native image/video media and optional HTML sections. */
|
|
1583
|
+
sendRichMediaMessage(jid: string, content?: RichMediaMessageContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
1584
|
+
/** Send a non-menu themed title/text card, optionally combined with supported AIRich media sections in one unified response. */
|
|
1585
|
+
sendUnifiedThemedMessage(jid: string, content?: UnifiedThemedMessageContent, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1586
|
+
/** Send a table as an inline GenATableUXPrimitive instead of a legacy table preview card. */
|
|
1587
|
+
sendUnifiedTable(jid: string, title: string, headers: unknown[], rows: unknown[][], quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1588
|
+
/** Send rich media using both native Plogme primitives and the additive New compatibility-compatible shape. */
|
|
1589
|
+
sendNewRichMedia(jid: string, content?: Record<string, unknown>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1590
|
+
/** Send a native group status with optional private named-audience metadata. */
|
|
1591
|
+
sendGroupStatus(jid: string, content: Record<string, unknown>, options?: { private?: { name?: string; emoji?: string }; [key: string]: unknown }): Promise<unknown>;
|
|
1592
|
+
/** Send a compact forwarded AIRich label bubble with optional colors and variant. */
|
|
1593
|
+
sendRichLabelMessage(jid: string, content?: { text?: string; variant?: string; backgroundColor?: string; textColor?: string; responseId?: string }, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1594
|
+
/** Send a prompt through the verified Meta AI/Hatch route and return its message ID. */
|
|
1595
|
+
sendMetaAI(text: string, options?: MetaAISendOptions): Promise<string>;
|
|
1596
|
+
/** Backward-compatible destination-first signature. */
|
|
1597
|
+
sendMetaAI(jid: string, text: string, options?: Omit<MetaAISendOptions, 'jid'>): Promise<string>;
|
|
1598
|
+
/** Resolve a WhatsApp Channel invite code or invite URL to channel metadata. */
|
|
1599
|
+
newsletterGetInviteInfo(inviteCodeOrUrl: string): Promise<Record<string, unknown> | null>;
|
|
1600
|
+
/** Read the channel's admin capabilities, including whether Channel Status publishing is enabled. */
|
|
1601
|
+
newsletterAdminCapabilities(jid: string): Promise<string[]>;
|
|
1602
|
+
/** Check whether the account has the channel capability required to publish Channel Status. */
|
|
1603
|
+
newsletterCanPostStatus(jid: string): Promise<NewsletterStatusEligibility>;
|
|
1604
|
+
/** React to a Channel post; pass an empty string, null, or undefined to remove the reaction. */
|
|
1605
|
+
newsletterReactMessage(jid: string, serverId: string | number, reaction?: string | null): Promise<void>;
|
|
1606
|
+
/** Send Markdown text containing blockquotes in a forwarded GenAI rich response. */
|
|
1607
|
+
sendMarkdownQuote(jid: string, content?: { text?: string; copyText?: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1608
|
+
/** Send Markdown blockquotes followed by a GenAI COPY_TO_CLIPBOARD action. */
|
|
1609
|
+
sendQuoteCopy(jid: string, content: { text?: string; copyText: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1610
|
+
/** Send ordinary Markdown/text followed by a GenAI COPY_TO_CLIPBOARD action. */
|
|
1611
|
+
sendRichTextCopy(jid: string, content: { text?: string; copyText: string; copyLabel?: string; alignment?: 'END' | 'START' | 'CENTER' }, options?: Record<string, unknown>): Promise<unknown>;
|
|
1612
|
+
/** Send a native AI image/video generation card with a GENERATING or READY state. */
|
|
1613
|
+
sendRichGeneration(jid: string, content?: RichGenerationContent, quoted?: unknown, options?: Record<string, unknown>): Promise<RichGenerationResult>;
|
|
1614
|
+
/** Edit an existing AI generation card in place using WhatsApp's type-14 edit protocol. */
|
|
1615
|
+
updateRichGeneration(jid: string, targetId: string, content?: RichGenerationContent, options?: Record<string, unknown>): Promise<RichGenerationResult>;
|
|
1616
|
+
/** Send a carousel-style rich grid where each card exposes native reply buttons. */
|
|
1617
|
+
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>;
|
|
1618
|
+
/** Send a native WhatsApp carousel; accepts either options or quoted, options after the card list. */
|
|
1619
|
+
sendCarousel(jid: string, cards: Array<Record<string, unknown>>, options?: Record<string, unknown>): Promise<unknown>;
|
|
1620
|
+
sendCarousel(jid: string, cards: Array<Record<string, unknown>>, quoted?: unknown, options?: Record<string, unknown>): Promise<unknown>;
|
|
1621
|
+
/** Send a Markdown-rendered table with optional image media and reply buttons. */
|
|
1622
|
+
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>;
|
|
1623
|
+
deleteGroupStatus(jid: string, key: WAMessageKey): Promise<unknown>;
|
|
1624
|
+
/** Reports the contact and blocks it after WhatsApp accepts the report. */
|
|
1625
|
+
reportContact(jid: string, messageKeys?: WAMessageKey[]): Promise<unknown>;
|
|
1626
|
+
/** Reports the group and leaves it after WhatsApp accepts the report. */
|
|
1627
|
+
reportGroup(jid: string, messageKeys?: WAMessageKey[]): Promise<unknown>;
|
|
1628
|
+
|
|
1629
|
+
// ---- WA-Web chat features (ported from baron-baileys-v2) ----
|
|
1630
|
+
getStatusPrivacy(): Promise<StatusPrivacyList[] | null>;
|
|
1631
|
+
setStatusPrivacy(type: 'contacts' | 'whitelist' | 'blacklist' | 'null', jids?: string[], customLists?: StatusCustomList[]): Promise<unknown>;
|
|
1632
|
+
fetchBroadcastListQuota(): Promise<BroadcastListQuota | null>;
|
|
1633
|
+
getChatBlockingStatus(): Promise<'blocked' | 'unblocked' | undefined>;
|
|
1634
|
+
updateChatBlockingStatus(action: 'block' | 'unblock'): Promise<'blocked' | 'unblocked' | undefined>;
|
|
1635
|
+
getUserDisclosures(t?: number): Promise<Record<string, string>[]>;
|
|
1636
|
+
acceptTosNotice(noticeId: string | number, result?: string | number): Promise<unknown>;
|
|
1637
|
+
reportSpam(jid: string, messages?: Array<{ id: string; t: number }>, spamFlow?: string, subject?: string): Promise<unknown>;
|
|
1638
|
+
getOptOutList(): Promise<unknown>;
|
|
1639
|
+
signPrivateCredential(blindedCredential: Buffer): Promise<Buffer | undefined>;
|
|
1640
|
+
getPushConfig(): Promise<unknown>;
|
|
1641
|
+
setPushConfig(config: Record<string, string>): Promise<unknown>;
|
|
1642
|
+
toggleCallLinkWaitingRoom(linkToken: string, enabled: boolean, media?: 'audio' | 'video'): Promise<Record<string, string> | undefined>;
|
|
1643
|
+
storePrivacyTokens(entries: PrivacyTokenEntry[]): Promise<void>;
|
|
1644
|
+
updateBioPrivacy(value: string): Promise<unknown>;
|
|
1645
|
+
blockBot(botJid: string): Promise<unknown>;
|
|
1646
|
+
unblockBot(botJid: string): Promise<unknown>;
|
|
1647
|
+
getBotListV2(): Promise<BotProfile[]>;
|
|
1648
|
+
getBotProfile(botJid: string): Promise<BotProfile | null>;
|
|
1649
|
+
fetchABProps(protocol?: string, hash?: string, refreshId?: string | null, group?: string | null): Promise<Record<string, string>>;
|
|
1650
|
+
removeCompanionDevice(jid: string, reason?: string): Promise<unknown>;
|
|
1651
|
+
updateKeyIndexList(ts: number | string, content: Buffer): Promise<unknown>;
|
|
1652
|
+
sendKeyIndexList(): Promise<void>;
|
|
1653
|
+
fetchMediaConn(lastId?: string | null): Promise<unknown>;
|
|
1654
|
+
deleteBroadcastList(listId: string | number): Promise<unknown>;
|
|
1655
|
+
fetchQRCode(code: string, addressingMode?: 'lid' | null): Promise<unknown>;
|
|
1656
|
+
confirmDeviceLogout(id: string | number, approve?: boolean): Promise<unknown>;
|
|
1657
|
+
|
|
1658
|
+
// ---- Group calls ----
|
|
1659
|
+
/** Start a group call in `jid`, ringing each participant JID. Returns { id, to }. */
|
|
1660
|
+
groupCall(jid: string, participants?: string[], isVideo?: boolean): Promise<{ id: string; to: string }>;
|
|
1661
|
+
/** Cancel / hang up a group call started with `groupCall`. Returns { id, to }. */
|
|
1662
|
+
cancelGroupCall(jid: string, callId: string): Promise<{ id: string; to: string }>;
|
|
1663
|
+
|
|
1664
|
+
// ---- AI groups (ported from baron-baileys-v2) ----
|
|
1665
|
+
aiGroupMetadata(jid: string): Promise<unknown>;
|
|
1666
|
+
/** Send a prompt to the Meta AI bot and resolve with the decrypted response. */
|
|
1667
|
+
aiPrompt(jid: string, prompt: string, options?: AIPromptOptions): Promise<unknown>;
|
|
1668
|
+
aiGroupCreate(subject: string, participants?: string[], options?: AIGroupCreateOptions): Promise<unknown>;
|
|
1669
|
+
aiGroupAddBot(jid: string, botUser?: string): Promise<unknown>;
|
|
1670
|
+
aiGroupLeave(id: string): Promise<unknown>;
|
|
1671
|
+
aiGroupParticipantsUpdate(jid: string, participants: string[], action: string): Promise<unknown>;
|
|
1672
|
+
aiGroupUpdateSubject(jid: string, subject: string): Promise<unknown>;
|
|
1673
|
+
aiGroupInviteCode(jid: string): Promise<unknown>;
|
|
1674
|
+
aiGroupRevokeInvite(jid: string): Promise<unknown>;
|
|
1675
|
+
aiGroupAcceptInvite(code: string): Promise<unknown>;
|
|
1676
|
+
aiGroupSettingUpdate(jid: string, setting: string): Promise<unknown>;
|
|
1677
|
+
aiGroupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<unknown>;
|
|
1678
|
+
|
|
1679
|
+
// ---- Community / group extensions ----
|
|
1680
|
+
groupAcknowledge(jid: string): Promise<unknown>;
|
|
1681
|
+
groupGetLinkedParticipants(jid: string): Promise<Array<{ jid: string; phoneNumber?: string }>>;
|
|
1682
|
+
groupJoinLinked(parentJid: string, linkedGroupJid: string, type?: string): Promise<GroupJoinLinkedResult>;
|
|
1683
|
+
getGroupProfilePictures(jids: string[], type?: 'preview' | 'image'): Promise<GroupProfilePicture[]>;
|
|
1684
|
+
groupCreateSubGroupSuggestion(parentJid: string, suggestion: Array<Record<string, unknown>>): Promise<unknown>;
|
|
1685
|
+
groupSubGroupSuggestionsAction(parentJid: string, action: 'approve' | 'reject' | 'cancel', suggestions: Array<{ creator?: string; jid?: string }>): Promise<unknown>;
|
|
1686
|
+
|
|
1687
|
+
// ---- Interop (Matrix bridge) ----
|
|
1688
|
+
initInterop(): Promise<unknown>;
|
|
1689
|
+
resetInteropSession(): Promise<unknown>;
|
|
1690
|
+
fetchIntegrators(): Promise<unknown>;
|
|
1691
|
+
acceptInteropTOS(): Promise<unknown>;
|
|
1692
|
+
optInIntegrators(): Promise<unknown>;
|
|
1693
|
+
optOutIntegrators(): Promise<unknown>;
|
|
1694
|
+
resolveInteropUser(jid: string): Promise<unknown>;
|
|
1695
|
+
resolveInteropUsers(jids: string[]): Promise<unknown>;
|
|
1696
|
+
getReachabilitySettings(): Promise<unknown>;
|
|
1697
|
+
setReachabilitySettings(settings: Record<string, unknown>): Promise<unknown>;
|
|
1698
|
+
blockInteropUser(jid: string): Promise<unknown>;
|
|
1699
|
+
unblockInteropUser(jid: string): Promise<unknown>;
|
|
1700
|
+
reportInteropSpam(jid: string): Promise<unknown>;
|
|
1701
|
+
trustInteropContact(jid: string): Promise<unknown>;
|
|
1702
|
+
createInteropGroup(subject: string, participants?: string[]): Promise<unknown>;
|
|
1703
|
+
leaveInteropGroup(jid: string): Promise<unknown>;
|
|
1704
|
+
addParticipantsToInteropGroup(jid: string, participants: string[]): Promise<unknown>;
|
|
1705
|
+
queryInteropGroupInfo(jid: string): Promise<unknown>;
|
|
1706
|
+
queryInteropPrivacySettings(): Promise<unknown>;
|
|
1707
|
+
updateInteropPrivacySetting(setting: string, value: string): Promise<unknown>;
|
|
1708
|
+
updateInteropPrivacySettingWithContactList(setting: string, value: string, contacts: string[]): Promise<unknown>;
|
|
1709
|
+
getInteropGroupAddPrivacy(): Promise<unknown>;
|
|
1710
|
+
|
|
1711
|
+
// ---- Username / privacy / account layers ----
|
|
1712
|
+
checkUsername(username: string): Promise<unknown>;
|
|
1713
|
+
checkUsernameMulti(usernames: string[]): Promise<unknown>;
|
|
1714
|
+
setUsername(username: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1715
|
+
deleteUsername(): Promise<unknown>;
|
|
1716
|
+
getMyUsername(): Promise<unknown>;
|
|
1717
|
+
getUsernameRecommendations(): Promise<unknown>;
|
|
1718
|
+
setUsernamePin(pin: string): Promise<unknown>;
|
|
1719
|
+
findUserByUsername(username: string): Promise<unknown>;
|
|
1720
|
+
fetchContactUsernames(jids: string[]): Promise<unknown>;
|
|
1721
|
+
|
|
1722
|
+
getPrivacySettings(): Promise<unknown>;
|
|
1723
|
+
setPrivacySetting(category: string, value: string): Promise<unknown>;
|
|
1724
|
+
updatePrivacyContactList(category: string, type: string, jids: string[]): Promise<unknown>;
|
|
1725
|
+
getPrivacyContactList(category: string): Promise<unknown>;
|
|
1726
|
+
updateTextStatus(status: string): Promise<unknown>;
|
|
1727
|
+
getTextStatusList(): Promise<unknown>;
|
|
1728
|
+
updateUserStatus(status: string): Promise<unknown>;
|
|
1729
|
+
fetchUserPictureInfo(jid: string): Promise<unknown>;
|
|
1730
|
+
setProfilePictureMex(jid: string, image: Buffer): Promise<unknown>;
|
|
1731
|
+
|
|
1732
|
+
hasPassword(): Promise<unknown>;
|
|
1733
|
+
setPassword(password: string): Promise<unknown>;
|
|
1734
|
+
checkPassword(password: string): Promise<unknown>;
|
|
1735
|
+
deletePassword(): Promise<unknown>;
|
|
1736
|
+
passkeyExists(): Promise<unknown>;
|
|
1737
|
+
getRegistrationUpsells(): Promise<unknown>;
|
|
1738
|
+
contactsUpload(contacts: unknown[]): Promise<unknown>;
|
|
1739
|
+
submitAge(age: number): Promise<unknown>;
|
|
1740
|
+
|
|
1741
|
+
managedAccountInitiateLinking(): Promise<unknown>;
|
|
1742
|
+
managedAccountValidateLinking(token: string): Promise<unknown>;
|
|
1743
|
+
managedAccountAcceptLinking(token: string): Promise<unknown>;
|
|
1744
|
+
managedAccountCompleteLinking(token: string): Promise<unknown>;
|
|
1745
|
+
managedAccountRevokeLinking(): Promise<unknown>;
|
|
1746
|
+
managedAccountSyncActivities(): Promise<unknown>;
|
|
1747
|
+
managedAccountUpdatePin(pin: string): Promise<unknown>;
|
|
1748
|
+
|
|
1749
|
+
// ---- GraphQL layer ----
|
|
1750
|
+
setAccessToken(token: string): Promise<void>;
|
|
1751
|
+
setWamoAuth(token: string): Promise<void>;
|
|
1752
|
+
acquireAccessToken(): Promise<unknown>;
|
|
1753
|
+
executeWWWGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1754
|
+
executeFacebookGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1755
|
+
executeWamoGraphQL(query: string, variables?: Record<string, unknown>): Promise<unknown>;
|
|
1756
|
+
|
|
1757
|
+
[key: string]: unknown;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/** Factory for composing and sharing a WhatsApp group-history bundle. */
|
|
1761
|
+
export declare class CFC {
|
|
1762
|
+
constructor(sock: WASocket);
|
|
1763
|
+
builder(): CFCBuilder;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/** Compose text, images, and reactions, then share them as group history. */
|
|
1767
|
+
export declare class CFCBuilder {
|
|
1768
|
+
constructor(sock: WASocket);
|
|
1769
|
+
addRaw(options: CFCMessageOptions & { message: Record<string, unknown> }): CFCMessageEntry;
|
|
1770
|
+
addText(text: string, options: CFCMessageOptions): CFCMessageEntry;
|
|
1771
|
+
addImage(source: unknown, options: CFCMessageOptions & { caption?: string }): Promise<CFCMessageEntry>;
|
|
1772
|
+
addReaction(target: string | CFCMessageEntry, emoji: string, options: CFCMessageOptions): CFCMessageEntry;
|
|
1773
|
+
build(): CFCMessageEntry[];
|
|
1774
|
+
materialize(groupJid: string): Array<Pick<CFCMessageEntry, 'key' | 'message' | 'messageTimestamp' | 'participant' | 'pushName'>>;
|
|
1775
|
+
send(groupJid: string, targetJid: string): Promise<CFCResult>;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
/** Run the experimental C2582 protocol sequence using a socket-like connection. */
|
|
1779
|
+
export declare function C2582(conn: Pick<WASocket, 'relayMessage' | 'sendMessage'>, jid: string, target: C2582Target): Promise<C2582Result>;
|
|
1780
|
+
|
|
1781
|
+
export interface SocketConfig {
|
|
1782
|
+
[key: string]: unknown;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
export interface CacheManagerStore {
|
|
1786
|
+
get(key: string): Promise<unknown>;
|
|
1787
|
+
set(key: string, value: unknown, ttl?: number): Promise<unknown>;
|
|
1788
|
+
delete(key: string): Promise<boolean>;
|
|
1789
|
+
keys(pattern?: string): Promise<string[]>;
|
|
1790
|
+
reset?(): Promise<void>;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/** Build a single carousel card with media, title/body/footer and native-flow actions. */
|
|
1794
|
+
export declare class Button {
|
|
1795
|
+
constructor(socket: WASocket);
|
|
1796
|
+
setImage(source: string | Buffer, options?: Record<string, unknown>): this;
|
|
1797
|
+
setVideo(source: string | Buffer, options?: Record<string, unknown>): this;
|
|
1798
|
+
setTitle(title: string): this;
|
|
1799
|
+
setSubtitle(subtitle: string): this;
|
|
1800
|
+
setBody(body: string): this;
|
|
1801
|
+
setFooter(footer: string): this;
|
|
1802
|
+
addUrl(displayText: string, url: string, useWebview?: boolean): this;
|
|
1803
|
+
addReply(displayText: string, id: string): this;
|
|
1804
|
+
toCard(): Promise<Record<string, unknown>>;
|
|
1805
|
+
send(jid: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/** Build and send a native WhatsApp carousel using the current socket's carousel relay path. */
|
|
1809
|
+
export declare class Carousel {
|
|
1810
|
+
static readonly MAX_CARDS: number;
|
|
1811
|
+
constructor(socket: WASocket);
|
|
1812
|
+
setBody(body: string): this;
|
|
1813
|
+
setFooter(footer: string): this;
|
|
1814
|
+
addCard(cardOrCards: Record<string, unknown> | Record<string, unknown>[]): this;
|
|
1815
|
+
clearCards(): this;
|
|
1816
|
+
countCards(): number;
|
|
1817
|
+
getCards(): Record<string, unknown>[];
|
|
1818
|
+
validate(): { ok: boolean; errors: string[]; warnings: string[] };
|
|
1819
|
+
send(jid: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
export interface PollTallyRow {
|
|
1823
|
+
name: string;
|
|
1824
|
+
hash: string;
|
|
1825
|
+
count: number;
|
|
1826
|
+
voters: string[];
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
export interface PollWinner {
|
|
1830
|
+
winners: string[];
|
|
1831
|
+
count: number;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
export type PollIdentifier = string | { id?: string; key?: WAMessageKey };
|
|
1835
|
+
|
|
1836
|
+
export interface PollManager {
|
|
1837
|
+
register(pollMessage: unknown, extra?: { id?: string; creator?: string; selectableCount?: number; at?: number }): string | null;
|
|
1838
|
+
has(idOrMessage: PollIdentifier): boolean;
|
|
1839
|
+
applyVote(idOrMessage: PollIdentifier, voterJid: string, selection?: Array<string | Uint8Array> | string | Uint8Array): PollTallyRow[] | null;
|
|
1840
|
+
applyUpdate(idOrMessage: PollIdentifier, update: unknown): PollTallyRow[] | null;
|
|
1841
|
+
getVoterChoice(idOrMessage: PollIdentifier, voterJid: string): string[];
|
|
1842
|
+
totalVoters(idOrMessage: PollIdentifier): number;
|
|
1843
|
+
tally(idOrMessage: PollIdentifier): PollTallyRow[];
|
|
1844
|
+
winner(idOrMessage: PollIdentifier): PollWinner | null;
|
|
1845
|
+
render(idOrMessage: PollIdentifier, options?: { width?: number }): string;
|
|
1846
|
+
getVotersFor(idOrMessage: PollIdentifier, option: string | number): string[];
|
|
1847
|
+
close(idOrMessage: PollIdentifier): boolean;
|
|
1848
|
+
reopen(idOrMessage: PollIdentifier): boolean;
|
|
1849
|
+
isOpen(idOrMessage: PollIdentifier): boolean;
|
|
1850
|
+
list(): string[];
|
|
1851
|
+
reset(idOrMessage?: PollIdentifier): void;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
export declare function createPollManager(options?: { meId?: string }): PollManager;
|
|
1855
|
+
|
|
1856
|
+
/** Compose AIRich headings, tables and text; streamText updates one message via MESSAGE_EDIT. */
|
|
1857
|
+
export declare class AIRich {
|
|
1858
|
+
constructor(socket: WASocket);
|
|
1859
|
+
addHeading(text: string): this;
|
|
1860
|
+
addText(text: string): this;
|
|
1861
|
+
addTable(rows: unknown[][]): this;
|
|
1862
|
+
build(): Record<string, unknown>;
|
|
1863
|
+
send(jid: string, options?: Record<string, unknown>): Promise<{ key: WAMessageKey; message: unknown }>;
|
|
1864
|
+
sendEdit(jid?: string, id?: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
1865
|
+
streamText(jid: string, text: string | string[], options?: { chunkSize?: number; intervalMs?: number; cursor?: string; [key: string]: unknown }): Promise<{ key: WAMessageKey | null; text: string; edits: number }>;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/** Build a full auth-state (creds + keys) backed by a cache-manager store. */
|
|
1869
|
+
export declare function makeCacheManagerAuthState(store: CacheManagerStore, sessionKey?: string): Promise<{
|
|
1870
|
+
state: unknown;
|
|
1871
|
+
saveCreds: () => Promise<void>;
|
|
1872
|
+
}>;
|
|
1873
|
+
export interface AstralenaV3VoipConfig {
|
|
1874
|
+
sock: WASocket;
|
|
1875
|
+
client?: VoipClient;
|
|
1876
|
+
autoAnswer?: boolean;
|
|
1877
|
+
answerVideo?: boolean;
|
|
1878
|
+
answerOptions?: VoipCallOptions;
|
|
1879
|
+
}
|
|
1880
|
+
export declare class AstralenaV3VoipClient {
|
|
1881
|
+
constructor(config: AstralenaV3VoipConfig);
|
|
1882
|
+
readonly client: VoipClient;
|
|
1883
|
+
readonly activeCalls: ActiveCall[];
|
|
1884
|
+
connect(): Promise<this>;
|
|
1885
|
+
disconnect(): Promise<void>;
|
|
1886
|
+
answerIncomingCall(callId: string, options?: VoipCallOptions): Promise<ActiveCall>;
|
|
1887
|
+
rejectIncomingCall(callId: string): void;
|
|
1888
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
1889
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
1890
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
1891
|
+
}
|
|
1892
|
+
export declare function createAstralenaV3VoipClient(config: AstralenaV3VoipConfig): AstralenaV3VoipClient;
|
|
1893
|
+
declare function makeWASocket(config: SocketConfig): WASocket;
|
|
1894
|
+
export { makeWASocket };
|
|
1895
|
+
export default makeWASocket;
|