@areumtecnologia/wasockets 2.0.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1987 -1649
- package/lib/Client/Builders/Buttons.js +127 -0
- package/lib/Client/Builders/EventBuilder.js +122 -0
- package/lib/Client/Builders/InteractiveMessage.js +150 -0
- package/lib/Client/Builders/Lists.js +78 -0
- package/lib/Client/Builders/PollBuilder.js +84 -0
- package/lib/Client/Builders/index.js +21 -0
- package/lib/Client/Constants.js +54 -0
- package/lib/Client/Context/CallContext.js +96 -0
- package/lib/Client/Context/MediaObject.js +155 -0
- package/lib/Client/Context/MessageContext.js +146 -0
- package/lib/Client/Modules/BusinessManager.js +155 -0
- package/lib/Client/Modules/ChannelManager.js +144 -0
- package/lib/Client/Modules/ChatManager.js +113 -0
- package/lib/Client/Modules/CommunityManager.js +136 -0
- package/lib/Client/Modules/GroupManager.js +194 -0
- package/lib/Client/Modules/LabelManager.js +123 -0
- package/lib/Client/Modules/MessageManager.js +198 -0
- package/lib/Client/Modules/PresenceManager.js +68 -0
- package/lib/Client/Modules/PrivacyManager.js +98 -0
- package/lib/Client/Modules/ProfileManager.js +92 -0
- package/lib/Client/Modules/UserManager.js +92 -0
- package/lib/Client/Modules/VoipManager.js +117 -0
- package/lib/Client/Modules/index.js +29 -0
- package/lib/Client/Normalizers/EventNormalizer.js +82 -0
- package/lib/Client/Normalizers/JidNormalizer.js +93 -0
- package/lib/Client/Normalizers/MessageNormalizer.js +134 -0
- package/lib/Client/WaClient.js +438 -0
- package/lib/Client/index.d.ts +464 -0
- package/lib/Client/index.js +76 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/connection.js +14 -1
- package/lib/Socket/index.js +51 -48
- package/lib/Socket/messages-recv.js +74 -13
- package/lib/Socket/messages-send.js +50 -25
- package/lib/Socket/socket.js +13 -0
- package/lib/Socket/voip.js +123 -0
- package/lib/Store/make-cache-manager-store.js +14 -5
- package/lib/Types/index.d.ts +4 -0
- package/lib/Utils/auth-utils.js +16 -1
- package/lib/Utils/browser-utils.js +6 -2
- package/lib/Utils/generics.js +47 -8
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/messages-media.js +44 -21
- package/lib/Utils/pre-key-manager.js +16 -1
- package/lib/Utils/validate-connection.js +10 -11
- package/lib/VoIP/VoIPCrypto.js +150 -0
- package/lib/VoIP/VoIPManager.js +469 -0
- package/lib/VoIP/VoIPMediaEngine.js +224 -0
- package/lib/VoIP/VoIPProtocol.js +354 -0
- package/lib/VoIP/VoIPRelayTransport.js +173 -0
- package/lib/VoIP/VoIPSession.js +314 -0
- package/lib/VoIP/assets/wasm/loader.js +5 -0
- package/lib/VoIP/assets/wasm/whatsapp.wasm +0 -0
- package/lib/VoIP/assets/wasm/worker-modules.js +305 -0
- package/lib/VoIP/engine/audio-feeder.d.mts +15 -0
- package/lib/VoIP/engine/audio-feeder.mjs +243 -0
- package/lib/VoIP/engine/index.d.mts +91 -0
- package/lib/VoIP/engine/index.mjs +1683 -0
- package/lib/VoIP/engine/relay-transport.d.mts +43 -0
- package/lib/VoIP/engine/relay-transport.mjs +607 -0
- package/lib/VoIP/engine/signaling.d.mts +44 -0
- package/lib/VoIP/engine/signaling.mjs +893 -0
- package/lib/VoIP/engine/types.d.mts +183 -0
- package/lib/VoIP/engine/types.mjs +17 -0
- package/lib/VoIP/engine/wasm-engine.d.mts +103 -0
- package/lib/VoIP/engine/wasm-engine.mjs +1397 -0
- package/lib/VoIP/engine/worker-bootstrap.mjs +1049 -0
- package/lib/VoIP/index.js +51 -0
- package/lib/VoIP/utils/audio.d.ts +28 -0
- package/lib/VoIP/utils/audio.js +148 -0
- package/lib/WABinary/generic-utils.js +22 -6
- package/lib/index.d.ts +382 -274
- package/lib/index.js +5 -0
- package/package.json +51 -49
package/lib/index.d.ts
CHANGED
|
@@ -1,274 +1,382 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import { proto } from '../WAProto'
|
|
4
|
-
import { AuthenticationState, BaileysEventEmitter, ConnectionState, Contact, GroupMetadata, WACallEvent, WAMessage, WAMessageKey, WAMessageContent, AnyMessageContent, MiscMessageGenerationOptions } from './Types'
|
|
5
|
-
import { PluginManager } from './Plugins'
|
|
6
|
-
|
|
7
|
-
export * from './Types'
|
|
8
|
-
export * from './Utils'
|
|
9
|
-
export * from './Defaults'
|
|
10
|
-
export * from './Store'
|
|
11
|
-
export * from './WABinary'
|
|
12
|
-
export * from './Plugins'
|
|
13
|
-
export { proto }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
(jid: string): Promise<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { proto } from '../WAProto'
|
|
4
|
+
import { AuthenticationState, BaileysEventEmitter, ConnectionState, Contact, GroupMetadata, WACallEvent, WAMessage, WAMessageKey, WAMessageContent, AnyMessageContent, MiscMessageGenerationOptions } from './Types'
|
|
5
|
+
import { PluginManager } from './Plugins'
|
|
6
|
+
|
|
7
|
+
export * from './Types'
|
|
8
|
+
export * from './Utils'
|
|
9
|
+
export * from './Defaults'
|
|
10
|
+
export * from './Store'
|
|
11
|
+
export * from './WABinary'
|
|
12
|
+
export * from './Plugins'
|
|
13
|
+
export { proto }
|
|
14
|
+
export * from './Client'
|
|
15
|
+
|
|
16
|
+
export interface GroupPermissionsPolicies {
|
|
17
|
+
announce?: boolean
|
|
18
|
+
restrict?: boolean
|
|
19
|
+
memberAddMode?: 'admin_add' | 'all_member_add'
|
|
20
|
+
approvalMode?: boolean | 'on' | 'off'
|
|
21
|
+
ephemeral?: number | false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GroupSubGroupsResult {
|
|
25
|
+
communityJid: string
|
|
26
|
+
isCommunity: boolean
|
|
27
|
+
defaultSubGroup: any | null
|
|
28
|
+
subGroups: any[]
|
|
29
|
+
linkedGroups: any[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SendAlbumMediaItem {
|
|
33
|
+
image?: any
|
|
34
|
+
video?: any
|
|
35
|
+
caption?: string
|
|
36
|
+
[key: string]: any
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export interface VoipConfig {
|
|
41
|
+
autoInit?: boolean
|
|
42
|
+
[key: string]: any
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CallOptions {
|
|
46
|
+
durationMs?: number
|
|
47
|
+
audioSource?: string
|
|
48
|
+
isVideo?: boolean
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CallPeerInfo {
|
|
52
|
+
phoneNumber?: string
|
|
53
|
+
pnJid?: string
|
|
54
|
+
lidJid?: string
|
|
55
|
+
displayName?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface CallTelemetryStats {
|
|
59
|
+
rttMs?: number
|
|
60
|
+
packetLossPct?: number
|
|
61
|
+
jitterMs?: number
|
|
62
|
+
rxAudioPackets?: number
|
|
63
|
+
txAudioPackets?: number
|
|
64
|
+
rxVideoFrames?: number
|
|
65
|
+
txVideoFrames?: number
|
|
66
|
+
[key: string]: any
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface VideoFrameEvent {
|
|
70
|
+
frameBuffer: Buffer | Uint8Array
|
|
71
|
+
width: number
|
|
72
|
+
height: number
|
|
73
|
+
format?: number
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface VADSpeakingEvent {
|
|
77
|
+
volumeDbfs: number
|
|
78
|
+
rms: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface VADSilenceEvent {
|
|
82
|
+
durationMs: number
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface IncomingCall {
|
|
86
|
+
readonly id: string
|
|
87
|
+
readonly callId: string
|
|
88
|
+
readonly from: string
|
|
89
|
+
readonly chatId?: string
|
|
90
|
+
readonly isVideo: boolean
|
|
91
|
+
readonly isGroup: boolean
|
|
92
|
+
readonly date: Date
|
|
93
|
+
accept(options?: CallOptions): Promise<ActiveCall>
|
|
94
|
+
reject(reason?: string | number): Promise<void>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ActiveCall {
|
|
98
|
+
readonly callId: string
|
|
99
|
+
readonly isVideo: boolean
|
|
100
|
+
readonly state: number
|
|
101
|
+
readonly direction?: 'outbound' | 'inbound'
|
|
102
|
+
readonly peer?: CallPeerInfo
|
|
103
|
+
readonly caller?: CallPeerInfo
|
|
104
|
+
end(): void
|
|
105
|
+
mute(muted: boolean): void
|
|
106
|
+
waitForEnd(): Promise<string>
|
|
107
|
+
pushAudio(pcm: Float32Array): void
|
|
108
|
+
pushVideo(frameBuffer: ArrayBuffer | Uint8Array | Buffer, width: number, height: number): void
|
|
109
|
+
pushVideoRgba(rgbaBuffer: ArrayBuffer | Uint8Array | Buffer, width: number, height: number): void
|
|
110
|
+
readonly isSharingScreen?: boolean
|
|
111
|
+
startScreenShare(options?: { fps?: number; width?: number; height?: number; screen?: string }): any
|
|
112
|
+
stopScreenShare(): void
|
|
113
|
+
getRxStream(options?: { format?: 'float32' | 'pcm_s16le' }): import('stream').Readable
|
|
114
|
+
getTxStream(options?: { format?: 'float32' | 'pcm_s16le' }): import('stream').Readable
|
|
115
|
+
recordToFile(filePath: string, options?: { source?: 'rx' | 'tx' | 'both', channels?: number }): Promise<void>
|
|
116
|
+
stopRecording(): void
|
|
117
|
+
on(event: 'ringing' | 'connected', listener: () => void): this
|
|
118
|
+
on(event: 'ended', listener: (reason: string) => void): this
|
|
119
|
+
on(event: 'audio' | 'audio_out' | 'audio:out', listener: (pcm: Float32Array) => void): this
|
|
120
|
+
on(event: 'video', listener: (frame: VideoFrameEvent) => void): this
|
|
121
|
+
on(event: 'video_out' | 'video:out', listener: (frame: Omit<VideoFrameEvent, 'format'>) => void): this
|
|
122
|
+
on(event: 'speaking', listener: (data: VADSpeakingEvent) => void): this
|
|
123
|
+
on(event: 'silence', listener: (data: VADSilenceEvent) => void): this
|
|
124
|
+
on(event: 'stats' | 'telemetry', listener: (stats: CallTelemetryStats) => void): this
|
|
125
|
+
on(event: string, listener: (...args: any[]) => void): this
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type CallSession = ActiveCall
|
|
129
|
+
|
|
130
|
+
export interface UserFacingSocketConfig {
|
|
131
|
+
version?: [number, number, number]
|
|
132
|
+
browser?: [string, string, string]
|
|
133
|
+
waWebSocketUrl?: string
|
|
134
|
+
connectTimeoutMs?: number
|
|
135
|
+
keepAliveIntervalMs?: number
|
|
136
|
+
logger?: any
|
|
137
|
+
printQRInTerminal?: boolean
|
|
138
|
+
emitOwnEvents?: boolean
|
|
139
|
+
defaultQueryTimeoutMs?: number
|
|
140
|
+
customUploadHosts?: string[]
|
|
141
|
+
retryRequestDelayMs?: number
|
|
142
|
+
maxMsgRetryCount?: number
|
|
143
|
+
fireInitQueries?: boolean
|
|
144
|
+
auth?: AuthenticationState
|
|
145
|
+
markOnlineOnConnect?: boolean
|
|
146
|
+
syncFullHistory?: boolean
|
|
147
|
+
patchMessageBeforeSending?: (msg: proto.IMessage) => proto.IMessage | Promise<proto.IMessage>
|
|
148
|
+
shouldSyncHistoryMessage?: (msg: proto.IHistorySyncNotification) => boolean
|
|
149
|
+
shouldIgnoreJid?: (jid: string) => boolean
|
|
150
|
+
linkPreviewImageThumbnailWidth?: number
|
|
151
|
+
transactionOpts?: { maxCommitRetries: number; delayBetweenTriesMs: number }
|
|
152
|
+
generateHighQualityLinkPreview?: boolean
|
|
153
|
+
enableAutoSessionRecreation?: boolean
|
|
154
|
+
enableRecentMessageCache?: boolean
|
|
155
|
+
enableMessageQueue?: boolean
|
|
156
|
+
messageQueueTtlMs?: number
|
|
157
|
+
maxReconnectAttempts?: number
|
|
158
|
+
enableGroupCache?: boolean
|
|
159
|
+
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadata | undefined>
|
|
160
|
+
plugins?: any[]
|
|
161
|
+
voip?: boolean | VoipConfig
|
|
162
|
+
[key: string]: any
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface WASocket {
|
|
166
|
+
type: 'md'
|
|
167
|
+
// VoIP Calling (Direct WebAssembly Multi-Device)
|
|
168
|
+
call(phoneNumber: string, options?: CallOptions): Promise<ActiveCall>
|
|
169
|
+
callVideo(phoneNumber: string, options?: Omit<CallOptions, 'isVideo'>): Promise<ActiveCall>
|
|
170
|
+
acceptCall(callId: string, from?: string, options?: CallOptions): Promise<ActiveCall>
|
|
171
|
+
answerCall(callId: string, from?: string, options?: CallOptions): Promise<ActiveCall>
|
|
172
|
+
activeCall: ActiveCall | null
|
|
173
|
+
clearActiveCall(): void
|
|
174
|
+
rejectCall(callId: string, from?: string, reason?: string | number): Promise<void>
|
|
175
|
+
voip: {
|
|
176
|
+
getEngine(): Promise<any>
|
|
177
|
+
destroy(): void
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
ws: any
|
|
181
|
+
ev: BaileysEventEmitter
|
|
182
|
+
authState: AuthenticationState
|
|
183
|
+
user: Contact | undefined
|
|
184
|
+
plugins: PluginManager
|
|
185
|
+
|
|
186
|
+
// Plugin & Middleware system
|
|
187
|
+
use(plugin: any, options?: any): WASocket
|
|
188
|
+
registerMiddleware(hook: 'beforeSendMessage' | 'afterSendMessage' | 'beforeRecvMessage' | 'afterRecvMessage' | 'connectionUpdate', fn: Function): () => void
|
|
189
|
+
hasPlugin(name: string): boolean
|
|
190
|
+
listPlugins(): Array<{ name: string; registeredAt: number; version: string; description: string }>
|
|
191
|
+
|
|
192
|
+
// Connection & Auth
|
|
193
|
+
waitForConnectionUpdate(check: (u: Partial<ConnectionState>) => boolean | undefined, timeoutMs?: number): Promise<void>
|
|
194
|
+
end(error: Error | undefined): void
|
|
195
|
+
logout(msg?: string): Promise<void>
|
|
196
|
+
requestPairingCode(phoneNumber: string): Promise<string>
|
|
197
|
+
repairSession(jid: string): Promise<void>
|
|
198
|
+
onWhatsApp(...phoneNumber: string[]): Promise<{ jid: string; exists: boolean }[] | undefined>
|
|
199
|
+
|
|
200
|
+
// Presence & Status
|
|
201
|
+
sendPresenceUpdate(type: 'available' | 'unavailable' | 'composing' | 'recording' | 'paused', toJid?: string): Promise<void>
|
|
202
|
+
presenceSubscribe(toJid: string): Promise<void>
|
|
203
|
+
|
|
204
|
+
// Profile & User
|
|
205
|
+
profilePictureUrl(jid: string, type?: 'image' | 'preview', timeoutMs?: number): Promise<string | undefined>
|
|
206
|
+
updateProfilePicture(jid: string, content: any): Promise<void>
|
|
207
|
+
removeProfilePicture(jid: string): Promise<void>
|
|
208
|
+
fetchStatus(jid: string): Promise<{ status: string | undefined; setAt: Date } | undefined>
|
|
209
|
+
updateProfileStatus(status: string): Promise<void>
|
|
210
|
+
updateProfileName(name: string): Promise<void>
|
|
211
|
+
|
|
212
|
+
// Cross-JID / LID Architecture
|
|
213
|
+
toPn(jid: string, fetchIfMissing?: boolean): Promise<string | null>
|
|
214
|
+
toLid(jid: string, fetchIfMissing?: boolean): Promise<string | null>
|
|
215
|
+
resolveJid(jid: string, fetchIfMissing?: boolean): Promise<{ pn: string | null; lid: string | null; jid: string | null }>
|
|
216
|
+
storeLidPnMapping(pn: string, lid: string): Promise<boolean>
|
|
217
|
+
|
|
218
|
+
// Messaging
|
|
219
|
+
sendMessage(jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions & { mentionAll?: boolean; adminsOnly?: boolean; excludeMe?: boolean }): Promise<WAMessage | undefined>
|
|
220
|
+
sendAlbumMessage(jid: string, medias: SendAlbumMediaItem[], options?: MiscMessageGenerationOptions): Promise<WAMessage[]>
|
|
221
|
+
groupSendMentionAll(jid: string, content: string | AnyMessageContent, options?: { adminsOnly?: boolean; excludeMe?: boolean }): Promise<WAMessage | undefined>
|
|
222
|
+
relayMessage(jid: string, message: proto.IMessage, options: any): Promise<string>
|
|
223
|
+
readMessages(keys: WAMessageKey[]): Promise<void>
|
|
224
|
+
star(jid: string, messages: { id: string; fromMe?: boolean }[], star: boolean): Promise<void>
|
|
225
|
+
sendStatusMentions(content: any, jids?: string[]): Promise<WAMessage>
|
|
226
|
+
reactToStatus(key: WAMessageKey, reaction?: string): Promise<string>
|
|
227
|
+
sendEventResponse(jid: string, eventCreationMessageKey: WAMessageKey, response: string | number, extraGuestCount?: number): Promise<WAMessage | undefined>
|
|
228
|
+
cancelEvent(jid: string, eventKey: WAMessageKey): Promise<WAMessage | undefined>
|
|
229
|
+
|
|
230
|
+
// Calls (VoIP & Web Calling)
|
|
231
|
+
voip: any
|
|
232
|
+
getVoIPRelayTokens(): Promise<any>
|
|
233
|
+
offerCall(toJid: string, isVideo?: boolean): Promise<{ id: string, to: string, callKey: Buffer }>
|
|
234
|
+
acceptCall(callId: string, callFrom: string, options?: { isVideo?: boolean, audioRate?: string }): Promise<void>
|
|
235
|
+
rejectCall(callId: string, callFrom: string, reason?: string | number): Promise<void>
|
|
236
|
+
terminateCall(callId: string, callFrom: string, reason?: string): Promise<void>
|
|
237
|
+
|
|
238
|
+
// Chats & Contacts
|
|
239
|
+
chatModify(mod: any, jid: string): Promise<void>
|
|
240
|
+
updateFavorite(jid: string, favorite: boolean): Promise<void>
|
|
241
|
+
updateChatNote(jid: string, note: string): Promise<void>
|
|
242
|
+
removeChatNote(jid: string): Promise<void>
|
|
243
|
+
addOrEditContact(contact: any): Promise<void>
|
|
244
|
+
removeContact(jid: string): Promise<void>
|
|
245
|
+
|
|
246
|
+
// Groups
|
|
247
|
+
groupMetadata(jid: string): Promise<GroupMetadata>
|
|
248
|
+
groupCreate(subject: string, participants: string[]): Promise<GroupMetadata>
|
|
249
|
+
groupLeave(id: string): Promise<void>
|
|
250
|
+
groupUpdateSubject(jid: string, subject: string): Promise<void>
|
|
251
|
+
groupUpdateDescription(jid: string, description: string): Promise<void>
|
|
252
|
+
groupInviteCode(jid: string): Promise<string | undefined>
|
|
253
|
+
groupRevokeInvite(jid: string): Promise<string | undefined>
|
|
254
|
+
groupAcceptInvite(code: string): Promise<string | undefined>
|
|
255
|
+
groupGetInviteInfo(code: string): Promise<GroupMetadata>
|
|
256
|
+
groupParticipantsUpdate(jid: string, participants: string[], action: 'add' | 'remove' | 'demote' | 'promote'): Promise<any[]>
|
|
257
|
+
groupSettingUpdate(jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<void>
|
|
258
|
+
groupMemberAddMode(jid: string, mode: 'admin_add' | 'all_member_add'): Promise<void>
|
|
259
|
+
groupJoinApprovalMode(jid: string, mode: 'on' | 'off' | boolean): Promise<void>
|
|
260
|
+
groupMembershipApprovalMode(jid: string, mode: 'on' | 'off' | boolean): Promise<void>
|
|
261
|
+
groupRequestParticipantsList(jid: string): Promise<any[]>
|
|
262
|
+
groupRequestParticipantsUpdate(jid: string, participants: string[], action: 'approve' | 'reject'): Promise<any[]>
|
|
263
|
+
groupApprovePendingParticipants(jid: string, participants: string | string[]): Promise<any[]>
|
|
264
|
+
groupRejectPendingParticipants(jid: string, participants: string | string[]): Promise<any[]>
|
|
265
|
+
groupUpdatePermissions(jid: string, policies: GroupPermissionsPolicies): Promise<Record<string, any>>
|
|
266
|
+
groupGetAdminJids(jid: string): Promise<string[]>
|
|
267
|
+
groupGetParticipants(jid: string): Promise<any[]>
|
|
268
|
+
groupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>
|
|
269
|
+
|
|
270
|
+
// Communities v2
|
|
271
|
+
communityCreate(subject: string, body?: string): Promise<GroupMetadata | null>
|
|
272
|
+
communityCreateGroup(subject: string, participants: string[], parentCommunityJid: string): Promise<GroupMetadata | null>
|
|
273
|
+
communityLinkGroup(groupJid: string, parentCommunityJid: string): Promise<void>
|
|
274
|
+
communityUnlinkGroup(groupJid: string, parentCommunityJid: string): Promise<void>
|
|
275
|
+
communityFetchLinkedGroups(jid: string): Promise<any>
|
|
276
|
+
communityFetchSubGroups(jid: string): Promise<GroupSubGroupsResult>
|
|
277
|
+
communityMembershipApprovalMode(jid: string, mode: 'on' | 'off' | boolean): Promise<void>
|
|
278
|
+
communityApprovePendingParticipants(jid: string, participants: string | string[]): Promise<any[]>
|
|
279
|
+
communityRejectPendingParticipants(jid: string, participants: string | string[]): Promise<any[]>
|
|
280
|
+
communityUpdatePermissions(jid: string, policies: GroupPermissionsPolicies): Promise<Record<string, any>>
|
|
281
|
+
|
|
282
|
+
// Newsletters v2
|
|
283
|
+
newsletterCreate(name: string, description?: string, picture?: Buffer): Promise<any>
|
|
284
|
+
newsletterMetadata(type: 'invite' | 'jid', key: string): Promise<any>
|
|
285
|
+
newsletterFetchMessages(jid: string, count: number, since?: number): Promise<any[]>
|
|
286
|
+
newsletterFetchMessage(jid: string, messageServerId: string | number): Promise<any>
|
|
287
|
+
newsletterFetchReactions(jid: string, messageServerId: string | number): Promise<any[]>
|
|
288
|
+
newsletterToggleMute(jid: string, mute: boolean): Promise<void>
|
|
289
|
+
newsletterFollow(jid: string): Promise<void>
|
|
290
|
+
newsletterUnfollow(jid: string): Promise<void>
|
|
291
|
+
newsletterSubscribers(jid: string): Promise<any>
|
|
292
|
+
newsletterSubscribed(): Promise<any[]>
|
|
293
|
+
newsletterUpdate(jid: string, updates: any): Promise<any>
|
|
294
|
+
newsletterUpdateName(jid: string, name: string): Promise<any>
|
|
295
|
+
newsletterUpdateDescription(jid: string, description: string): Promise<any>
|
|
296
|
+
newsletterUpdatePicture(jid: string, content: any): Promise<any>
|
|
297
|
+
newsletterRemovePicture(jid: string): Promise<any>
|
|
298
|
+
newsletterReactMessage(jid: string, serverId: string | number, reaction?: string): Promise<void>
|
|
299
|
+
newsletterAdminCount(jid: string): Promise<number>
|
|
300
|
+
newsletterChangeOwner(jid: string, newOwnerJid: string): Promise<void>
|
|
301
|
+
newsletterDelete(jid: string): Promise<void>
|
|
302
|
+
|
|
303
|
+
// Labels & Quick Replies
|
|
304
|
+
createLabel(name: string, color?: number): Promise<any>
|
|
305
|
+
updateLabel(labelId: string, name: string, color?: number): Promise<any>
|
|
306
|
+
deleteLabel(labelId: string): Promise<any>
|
|
307
|
+
addChatLabel(jid: string, labelId: string): Promise<void>
|
|
308
|
+
removeChatLabel(jid: string, labelId: string): Promise<void>
|
|
309
|
+
addMessageLabel(jid: string, messageId: string, labelId: string): Promise<void>
|
|
310
|
+
removeMessageLabel(jid: string, messageId: string, labelId: string): Promise<void>
|
|
311
|
+
addOrEditQuickReply(quickReply: any): Promise<void>
|
|
312
|
+
removeQuickReply(id: string): Promise<void>
|
|
313
|
+
|
|
314
|
+
// Privacy
|
|
315
|
+
fetchBlocklist(): Promise<string[]>
|
|
316
|
+
updateBlockStatus(jid: string, action: 'block' | 'unblock'): Promise<void>
|
|
317
|
+
fetchPrivacySettings(force?: boolean): Promise<any>
|
|
318
|
+
updateLastSeenPrivacy(value: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
|
|
319
|
+
updateOnlinePrivacy(value: 'all' | 'match_last_seen'): Promise<void>
|
|
320
|
+
updateReadReceiptsPrivacy(value: 'all' | 'none'): Promise<void>
|
|
321
|
+
updateProfilePicturePrivacy(value: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
|
|
322
|
+
updateStatusPrivacy(value: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
|
|
323
|
+
updateGroupsAddPrivacy(value: 'all' | 'contacts' | 'contact_blacklist'): Promise<void>
|
|
324
|
+
updateCallPrivacy(value: 'all' | 'known'): Promise<void>
|
|
325
|
+
|
|
326
|
+
// Business
|
|
327
|
+
getCatalog(opts: { jid?: string; limit?: number; cursor?: string }): Promise<any>
|
|
328
|
+
getCollections(jid?: string, limit?: number): Promise<any>
|
|
329
|
+
getOrderDetails(orderId: string, tokenBase64: string): Promise<any>
|
|
330
|
+
getProduct(jid: string, productId: string): Promise<any>
|
|
331
|
+
productCreate(create: any): Promise<any>
|
|
332
|
+
productUpdate(productId: string, update: any): Promise<any>
|
|
333
|
+
productDelete(productIds: string[]): Promise<{ deleted: number }>
|
|
334
|
+
updateBussinesProfile(args: any): Promise<void>
|
|
335
|
+
updateCoverPhoto(file: any): Promise<string>
|
|
336
|
+
removeCoverPhoto(id: string): Promise<void>
|
|
337
|
+
|
|
338
|
+
[key: string]: any
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface InMemoryStoreConfig {
|
|
342
|
+
logger?: any
|
|
343
|
+
chatKey?: any
|
|
344
|
+
labelAssociationKey?: any
|
|
345
|
+
maxMessagesPerChat?: number
|
|
346
|
+
[key: string]: any
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface InMemoryStore {
|
|
350
|
+
chats: any
|
|
351
|
+
messages: Record<string, any>
|
|
352
|
+
contacts: Record<string, Contact>
|
|
353
|
+
groupMetadata: Record<string, GroupMetadata>
|
|
354
|
+
presences: Record<string, any>
|
|
355
|
+
state: Partial<ConnectionState>
|
|
356
|
+
labels: any
|
|
357
|
+
labelAssociations: any
|
|
358
|
+
bind(ev: BaileysEventEmitter): void
|
|
359
|
+
loadMessage(jid: string, id: string): Promise<WAMessage | undefined>
|
|
360
|
+
loadMessages(jid: string, count: number, cursor?: any): Promise<WAMessage[]>
|
|
361
|
+
mostRecentMessage(jid: string): Promise<WAMessage | undefined>
|
|
362
|
+
getContact(jid: string): Contact | undefined
|
|
363
|
+
getChat(jid: string): any | undefined
|
|
364
|
+
pruneMessages(jid?: string, keepLastN?: number): number
|
|
365
|
+
clear(chatId?: string): void
|
|
366
|
+
getMessageCount(jid?: string): number
|
|
367
|
+
writeToFile(path: string): void
|
|
368
|
+
readFromFile(path: string): void
|
|
369
|
+
toJSON(): any
|
|
370
|
+
fromJSON(json: any): void
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export declare function makeInMemoryStore(config?: InMemoryStoreConfig): InMemoryStore
|
|
374
|
+
export declare function createGroupMetadataCache(ttlMs?: number, maxSize?: number): {
|
|
375
|
+
(jid: string): Promise<GroupMetadata | undefined>
|
|
376
|
+
set(jid: string, metadata: GroupMetadata): void
|
|
377
|
+
delete(jid: string): boolean
|
|
378
|
+
clear(): void
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export declare function makeWASocket(config?: UserFacingSocketConfig): WASocket
|
|
382
|
+
export default makeWASocket
|