@open-wa/wa-automate-types-only 4.51.5 → 4.54.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/Client.d.ts +34 -8
- package/dist/api/model/aliases.d.ts +5 -1
- package/dist/api/model/config.d.ts +5 -0
- package/dist/api/model/events.d.ts +4 -0
- package/dist/api/model/group-metadata.d.ts +29 -1
- package/dist/api/model/message.d.ts +86 -0
- package/dist/cli/integrations/chatwoot.d.ts +42 -0
- package/dist/cli/server.d.ts +2 -0
- package/dist/controllers/initializer.d.ts +1 -1
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -2,13 +2,13 @@
|
|
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, MessageInfo } from './model/message';
|
5
|
+
import { Message, MessageInfo, PollData } from './model/message';
|
6
6
|
import { AxiosRequestConfig } from 'axios';
|
7
|
-
import { ParticipantChangedEventModel } from './model/group-metadata';
|
7
|
+
import { NewCommunityGroup, ParticipantChangedEventModel } from './model/group-metadata';
|
8
8
|
import { ConfigObject, STATE, LicenseType, Webhook, EventPayload } from './model';
|
9
9
|
import PQueue, { DefaultAddOptions, Options } from 'p-queue';
|
10
10
|
import { HealthCheck, SessionInfo } from './model/sessionInfo';
|
11
|
-
import { ChatId, GroupChatId, Content, Base64, MessageId, ContactId, DataURL, AdvancedFile } from './model/aliases';
|
11
|
+
import { ChatId, GroupChatId, Content, Base64, MessageId, ContactId, DataURL, AdvancedFile, GroupId } from './model/aliases';
|
12
12
|
import { CustomProduct, Order, Product } from './model/product';
|
13
13
|
import { Label } from './model/label';
|
14
14
|
import { Mp4StickerConversionProcessOptions, StickerMetadata } from './model/media';
|
@@ -40,6 +40,7 @@ export declare class Client {
|
|
40
40
|
private _currentlyBeingKilled;
|
41
41
|
private _refreshing;
|
42
42
|
private _loaded;
|
43
|
+
private _hostAccountNumber;
|
43
44
|
private _prio;
|
44
45
|
private _pageListeners;
|
45
46
|
private _registeredPageListeners;
|
@@ -184,6 +185,13 @@ export declare class Client {
|
|
184
185
|
* @fires [[Message]]
|
185
186
|
*/
|
186
187
|
onButton(fn: (message: Message) => void): Promise<Listener | boolean>;
|
188
|
+
/**
|
189
|
+
* Listens to poll vote events
|
190
|
+
* @event
|
191
|
+
* @param fn callback
|
192
|
+
* @fires [[PollData]]
|
193
|
+
*/
|
194
|
+
onPollVote(fn: (pollDate: PollData) => void): Promise<Listener | boolean>;
|
187
195
|
/**
|
188
196
|
* Listens to broadcast messages
|
189
197
|
* @event
|
@@ -729,7 +737,7 @@ export declare class Client {
|
|
729
737
|
* @param quotedMsgId string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
|
730
738
|
* @returns `Promise <boolean | string>` This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
|
731
739
|
*/
|
732
|
-
sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId
|
740
|
+
sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId?: MessageId): Promise<MessageId>;
|
733
741
|
/**
|
734
742
|
* Send an audio file with the default audio player (not PTT/voice message)
|
735
743
|
* @param to chat id `xxxxx@c.us`
|
@@ -1421,6 +1429,18 @@ export declare class Client {
|
|
1421
1429
|
* @param contacts: A single contact id or an array of contact ids.
|
1422
1430
|
*/
|
1423
1431
|
createGroup(groupName: string, contacts: ContactId | ContactId[]): Promise<GroupChatCreationResponse>;
|
1432
|
+
/**
|
1433
|
+
* {@license:insiders@}
|
1434
|
+
*
|
1435
|
+
* Create a new community
|
1436
|
+
*
|
1437
|
+
* @param communityName The community name
|
1438
|
+
* @param communitySubject: The community subject line
|
1439
|
+
* @param icon DataURL of a 1:1 ratio jpeg for the community icon
|
1440
|
+
* @param existingGroups An array of existing group IDs, that are not already part of a community, to add to this new community.
|
1441
|
+
* @param newGroups An array of new group objects that
|
1442
|
+
*/
|
1443
|
+
createCommunity(communityName: string, communitySubject: string, icon: DataURL, existingGroups?: GroupChatId[], newGroups?: NewCommunityGroup[]): Promise<GroupId>;
|
1424
1444
|
/**
|
1425
1445
|
* Remove participant of Group
|
1426
1446
|
*
|
@@ -1561,6 +1581,12 @@ export declare class Client {
|
|
1561
1581
|
* @param messageId The message id
|
1562
1582
|
*/
|
1563
1583
|
getMessageReaders(messageId: MessageId): Promise<Contact[]>;
|
1584
|
+
/**
|
1585
|
+
* Returns poll data including results and votes.
|
1586
|
+
*
|
1587
|
+
* @param messageId The message id of the Poll
|
1588
|
+
*/
|
1589
|
+
getPollData(messageId: MessageId): Promise<PollData>;
|
1564
1590
|
/**
|
1565
1591
|
* Sends a sticker (including GIF) from a given URL
|
1566
1592
|
* @param to: The recipient id.
|
@@ -1713,7 +1739,7 @@ export declare class Client {
|
|
1713
1739
|
* @deprecated
|
1714
1740
|
* Alias for deleteStory
|
1715
1741
|
*/
|
1716
|
-
deleteStatus
|
1742
|
+
deleteStatus(statusesToDelete: string | string[]): Promise<boolean>;
|
1717
1743
|
/**
|
1718
1744
|
* {@license:restricted@}
|
1719
1745
|
*
|
@@ -1725,7 +1751,7 @@ export declare class Client {
|
|
1725
1751
|
* @deprecated
|
1726
1752
|
* Alias for deleteStory
|
1727
1753
|
*/
|
1728
|
-
deleteAllStatus
|
1754
|
+
deleteAllStatus(): Promise<boolean>;
|
1729
1755
|
/**
|
1730
1756
|
* {@license:restricted@}
|
1731
1757
|
*
|
@@ -1738,7 +1764,7 @@ export declare class Client {
|
|
1738
1764
|
* @deprecated
|
1739
1765
|
* Alias for deleteStory
|
1740
1766
|
*/
|
1741
|
-
getMyStatusArray
|
1767
|
+
getMyStatusArray(): Promise<Message[]>;
|
1742
1768
|
/**
|
1743
1769
|
* {@license:restricted@}
|
1744
1770
|
*
|
@@ -1889,7 +1915,7 @@ export declare class Client {
|
|
1889
1915
|
*
|
1890
1916
|
* For example, if you have a session with id `host` if you set useSessionIdInPath to true, then all requests will need to be prefixed with the path `host`. E.g `localhost:8082/sendText` becomes `localhost:8082/host/sendText`
|
1891
1917
|
*/
|
1892
|
-
middleware: (useSessionIdInPath?: boolean) => (req: Request, res: Response, next: NextFunction) => Promise<any>;
|
1918
|
+
middleware: (useSessionIdInPath?: boolean, PORT?: number) => (req: Request, res: Response, next: NextFunction) => Promise<any>;
|
1893
1919
|
/**
|
1894
1920
|
* Retreives an array of webhook objects
|
1895
1921
|
*/
|
@@ -21,6 +21,10 @@ export type CountryCode = 1 | 7 | 20 | 27 | 30 | 31 | 32 | 33 | 34 | 36 | 39 | 4
|
|
21
21
|
* The account number. It is made up of a country code and then the local number without the preceeding 0. For example, if a UK (+44) wa account is linked to the number 07123456789 then the account number will be 447123456789.
|
22
22
|
*/
|
23
23
|
export type AccountNumber = `${number}`;
|
24
|
+
/**
|
25
|
+
* A new group or community has the format of a random number followed by `@g.us`
|
26
|
+
*/
|
27
|
+
export type GroupId = `${number}@${GroupChatServer}`;
|
24
28
|
/**
|
25
29
|
* A group chat ends with `@g.us` and usually has two parts, the timestamp of when it was created, and the user id of the number that created the group. For example `[creator number]-[timestamp]@g.us`
|
26
30
|
*
|
@@ -28,7 +32,7 @@ export type AccountNumber = `${number}`;
|
|
28
32
|
*
|
29
33
|
* `"447123456789-1445627445@g.us"`
|
30
34
|
*/
|
31
|
-
export type GroupChatId = `${AccountNumber}-${number}@${GroupChatServer}` |
|
35
|
+
export type GroupChatId = `${AccountNumber}-${number}@${GroupChatServer}` | GroupId;
|
32
36
|
/**
|
33
37
|
* A contact id ends with `@c.us` and only contains the number of the contact. For example, if the country code of a contact is `44` and their number is `7123456789` then the contact id would be `447123456789@c.us`
|
34
38
|
*
|
@@ -387,6 +387,11 @@ export interface ConfigObject {
|
|
387
387
|
* @default `60`
|
388
388
|
*/
|
389
389
|
authTimeout?: number;
|
390
|
+
/**
|
391
|
+
* phoneIsOutOfReach check timeout
|
392
|
+
* @default `60`
|
393
|
+
*/
|
394
|
+
oorTimeout?: number;
|
390
395
|
/**
|
391
396
|
* Setting this to `true` will kill the whole process when the client is disconnected from the page or if the browser is closed.
|
392
397
|
* @default `false`
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChatId, ContactId, GroupChatId, NonSerializedId } from './aliases';
|
1
|
+
import { ChatId, ContactId, GroupChatId, NonSerializedId, DataURL, GroupId } from './aliases';
|
2
2
|
export interface Participant {
|
3
3
|
id: NonSerializedId;
|
4
4
|
isAdmin: boolean;
|
@@ -45,6 +45,26 @@ export interface GroupMetadata {
|
|
45
45
|
* Not sure what this represents
|
46
46
|
*/
|
47
47
|
support?: boolean;
|
48
|
+
/**
|
49
|
+
* Is this group a parent group (a.k.a community)
|
50
|
+
*/
|
51
|
+
isParentGroup?: boolean;
|
52
|
+
/**
|
53
|
+
* The type of group
|
54
|
+
*/
|
55
|
+
groupType: 'DEAFULT' | 'SUBGROUP' | 'COMMUNITY';
|
56
|
+
/**
|
57
|
+
* Communities have a default group chat
|
58
|
+
*/
|
59
|
+
defaultSubgroup: boolean;
|
60
|
+
/**
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
isParentGroupClosed: boolean;
|
64
|
+
/**
|
65
|
+
* List of Group IDs that the host account has joined as part of this community
|
66
|
+
*/
|
67
|
+
joinedSubgroups: GroupId[];
|
48
68
|
}
|
49
69
|
export declare enum groupChangeEvent {
|
50
70
|
remove = "remove",
|
@@ -72,3 +92,11 @@ export declare enum GroupNotificationTypes {
|
|
72
92
|
ANNOUNCE = "announce",
|
73
93
|
RESTRICT = "restrict"
|
74
94
|
}
|
95
|
+
/**
|
96
|
+
* Used when creating a new community with.
|
97
|
+
*/
|
98
|
+
export interface NewCommunityGroup {
|
99
|
+
subject: string;
|
100
|
+
icon?: DataURL;
|
101
|
+
ephemeralDuration?: number;
|
102
|
+
}
|
@@ -151,6 +151,24 @@ export interface Message {
|
|
151
151
|
deprecatedMms3Url: string;
|
152
152
|
quotedMsg?: Message;
|
153
153
|
quotedMsgObj?: Message;
|
154
|
+
/**
|
155
|
+
* When a user requests to join a group wihtin a community the request is received by the host as a message. This boolean will allow you to easily determine if the incoming message is a request to join a group.
|
156
|
+
*
|
157
|
+
* If this is `true` then you need to determine within your own code whether or not to accept the user to the group which is indicated with `quotedRemoteJid` using `addParticipant`.
|
158
|
+
*/
|
159
|
+
isGroupJoinRequest?: boolean;
|
160
|
+
/**
|
161
|
+
* The ID of the message sender
|
162
|
+
*/
|
163
|
+
senderId?: string;
|
164
|
+
/**
|
165
|
+
* The ID of the quoted group. Usually present when a user is requesting to join a group.
|
166
|
+
*/
|
167
|
+
quotedRemoteJid?: string;
|
168
|
+
/**
|
169
|
+
* The parent group ID (community ID - communities are just groups made up of other groups) of the group represented by `quotedRemoteJid`
|
170
|
+
*/
|
171
|
+
quotedParentGroupJid?: string;
|
154
172
|
mediaData: unknown;
|
155
173
|
shareDuration: number;
|
156
174
|
isAnimated: boolean;
|
@@ -189,6 +207,74 @@ export interface Message {
|
|
189
207
|
"description": string;
|
190
208
|
"buttonText": string;
|
191
209
|
};
|
210
|
+
/**
|
211
|
+
* The options of a poll
|
212
|
+
*/
|
213
|
+
pollOptions?: PollOption[];
|
214
|
+
}
|
215
|
+
export interface PollOption {
|
216
|
+
name: string;
|
217
|
+
localId: number;
|
218
|
+
}
|
219
|
+
export interface PollData {
|
220
|
+
/**
|
221
|
+
* The total amount of votes recorded so far
|
222
|
+
*/
|
223
|
+
totalVotes: number;
|
224
|
+
/**
|
225
|
+
* The poll options and their respective count of votes.
|
226
|
+
*/
|
227
|
+
pollOptions: (PollOption & {
|
228
|
+
count: number;
|
229
|
+
})[];
|
230
|
+
/**
|
231
|
+
* An arrray of vote objects
|
232
|
+
*/
|
233
|
+
votes: PollVote[];
|
234
|
+
/**
|
235
|
+
* The message object of the poll
|
236
|
+
*/
|
237
|
+
pollMessage: Message;
|
238
|
+
}
|
239
|
+
export interface PollVote {
|
240
|
+
ack: number;
|
241
|
+
/**
|
242
|
+
* The message ID of this vote. For some reason this is different from the msgKey and includes exclamaition marks.
|
243
|
+
*/
|
244
|
+
id: string;
|
245
|
+
/**
|
246
|
+
* The message key of this vote
|
247
|
+
*/
|
248
|
+
msgKey: string;
|
249
|
+
/**
|
250
|
+
* The Message ID of the original Poll message
|
251
|
+
*/
|
252
|
+
parentMsgKey: string;
|
253
|
+
/**
|
254
|
+
* The original poll options available on the poll
|
255
|
+
*/
|
256
|
+
pollOptions: PollOption[];
|
257
|
+
/**
|
258
|
+
* The selected option IDs of the voter
|
259
|
+
*/
|
260
|
+
selectedOptionLocalIds: number[];
|
261
|
+
/**
|
262
|
+
* The selected option values by this voter
|
263
|
+
*/
|
264
|
+
selectedOptionValues: string[];
|
265
|
+
/**
|
266
|
+
* The contact ID of the voter
|
267
|
+
*/
|
268
|
+
sender: ContactId;
|
269
|
+
/**
|
270
|
+
* The contact object of the voter
|
271
|
+
*/
|
272
|
+
senderObj: Contact;
|
273
|
+
/**
|
274
|
+
* Timestamp of the vote
|
275
|
+
*/
|
276
|
+
senderTimestampMs: number;
|
277
|
+
stale: boolean;
|
192
278
|
}
|
193
279
|
export interface QuoteMap {
|
194
280
|
[messageId: string]: {
|
@@ -5,3 +5,45 @@ export declare const chatwoot_webhook_check_event_name = "cli.integrations.chatw
|
|
5
5
|
export type expressMiddleware = (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
|
6
6
|
export declare const chatwootMiddleware: (cliConfig: cliFlags, client: Client) => expressMiddleware;
|
7
7
|
export declare const setupChatwootOutgoingMessageHandler: (cliConfig: cliFlags, client: Client) => Promise<void>;
|
8
|
+
export type ChatwootConfig = {
|
9
|
+
/**
|
10
|
+
* The URL of the chatwoot inbox. If you want this integration to create & manage the inbox for you, you can omit the inbox part.
|
11
|
+
*/
|
12
|
+
chatwootUrl: string;
|
13
|
+
/**
|
14
|
+
* The API access token which you can get from your account menu.
|
15
|
+
*/
|
16
|
+
chatwootApiAccessToken: string;
|
17
|
+
/**
|
18
|
+
* The API host which will be used as the webhook address in the Chatwoot inbox.
|
19
|
+
*/
|
20
|
+
apiHost: string;
|
21
|
+
/**
|
22
|
+
* Similar to apiHost
|
23
|
+
*/
|
24
|
+
host: string;
|
25
|
+
/**
|
26
|
+
* Whether or not to use https for the webhook address
|
27
|
+
*/
|
28
|
+
https?: boolean;
|
29
|
+
/**
|
30
|
+
* The certificate for https
|
31
|
+
*/
|
32
|
+
cert: string;
|
33
|
+
/**
|
34
|
+
* The private key for https
|
35
|
+
*/
|
36
|
+
privkey: string;
|
37
|
+
/**
|
38
|
+
* The API key used to secure the instance webhook address
|
39
|
+
*/
|
40
|
+
key?: string;
|
41
|
+
/**
|
42
|
+
* Whether or not to update the webhook address in the Chatwoot inbox on launch
|
43
|
+
*/
|
44
|
+
forceUpdateCwWebhook?: boolean;
|
45
|
+
/**
|
46
|
+
* port
|
47
|
+
*/
|
48
|
+
port: number;
|
49
|
+
};
|
package/dist/cli/server.d.ts
CHANGED
@@ -13,9 +13,11 @@ export declare const setupAuthenticationLayer: (cliConfig: cliFlags) => void;
|
|
13
13
|
export declare const setupApiDocs: (cliConfig: cliFlags) => void;
|
14
14
|
export declare const setupSwaggerStatsMiddleware: (cliConfig: cliFlags) => Promise<void>;
|
15
15
|
export declare const setupRefocusDisengageMiddleware: (cliConfig: cliFlags) => void;
|
16
|
+
export declare const setupMetaProcessMiddleware: (client: Client, cliConfig: any) => void;
|
16
17
|
export declare const getCommands: () => any;
|
17
18
|
export declare const listListeners: () => string[];
|
18
19
|
export declare const setupMediaMiddleware: () => void;
|
20
|
+
export declare const setupTunnel: (cliConfig: any, tunnelCode: string, PORT: number) => Promise<string>;
|
19
21
|
export declare const setupTwilioCompatibleWebhook: (cliConfig: cliFlags, client: Client) => void;
|
20
22
|
export declare const setupChatwoot: (cliConfig: cliFlags, client: Client) => void;
|
21
23
|
export declare const setupBotPressHandler: (cliConfig: cliFlags, client: Client) => void;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Client } from '../api/Client';
|
2
2
|
import { AdvancedConfig, ConfigObject } from '../api/model/index';
|
3
|
-
export declare const pkg: any, configWithCases: any, timeout: (ms: number) => Promise<
|
3
|
+
export declare const pkg: any, configWithCases: any, timeout: (ms: number) => Promise<string>;
|
4
4
|
export declare let screenshot: any;
|
5
5
|
/**
|
6
6
|
* Used to initialize the client session.
|