@wppconnect-team/wppconnect 1.13.2 → 1.14.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/CHANGELOG.md +22 -0
- package/dist/api/helpers/decrypt.js +1 -1
- package/dist/api/layers/sender.layer.d.ts +124 -28
- package/dist/api/layers/sender.layer.js +318 -199
- package/dist/api/model/result.d.ts +0 -5
- package/dist/api/whatsapp.js +27 -3
- package/dist/config/WAuserAgente.d.ts +1 -1
- package/dist/config/WAuserAgente.js +1 -1
- package/dist/config/create-config.js +1 -1
- package/dist/controllers/auth.js +8 -0
- package/dist/controllers/initializer.js +55 -10
- package/dist/lib/wapi/wapi.js +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 1.14.1 (2022-06-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# 1.14.0 (2022-06-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **deps:** update dependency @wppconnect/wa-js to ^2.6.0 ([27d5a52](https://github.com/wppconnect-team/wppconnect/commit/27d5a523c1dfa1a22c8be08cd7ff6d03af1fc0b1))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.13.3 (2022-06-01)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* Clear all token data when disconnected (fix [#1147](https://github.com/wppconnect-team/wppconnect/issues/1147)) ([4abcfed](https://github.com/wppconnect-team/wppconnect/commit/4abcfed97778ddb619df65fec0b1c3d0dc4debac))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## 1.13.2 (2022-05-28)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -71,7 +71,7 @@ exports.mediaTypes = {
|
|
|
71
71
|
};
|
|
72
72
|
var processUA = function (userAgent) {
|
|
73
73
|
var ua = userAgent ||
|
|
74
|
-
'
|
|
74
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36';
|
|
75
75
|
if (!ua.includes('WhatsApp'))
|
|
76
76
|
ua = 'WhatsApp/2.16.352 ' + ua;
|
|
77
77
|
return ua;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ListMessageOptions, TextMessageOptions } from '@wppconnect/wa-js/dist/chat';
|
|
1
|
+
import type { FileMessageOptions, ListMessageOptions, LocationMessageOptions, SendMessageReturn, TextMessageOptions } from '@wppconnect/wa-js/dist/chat';
|
|
2
2
|
import { Page } from 'puppeteer';
|
|
3
3
|
import { CreateConfig } from '../../config/create-config';
|
|
4
|
-
import { Message
|
|
4
|
+
import { Message } from '../model';
|
|
5
5
|
import { ChatState } from '../model/enum';
|
|
6
6
|
import { ListenerLayer } from './listener.layer';
|
|
7
7
|
export declare class SenderLayer extends ListenerLayer {
|
|
@@ -9,12 +9,16 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
9
9
|
constructor(page: Page, session?: string, options?: CreateConfig);
|
|
10
10
|
/**
|
|
11
11
|
* Automatically sends a link with the auto generated link preview. You can also add a custom message to be added.
|
|
12
|
+
*
|
|
13
|
+
* Deprecated: please use {@link sendText}
|
|
14
|
+
*
|
|
12
15
|
* @category Chat
|
|
16
|
+
* @deprecated
|
|
13
17
|
* @param chatId
|
|
14
18
|
* @param url string A link, for example for youtube. e.g https://www.youtube.com/watch?v=Zi_XLOBDo_Y&list=RDEMe12_MlgO8mGFdeeftZ2nOQ&start_radio=1
|
|
15
|
-
* @param
|
|
19
|
+
* @param text custom text as the message body, this includes the link or will be attached after the link
|
|
16
20
|
*/
|
|
17
|
-
sendLinkPreview(chatId: string, url: string,
|
|
21
|
+
sendLinkPreview(chatId: string, url: string, text?: string): Promise<SendMessageReturn>;
|
|
18
22
|
/**
|
|
19
23
|
* Sends a text message to given chat
|
|
20
24
|
* @category Chat
|
|
@@ -27,10 +31,18 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
27
31
|
* client.sendText('<number>@c.us', 'A simple message');
|
|
28
32
|
*
|
|
29
33
|
* // With buttons
|
|
30
|
-
* client.sendText('<number>@c.us', '
|
|
34
|
+
* client.sendText('<number>@c.us', 'WPPConnect message with buttons', {
|
|
31
35
|
* useTemplateButtons: true, // False for legacy
|
|
32
36
|
* buttons: [
|
|
33
37
|
* {
|
|
38
|
+
* url: 'https://wppconnect-team.github.io/',
|
|
39
|
+
* text: 'WPPConnect Site'
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* phoneNumber: '+55 11 22334455',
|
|
43
|
+
* text: 'Call me'
|
|
44
|
+
* },
|
|
45
|
+
* {
|
|
34
46
|
* id: 'your custom id 1',
|
|
35
47
|
* text: 'Some text'
|
|
36
48
|
* },
|
|
@@ -86,16 +98,25 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
86
98
|
}>;
|
|
87
99
|
/**
|
|
88
100
|
* Sends message with thumbnail
|
|
101
|
+
*
|
|
102
|
+
* @deprecated: please use {@link sendText} with options
|
|
103
|
+
*
|
|
104
|
+
* @deprecated
|
|
89
105
|
* @category Chat
|
|
90
|
-
* @param
|
|
106
|
+
* @param pathOrBase64
|
|
91
107
|
* @param url
|
|
92
108
|
* @param title
|
|
93
109
|
* @param description
|
|
94
110
|
* @param chatId
|
|
95
111
|
*/
|
|
96
|
-
sendMessageWithThumb(
|
|
112
|
+
sendMessageWithThumb(pathOrBase64: string, url: string, title: string, description: string, chatId: string): Promise<SendMessageReturn>;
|
|
97
113
|
/**
|
|
98
114
|
* Replies to given mesage id of given chat id
|
|
115
|
+
*
|
|
116
|
+
* Deprecated: Please, use sendText with quotedMsg option
|
|
117
|
+
*
|
|
118
|
+
* @deprecated
|
|
119
|
+
*
|
|
99
120
|
* @category Chat
|
|
100
121
|
* @param to Chat id
|
|
101
122
|
* @param content Message body
|
|
@@ -130,22 +151,72 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
130
151
|
/**
|
|
131
152
|
* Sends file
|
|
132
153
|
* base64 parameter should have mime type already defined
|
|
154
|
+
*
|
|
155
|
+
* Deprecated: please use sendFile with options: sendFile(to, content, options)
|
|
156
|
+
*
|
|
157
|
+
* @deprecated
|
|
158
|
+
*
|
|
133
159
|
* @category Chat
|
|
134
|
-
* @param
|
|
160
|
+
* @param chatId Chat id
|
|
135
161
|
* @param base64 base64 data
|
|
136
162
|
* @param filename
|
|
137
163
|
* @param caption
|
|
138
164
|
*/
|
|
139
|
-
sendFileFromBase64(
|
|
165
|
+
sendFileFromBase64(chatId: string, base64: string, filename: string, caption?: string): Promise<any>;
|
|
140
166
|
/**
|
|
141
|
-
* Sends file from path
|
|
167
|
+
* Sends file from path or base64
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```javascript
|
|
171
|
+
* // Simple message
|
|
172
|
+
* client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==');
|
|
173
|
+
*
|
|
174
|
+
* // With buttons
|
|
175
|
+
* client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==', {
|
|
176
|
+
* useTemplateButtons: true, // False for legacy
|
|
177
|
+
* buttons: [
|
|
178
|
+
* {
|
|
179
|
+
* url: 'https://wppconnect-team.github.io/',
|
|
180
|
+
* text: 'WPPConnect Site'
|
|
181
|
+
* },
|
|
182
|
+
* {
|
|
183
|
+
* phoneNumber: '+55 11 22334455',
|
|
184
|
+
* text: 'Call me'
|
|
185
|
+
* },
|
|
186
|
+
* {
|
|
187
|
+
* id: 'your custom id 1',
|
|
188
|
+
* text: 'Some text'
|
|
189
|
+
* },
|
|
190
|
+
* {
|
|
191
|
+
* id: 'another id 2',
|
|
192
|
+
* text: 'Another text'
|
|
193
|
+
* }
|
|
194
|
+
* ],
|
|
195
|
+
* title: 'Title text' // Optional
|
|
196
|
+
* footer: 'Footer text' // Optional
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
142
200
|
* @category Chat
|
|
143
201
|
* @param to Chat id
|
|
144
|
-
* @param
|
|
145
|
-
* @param
|
|
146
|
-
* @param caption
|
|
202
|
+
* @param pathOrBase64 File path
|
|
203
|
+
* @param options
|
|
147
204
|
*/
|
|
148
|
-
sendFile(to: string,
|
|
205
|
+
sendFile(to: string, pathOrBase64: string, options?: FileMessageOptions): any;
|
|
206
|
+
/**
|
|
207
|
+
* Sends file from path or base64
|
|
208
|
+
*
|
|
209
|
+
* Deprecated: please use sendFile with options: sendFile(to, content, options)
|
|
210
|
+
*
|
|
211
|
+
* @deprecated
|
|
212
|
+
*
|
|
213
|
+
* @category Chat
|
|
214
|
+
* @param to Chat id
|
|
215
|
+
* @param pathOrBase64 File path or base64
|
|
216
|
+
* @param filename The file name
|
|
217
|
+
* @param caption Caption for the filename
|
|
218
|
+
*/
|
|
219
|
+
sendFile(to: string, pathOrBase64: string, filename?: string, caption?: string): any;
|
|
149
220
|
/**
|
|
150
221
|
* Sends a video to given chat as a gif, with caption or not
|
|
151
222
|
* @category Chat
|
|
@@ -204,7 +275,7 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
204
275
|
* @param to Chat id
|
|
205
276
|
* @param contactsId Example: 0000@c.us | [000@c.us, 1111@c.us]
|
|
206
277
|
*/
|
|
207
|
-
sendContactVcard(to: string, contactsId: string, name?: string): Promise<
|
|
278
|
+
sendContactVcard(to: string, contactsId: string, name?: string): Promise<SendMessageReturn>;
|
|
208
279
|
/**
|
|
209
280
|
* Send a list of contact cards
|
|
210
281
|
* @category Chat
|
|
@@ -214,7 +285,7 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
214
285
|
sendContactVcardList(to: string, contacts: (string | {
|
|
215
286
|
id: string;
|
|
216
287
|
name: string;
|
|
217
|
-
})[]): Promise<
|
|
288
|
+
})[]): Promise<SendMessageReturn>;
|
|
218
289
|
/**
|
|
219
290
|
* Forwards array of messages (could be ids or message objects)
|
|
220
291
|
* @category Chat
|
|
@@ -227,19 +298,25 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
227
298
|
/**
|
|
228
299
|
* Generates sticker from the provided animated gif image and sends it (Send image as animated sticker)
|
|
229
300
|
* @category Chat
|
|
230
|
-
*
|
|
231
|
-
*
|
|
301
|
+
* @param pathOrBase64 image path imageBase64 A valid gif image is required. You can also send via http/https (http://www.website.com/img.gif)
|
|
302
|
+
* @param to chatId '000000000000@c.us'
|
|
232
303
|
*/
|
|
233
|
-
sendImageAsStickerGif(to: string,
|
|
304
|
+
sendImageAsStickerGif(to: string, pathOrBase64: string): Promise<SendMessageReturn>;
|
|
234
305
|
/**
|
|
235
306
|
* Generates sticker from given image and sends it (Send Image As Sticker)
|
|
236
307
|
* @category Chat
|
|
237
|
-
* @param
|
|
308
|
+
* @param pathOrBase64 image path imageBase64 A valid png, jpg and webp image is required. You can also send via http/https (http://www.website.com/img.gif)
|
|
238
309
|
* @param to chatId '000000000000@c.us'
|
|
239
310
|
*/
|
|
240
|
-
sendImageAsSticker(to: string,
|
|
311
|
+
sendImageAsSticker(to: string, pathOrBase64: string): Promise<SendMessageReturn>;
|
|
312
|
+
/**
|
|
313
|
+
* Sends location to given chat id
|
|
314
|
+
* @category Chat
|
|
315
|
+
* @param to Chat id
|
|
316
|
+
* @param options location options
|
|
317
|
+
*/
|
|
318
|
+
sendLocation(to: string, options: LocationMessageOptions): any;
|
|
241
319
|
/**
|
|
242
|
-
* TODO: Fix message not being delivered
|
|
243
320
|
* Sends location to given chat id
|
|
244
321
|
* @category Chat
|
|
245
322
|
* @param to Chat id
|
|
@@ -247,7 +324,7 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
247
324
|
* @param longitude Longitude
|
|
248
325
|
* @param title Text caption
|
|
249
326
|
*/
|
|
250
|
-
sendLocation(to: string, latitude: string, longitude: string, title: string):
|
|
327
|
+
sendLocation(to: string, latitude: string, longitude: string, title: string): any;
|
|
251
328
|
/**
|
|
252
329
|
* Sets a chat status to seen. Marks all messages as ack: 3
|
|
253
330
|
* @category Chat
|
|
@@ -259,26 +336,45 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
259
336
|
}>;
|
|
260
337
|
/**
|
|
261
338
|
* Starts typing ('Typing...' state)
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```javascript
|
|
342
|
+
* // Keep sending typing state, use stopTyping to finish
|
|
343
|
+
* await client.startTyping('[number]@c.us');
|
|
344
|
+
*
|
|
345
|
+
* // Keep sending typing state for 5 seconds
|
|
346
|
+
* await client.startTyping('[number]@c.us', 5000);
|
|
347
|
+
* ```
|
|
262
348
|
* @category Chat
|
|
263
|
-
* @param
|
|
349
|
+
* @param to Chat Id
|
|
350
|
+
* @param duration Duration um miliseconds
|
|
264
351
|
*/
|
|
265
352
|
startTyping(to: string, duration?: number): Promise<void>;
|
|
266
353
|
/**
|
|
267
354
|
* Stops typing ('Typing...' state)
|
|
268
355
|
* @category Chat
|
|
269
|
-
* @param
|
|
356
|
+
* @param to Chat Id
|
|
270
357
|
*/
|
|
271
358
|
stopTyping(to: string): Promise<void>;
|
|
272
359
|
/**
|
|
273
360
|
* Starts recording ('Recording...' state)
|
|
361
|
+
* @example
|
|
362
|
+
* ```javascript
|
|
363
|
+
* // Keep sending recording state, use stopRecoring to finish
|
|
364
|
+
* await client.startRecording('[number]@c.us');
|
|
365
|
+
*
|
|
366
|
+
* // Keep sending typing state for 5 seconds
|
|
367
|
+
* await client.startRecording('[number]@c.us', 5000);
|
|
368
|
+
* ```
|
|
274
369
|
* @category Chat
|
|
275
|
-
* @param
|
|
370
|
+
* @param to Chat Id
|
|
371
|
+
* @param duration Duration um miliseconds
|
|
276
372
|
*/
|
|
277
373
|
startRecording(to: string, duration?: number): Promise<void>;
|
|
278
374
|
/**
|
|
279
375
|
* Stops recording ('Recording...' state)
|
|
280
376
|
* @category Chat
|
|
281
|
-
* @param
|
|
377
|
+
* @param to Chat Id
|
|
282
378
|
*/
|
|
283
379
|
stopRecoring(to: string): Promise<void>;
|
|
284
380
|
/**
|
|
@@ -291,7 +387,7 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
291
387
|
* Sends text with tags
|
|
292
388
|
* @category Chat
|
|
293
389
|
*/
|
|
294
|
-
sendMentioned(to: string, message: string, mentioned: string[]): Promise<
|
|
390
|
+
sendMentioned(to: string, message: string, mentioned: string[]): Promise<SendMessageReturn>;
|
|
295
391
|
/**
|
|
296
392
|
* Sends a list message
|
|
297
393
|
*
|