@open-wa/wa-automate-types-only 4.43.0 → 4.43.3
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/dist/api/Client.d.ts +45 -36
- package/dist/api/model/message.d.ts +38 -0
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Page } from 'puppeteer';
|
3
3
|
import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatCreationResponse, EphemeralDuration } from './model/chat';
|
4
4
|
import { Contact, NumberCheck } from './model/contact';
|
5
|
-
import { Message } from './model/message';
|
5
|
+
import { Message, MessageInfo } from './model/message';
|
6
6
|
import { AxiosRequestConfig } from 'axios';
|
7
7
|
import { ParticipantChangedEventModel } from './model/group-metadata';
|
8
8
|
import { ConfigObject, STATE, LicenseType, Webhook, EventPayload } from './model';
|
@@ -39,6 +39,7 @@ export declare class Client {
|
|
39
39
|
private _page;
|
40
40
|
private _currentlyBeingKilled;
|
41
41
|
private _refreshing;
|
42
|
+
private _loaded;
|
42
43
|
private _prio;
|
43
44
|
private _pageListeners;
|
44
45
|
private _registeredPageListeners;
|
@@ -244,19 +245,19 @@ export declare class Client {
|
|
244
245
|
*/
|
245
246
|
onLabel(fn: (label: Label) => void): Promise<Listener | boolean>;
|
246
247
|
/**
|
247
|
-
*
|
248
|
+
*{@license:insiders@}
|
248
249
|
*
|
249
250
|
* Listens to new orders. Only works on business accounts
|
250
251
|
*/
|
251
252
|
onOrder(fn: (order: Order) => void): Promise<Listener | boolean>;
|
252
253
|
/**
|
253
|
-
*
|
254
|
+
*{@license:insiders@}
|
254
255
|
*
|
255
256
|
* Listens to new orders. Only works on business accounts
|
256
257
|
*/
|
257
258
|
onNewProduct(fn: (product: Product) => void): Promise<Listener | boolean>;
|
258
259
|
/**
|
259
|
-
*
|
260
|
+
* {@license:insiders@}
|
260
261
|
*
|
261
262
|
* Listens to reaction add and change events
|
262
263
|
*
|
@@ -266,7 +267,7 @@ export declare class Client {
|
|
266
267
|
*/
|
267
268
|
onReaction(fn: (reactionEvent: ReactionEvent) => void): Promise<Listener | boolean>;
|
268
269
|
/**
|
269
|
-
*
|
270
|
+
* {@license:insiders@}
|
270
271
|
*
|
271
272
|
* Listens to chat state, including when a specific user is recording and typing within a group chat.
|
272
273
|
*
|
@@ -309,7 +310,7 @@ export declare class Client {
|
|
309
310
|
*/
|
310
311
|
onAddedToGroup(fn: (chat: Chat) => any): Promise<Listener | boolean>;
|
311
312
|
/**
|
312
|
-
*
|
313
|
+
* {@license:insiders@}
|
313
314
|
*
|
314
315
|
* Fires callback with Chat object every time the host phone is removed to a group.
|
315
316
|
*
|
@@ -319,7 +320,7 @@ export declare class Client {
|
|
319
320
|
*/
|
320
321
|
onRemovedFromGroup(fn: (chat: Chat) => any): Promise<Listener | boolean>;
|
321
322
|
/**
|
322
|
-
*
|
323
|
+
* {@license:insiders@}
|
323
324
|
*
|
324
325
|
* Fires callback with the relevant chat id every time the user clicks on a chat. This will only work in headful mode.
|
325
326
|
*
|
@@ -329,7 +330,7 @@ export declare class Client {
|
|
329
330
|
*/
|
330
331
|
onChatOpened(fn: (chat: Chat) => any): Promise<Listener | boolean>;
|
331
332
|
/**
|
332
|
-
*
|
333
|
+
* {@license:insiders@}
|
333
334
|
*
|
334
335
|
* Fires callback with contact id when a new contact is added on the host phone.
|
335
336
|
*
|
@@ -373,7 +374,7 @@ export declare class Client {
|
|
373
374
|
*/
|
374
375
|
setMyStatus(newStatus: string): Promise<boolean | void>;
|
375
376
|
/**
|
376
|
-
*
|
377
|
+
* {@license:insiders@}
|
377
378
|
*
|
378
379
|
* Adds label from chat, message or contact. Only for business accounts.
|
379
380
|
* @param label: The desired text of the new label. id will be something simple like anhy nnumber from 1-10, name is the label of the label if that makes sense.
|
@@ -486,6 +487,9 @@ export declare class Client {
|
|
486
487
|
testButtons(chatId: ChatId): Promise<any>;
|
487
488
|
private link;
|
488
489
|
/**
|
490
|
+
*
|
491
|
+
* {@license:restricted@}
|
492
|
+
*
|
489
493
|
* Sends a text message to given chat
|
490
494
|
* If you need to send a message to new numbers please see [these instructions:](https://docs.openwa.dev/pages/The%20Client/licensed-features.html#sending-messages-to-non-contact-numbers)
|
491
495
|
* @param to chat id: `xxxxx@c.us`
|
@@ -551,8 +555,6 @@ export declare class Client {
|
|
551
555
|
/**
|
552
556
|
* {@license:insiders@}
|
553
557
|
*
|
554
|
-
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
555
|
-
*
|
556
558
|
* Send a list message. This will not work when being sent from business accounts!
|
557
559
|
*
|
558
560
|
* @param {ChatId} to
|
@@ -575,7 +577,7 @@ export declare class Client {
|
|
575
577
|
*/
|
576
578
|
sendReplyWithMentions(to: ChatId, content: Content, replyMessageId: MessageId, hideTags?: boolean, mentions?: ContactId[]): Promise<boolean | MessageId>;
|
577
579
|
/**
|
578
|
-
*
|
580
|
+
* {@license:insiders@}
|
579
581
|
*
|
580
582
|
* Tags everyone in the group with a message
|
581
583
|
*
|
@@ -660,7 +662,7 @@ export declare class Client {
|
|
660
662
|
*/
|
661
663
|
reply(to: ChatId, content: Content, quotedMsgId: MessageId, sendSeen?: boolean): Promise<boolean | MessageId>;
|
662
664
|
/**
|
663
|
-
*
|
665
|
+
* {@license:insiders@}
|
664
666
|
*
|
665
667
|
* Check if a recipient has read receipts on.
|
666
668
|
*
|
@@ -692,7 +694,7 @@ export declare class Client {
|
|
692
694
|
*/
|
693
695
|
sendFile(to: ChatId, file: DataURL | FilePath, filename: string, caption: Content, quotedMsgId?: MessageId, waitForId?: boolean, ptt?: boolean, withoutPreview?: boolean, hideTags?: boolean, viewOnce?: boolean): Promise<MessageId | boolean>;
|
694
696
|
/**
|
695
|
-
*
|
697
|
+
* {@license:insiders@}
|
696
698
|
*
|
697
699
|
* Checks whether or not the group id provided is known to be unsafe by the contributors of the library.
|
698
700
|
* @param groupChatId The group chat you want to deteremine is unsafe
|
@@ -812,7 +814,7 @@ export declare class Client {
|
|
812
814
|
sendContact(to: ChatId, contactId: ContactId | ContactId[]): Promise<MessageId | boolean>;
|
813
815
|
/**
|
814
816
|
*
|
815
|
-
*
|
817
|
+
* {@license:insiders@}
|
816
818
|
*
|
817
819
|
* Sends multiple contacts as a single message
|
818
820
|
*
|
@@ -848,7 +850,7 @@ export declare class Client {
|
|
848
850
|
pinChat(id: ChatId, pin: boolean): Promise<boolean>;
|
849
851
|
/**
|
850
852
|
*
|
851
|
-
*
|
853
|
+
* {@license:insiders@}
|
852
854
|
*
|
853
855
|
* Mutes a conversation for a given duration. If already muted, this will update the muted duration. Mute durations are relative from when the method is called.
|
854
856
|
* @param chatId The id of the conversation you want to mute
|
@@ -864,7 +866,7 @@ export declare class Client {
|
|
864
866
|
isChatMuted(chatId: ChatId): Promise<boolean>;
|
865
867
|
/**
|
866
868
|
*
|
867
|
-
*
|
869
|
+
* {@license:insiders@}
|
868
870
|
*
|
869
871
|
* Unmutes a conversation.
|
870
872
|
* @param id The id of the conversation you want to mute
|
@@ -1000,9 +1002,9 @@ export declare class Client {
|
|
1000
1002
|
*/
|
1001
1003
|
contactBlock(id: ContactId): Promise<boolean>;
|
1002
1004
|
/**
|
1003
|
-
*
|
1005
|
+
* {@license:restricted@}
|
1004
1006
|
*
|
1005
|
-
*
|
1007
|
+
* Report a contact for spam, block them and attempt to clear chat.
|
1006
1008
|
*
|
1007
1009
|
* @param {string} id '000000000000@c.us'
|
1008
1010
|
*/
|
@@ -1058,7 +1060,14 @@ export declare class Client {
|
|
1058
1060
|
*/
|
1059
1061
|
getMessageById(messageId: MessageId): Promise<Message>;
|
1060
1062
|
/**
|
1061
|
-
*
|
1063
|
+
* {@license:insiders@}
|
1064
|
+
*
|
1065
|
+
* Get the detailed message info for a group message sent out by the host account.
|
1066
|
+
* @param messageId The message Id
|
1067
|
+
*/
|
1068
|
+
getMessageInfo(messageId: MessageId): Promise<MessageInfo>;
|
1069
|
+
/**
|
1070
|
+
* {@license:insiders@}
|
1062
1071
|
*
|
1063
1072
|
* Retrieves an order object
|
1064
1073
|
* @param messageId or OrderId
|
@@ -1066,7 +1075,7 @@ export declare class Client {
|
|
1066
1075
|
*/
|
1067
1076
|
getOrder(id: MessageId | string): Promise<Order>;
|
1068
1077
|
/**
|
1069
|
-
*
|
1078
|
+
* {@license:insiders@}
|
1070
1079
|
*
|
1071
1080
|
* Add a product to your catalog
|
1072
1081
|
*
|
@@ -1082,7 +1091,7 @@ export declare class Client {
|
|
1082
1091
|
*/
|
1083
1092
|
createNewProduct(name: string, price: number, currency: string, images: string[], description: string, url?: string, internalId?: string, isHidden?: boolean): Promise<Product>;
|
1084
1093
|
/**
|
1085
|
-
*
|
1094
|
+
* {@license:insiders@}
|
1086
1095
|
*
|
1087
1096
|
* Edit a product in your catalog
|
1088
1097
|
*
|
@@ -1099,7 +1108,7 @@ export declare class Client {
|
|
1099
1108
|
*/
|
1100
1109
|
editProduct(productId: string, name?: string, price?: number, currency?: string, images?: DataURL[], description?: string, url?: string, internalId?: string, isHidden?: boolean): Promise<Product>;
|
1101
1110
|
/**
|
1102
|
-
*
|
1111
|
+
* {@license:insiders@}
|
1103
1112
|
*
|
1104
1113
|
* Send a product to a chat
|
1105
1114
|
*
|
@@ -1119,9 +1128,9 @@ export declare class Client {
|
|
1119
1128
|
/**
|
1120
1129
|
* Retrieves the last message sent by the host account in any given chat or globally.
|
1121
1130
|
* @param chatId This is optional. If no chat Id is set then the last message sent by the host account will be returned.
|
1122
|
-
* @returns message object
|
1131
|
+
* @returns message object or `undefined` if the host account's last message could not be found.
|
1123
1132
|
*/
|
1124
|
-
getMyLastMessage(chatId?: ChatId): Promise<Message>;
|
1133
|
+
getMyLastMessage(chatId?: ChatId): Promise<Message | undefined>;
|
1125
1134
|
/**
|
1126
1135
|
* Retrieves the starred messages in a given chat
|
1127
1136
|
* @param chatId Chat ID to filter starred messages by
|
@@ -1160,7 +1169,7 @@ export declare class Client {
|
|
1160
1169
|
getStickerDecryptable(messageId: MessageId): Promise<Message | false>;
|
1161
1170
|
/**
|
1162
1171
|
*
|
1163
|
-
*
|
1172
|
+
* {@license:insiders@}
|
1164
1173
|
*
|
1165
1174
|
* If a file is old enough, it will 404 if you try to decrypt it. This will allow you to force the host account to re upload the file and return a decryptable message.
|
1166
1175
|
*
|
@@ -1177,7 +1186,7 @@ export declare class Client {
|
|
1177
1186
|
*/
|
1178
1187
|
getChat(contactId: ContactId): Promise<Chat>;
|
1179
1188
|
/**
|
1180
|
-
*
|
1189
|
+
* {@license:insiders@}
|
1181
1190
|
*
|
1182
1191
|
* Retrieves the groups that you have in common with a contact
|
1183
1192
|
* @param contactId
|
@@ -1245,7 +1254,7 @@ export declare class Client {
|
|
1245
1254
|
}>;
|
1246
1255
|
/**
|
1247
1256
|
*
|
1248
|
-
*
|
1257
|
+
* {@license:insiders@}
|
1249
1258
|
*
|
1250
1259
|
* Use a Baileys payload within your open-wa session
|
1251
1260
|
*
|
@@ -1474,7 +1483,7 @@ export declare class Client {
|
|
1474
1483
|
*/
|
1475
1484
|
setGroupDescription(groupId: GroupChatId, description: string): Promise<boolean>;
|
1476
1485
|
/**
|
1477
|
-
*
|
1486
|
+
* {@license:insiders@}
|
1478
1487
|
*
|
1479
1488
|
* Change the group chat title
|
1480
1489
|
* @param groupId '0000000000-00000000@g.us' the group id.
|
@@ -1488,7 +1497,7 @@ export declare class Client {
|
|
1488
1497
|
*/
|
1489
1498
|
getGroupAdmins(groupId: GroupChatId): Promise<ContactId[]>;
|
1490
1499
|
/**
|
1491
|
-
*
|
1500
|
+
* {@license:insiders@}
|
1492
1501
|
*
|
1493
1502
|
* Set the wallpaper background colour
|
1494
1503
|
* @param {string} hex '#FFF123'
|
@@ -1525,7 +1534,7 @@ export declare class Client {
|
|
1525
1534
|
*/
|
1526
1535
|
sendStickerfromUrl(to: ChatId, url: string, requestConfig?: AxiosRequestConfig, stickerMetadata?: StickerMetadata): Promise<string | MessageId | boolean>;
|
1527
1536
|
/**
|
1528
|
-
*
|
1537
|
+
* {@license:insiders@}
|
1529
1538
|
*
|
1530
1539
|
* Sends a sticker from a given URL
|
1531
1540
|
* @param to The recipient id.
|
@@ -1537,7 +1546,7 @@ export declare class Client {
|
|
1537
1546
|
*/
|
1538
1547
|
sendStickerfromUrlAsReply(to: ChatId, url: string, messageId: MessageId, requestConfig?: AxiosRequestConfig, stickerMetadata?: StickerMetadata): Promise<MessageId | boolean>;
|
1539
1548
|
/**
|
1540
|
-
*
|
1549
|
+
* {@license:insiders@}
|
1541
1550
|
*
|
1542
1551
|
* This function takes an image and sends it as a sticker to the recipient as a reply to another message.
|
1543
1552
|
*
|
@@ -1576,7 +1585,7 @@ export declare class Client {
|
|
1576
1585
|
*
|
1577
1586
|
* @param to ChatId The chat id you want to send the webp sticker to
|
1578
1587
|
* @param file [[DataURL]], [[Base64]], URL (string GET), Relative filepath (string), or Buffer of the mp4 file
|
1579
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
1588
|
+
* @param messageId message id of the message you want this sticker to reply to. {@license:insiders@}
|
1580
1589
|
*/
|
1581
1590
|
sendMp4AsSticker(to: ChatId, file: DataURL | Buffer | Base64 | string, processOptions?: Mp4StickerConversionProcessOptions, stickerMetadata?: StickerMetadata, messageId?: MessageId): Promise<MessageId | string | boolean>;
|
1582
1591
|
/**
|
@@ -1584,7 +1593,7 @@ export declare class Client {
|
|
1584
1593
|
*
|
1585
1594
|
* @param to ChatId The chat id you want to send the webp sticker to
|
1586
1595
|
* @param emojiId The discord emoji id without indentifying chars. In discord you would write `:who:`, here use `who`
|
1587
|
-
* @param messageId message id of the message you want this sticker to reply to.
|
1596
|
+
* @param messageId message id of the message you want this sticker to reply to. {@license:insiders@}
|
1588
1597
|
*/
|
1589
1598
|
sendEmoji(to: ChatId, emojiId: string, messageId?: MessageId): Promise<MessageId | boolean | string>;
|
1590
1599
|
/**
|
@@ -1595,7 +1604,7 @@ export declare class Client {
|
|
1595
1604
|
*/
|
1596
1605
|
sendRawWebpAsSticker(to: ChatId, webpBase64: Base64, animated?: boolean): Promise<MessageId | string | boolean>;
|
1597
1606
|
/**
|
1598
|
-
*
|
1607
|
+
* {@license:insiders@}
|
1599
1608
|
*
|
1600
1609
|
* You can use this to send a raw webp file.
|
1601
1610
|
* @param to ChatId The chat id you want to send the webp sticker to
|
@@ -1605,7 +1614,7 @@ export declare class Client {
|
|
1605
1614
|
*/
|
1606
1615
|
sendRawWebpAsStickerAsReply(to: ChatId, messageId: MessageId, webpBase64: Base64, animated?: boolean): Promise<MessageId | string | boolean>;
|
1607
1616
|
/**
|
1608
|
-
*
|
1617
|
+
* {@license:insiders@}
|
1609
1618
|
*
|
1610
1619
|
* Turn the ephemeral setting in a chat to on or off
|
1611
1620
|
* @param chatId The ID of the chat
|
@@ -141,6 +141,10 @@ export interface Message {
|
|
141
141
|
* Is the message a "view once" message
|
142
142
|
*/
|
143
143
|
isViewOnce: boolean;
|
144
|
+
/**
|
145
|
+
* Use this to traverse the quote chain.
|
146
|
+
*/
|
147
|
+
quoteMap: QuoteMap;
|
144
148
|
/**
|
145
149
|
* The URL of the file after being uploaded to the cloud using a cloud upload message preprocessor.
|
146
150
|
*/
|
@@ -163,6 +167,40 @@ export interface Message {
|
|
163
167
|
"buttonText": string;
|
164
168
|
};
|
165
169
|
}
|
170
|
+
export interface QuoteMap {
|
171
|
+
[messageId: string]: {
|
172
|
+
/**
|
173
|
+
* The body of the message
|
174
|
+
*/
|
175
|
+
body: string;
|
176
|
+
/**
|
177
|
+
* The message ID of the message that was quoted. Null if no message was quoted.
|
178
|
+
*/
|
179
|
+
quotes?: MessageId;
|
180
|
+
};
|
181
|
+
}
|
182
|
+
export interface MessageInfoInteraction {
|
183
|
+
/**
|
184
|
+
* The contact ID of the contact that interacted with the message.
|
185
|
+
*/
|
186
|
+
id: ContactId;
|
187
|
+
/**
|
188
|
+
* The timestamp of the interaction. You have to x 1000 to use in a JS Date object.
|
189
|
+
*/
|
190
|
+
t: number;
|
191
|
+
}
|
192
|
+
export interface MessageInfo {
|
193
|
+
deliveryRemaining: number;
|
194
|
+
playedRemaining: number;
|
195
|
+
readRemaining: number;
|
196
|
+
delivery: MessageInfoInteraction[];
|
197
|
+
read: MessageInfoInteraction[];
|
198
|
+
played: MessageInfoInteraction[];
|
199
|
+
/**
|
200
|
+
* The ID of the message
|
201
|
+
*/
|
202
|
+
id: MessageId;
|
203
|
+
}
|
166
204
|
/**
|
167
205
|
* Message types
|
168
206
|
* @readonly
|