@open-wa/wa-automate 4.54.6 → 4.55.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/config-schema.json +1 -1
- package/bin/oas-type-schemas.json +1 -1
- package/dist/api/Client.d.ts +18 -2
- package/dist/api/Client.js +21 -1
- package/dist/api/model/config.d.ts +5 -0
- package/dist/api/model/events.d.ts +6 -1
- package/dist/api/model/events.js +5 -0
- package/dist/api/model/group-metadata.d.ts +23 -1
- package/dist/cli/integrations/chatwoot.d.ts +42 -0
- package/dist/cli/integrations/chatwoot.js +515 -302
- package/dist/controllers/initializer.d.ts +1 -1
- package/dist/controllers/initializer.js +4 -1
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatC
|
|
4
4
|
import { Contact, NumberCheck } from './model/contact';
|
5
5
|
import { Message, MessageInfo, PollData } from './model/message';
|
6
6
|
import { AxiosRequestConfig } from 'axios';
|
7
|
-
import { NewCommunityGroup, ParticipantChangedEventModel } from './model/group-metadata';
|
7
|
+
import { NewCommunityGroup, ParticipantChangedEventModel, GenericGroupChangeEvent } 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';
|
@@ -200,8 +200,16 @@ export declare class Client {
|
|
200
200
|
*/
|
201
201
|
onBroadcast(fn: (message: Message) => void): Promise<Listener | boolean>;
|
202
202
|
/**
|
203
|
+
* @deprecated
|
204
|
+
*
|
203
205
|
* Listens to battery changes
|
204
206
|
*
|
207
|
+
* :::caution
|
208
|
+
*
|
209
|
+
* This will most likely not work with multi-device mode (the only remaining mode) since the session is no longer connected to the phone but directly to WA servers.
|
210
|
+
*
|
211
|
+
* :::
|
212
|
+
*
|
205
213
|
* @event
|
206
214
|
* @param fn callback
|
207
215
|
* @fires number
|
@@ -316,6 +324,14 @@ export declare class Client {
|
|
316
324
|
* @returns `true` if the callback was registered
|
317
325
|
*/
|
318
326
|
onGlobalParticipantsChanged(fn: (participantChangedEvent: ParticipantChangedEventModel) => void): Promise<Listener | boolean>;
|
327
|
+
/**
|
328
|
+
* Listens to all group (gp2) events. This can be useful if you want to catch when a group title, subject or picture is changed.
|
329
|
+
*
|
330
|
+
* @event
|
331
|
+
* @param fn callback function that handles a [[ParticipantChangedEventModel]] as the first and only parameter.
|
332
|
+
* @returns `true` if the callback was registered
|
333
|
+
*/
|
334
|
+
onGroupChange(fn: (genericGroupChangeEvent: GenericGroupChangeEvent) => void): Promise<Listener | boolean>;
|
319
335
|
/**
|
320
336
|
* Fires callback with Chat object every time the host phone is added to a group.
|
321
337
|
*
|
@@ -737,7 +753,7 @@ export declare class Client {
|
|
737
753
|
* @param quotedMsgId string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
|
738
754
|
* @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
|
739
755
|
*/
|
740
|
-
sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId
|
756
|
+
sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId?: MessageId): Promise<MessageId>;
|
741
757
|
/**
|
742
758
|
* Send an audio file with the default audio player (not PTT/voice message)
|
743
759
|
* @param to chat id `xxxxx@c.us`
|
package/dist/api/Client.js
CHANGED
@@ -864,8 +864,16 @@ class Client {
|
|
864
864
|
});
|
865
865
|
}
|
866
866
|
/**
|
867
|
+
* @deprecated
|
868
|
+
*
|
867
869
|
* Listens to battery changes
|
868
870
|
*
|
871
|
+
* :::caution
|
872
|
+
*
|
873
|
+
* This will most likely not work with multi-device mode (the only remaining mode) since the session is no longer connected to the phone but directly to WA servers.
|
874
|
+
*
|
875
|
+
* :::
|
876
|
+
*
|
869
877
|
* @event
|
870
878
|
* @param fn callback
|
871
879
|
* @fires number
|
@@ -1033,6 +1041,18 @@ class Client {
|
|
1033
1041
|
return this.registerListener(events_2.SimpleListener.GlobalParticipantsChanged, fn);
|
1034
1042
|
});
|
1035
1043
|
}
|
1044
|
+
/**
|
1045
|
+
* Listens to all group (gp2) events. This can be useful if you want to catch when a group title, subject or picture is changed.
|
1046
|
+
*
|
1047
|
+
* @event
|
1048
|
+
* @param fn callback function that handles a [[ParticipantChangedEventModel]] as the first and only parameter.
|
1049
|
+
* @returns `true` if the callback was registered
|
1050
|
+
*/
|
1051
|
+
onGroupChange(fn) {
|
1052
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1053
|
+
return this.registerListener(events_2.SimpleListener.GroupChange, fn);
|
1054
|
+
});
|
1055
|
+
}
|
1036
1056
|
/**
|
1037
1057
|
* Fires callback with Chat object every time the host phone is added to a group.
|
1038
1058
|
*
|
@@ -1847,7 +1867,7 @@ class Client {
|
|
1847
1867
|
*/
|
1848
1868
|
sendPtt(to, file, quotedMsgId) {
|
1849
1869
|
return __awaiter(this, void 0, void 0, function* () {
|
1850
|
-
return this.sendImage(to, file, 'ptt.ogg', '', quotedMsgId, true, true);
|
1870
|
+
return this.sendImage(to, file, 'ptt.ogg', '', quotedMsgId ? quotedMsgId : null, true, true);
|
1851
1871
|
});
|
1852
1872
|
}
|
1853
1873
|
/**
|
@@ -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`
|
@@ -107,5 +107,10 @@ export declare enum SimpleListener {
|
|
107
107
|
* Requires licence
|
108
108
|
* Represents [[onReaction]]
|
109
109
|
*/
|
110
|
-
Reaction = "onReaction"
|
110
|
+
Reaction = "onReaction",
|
111
|
+
/**
|
112
|
+
* Requires licence
|
113
|
+
* Represents [[onGroupChange]]
|
114
|
+
*/
|
115
|
+
GroupChange = "onGroupChange"
|
111
116
|
}
|
package/dist/api/model/events.js
CHANGED
@@ -115,4 +115,9 @@ var SimpleListener;
|
|
115
115
|
* Represents [[onReaction]]
|
116
116
|
*/
|
117
117
|
SimpleListener["Reaction"] = "onReaction";
|
118
|
+
/**
|
119
|
+
* Requires licence
|
120
|
+
* Represents [[onGroupChange]]
|
121
|
+
*/
|
122
|
+
SimpleListener["GroupChange"] = "onGroupChange";
|
118
123
|
})(SimpleListener = exports.SimpleListener || (exports.SimpleListener = {}));
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import { ChatId, ContactId, GroupChatId, NonSerializedId, DataURL, GroupId } from './aliases';
|
1
|
+
import { ChatId, ContactId, GroupChatId, NonSerializedId, DataURL, GroupId, MessageId } from './aliases';
|
2
|
+
import { Contact } from './contact';
|
2
3
|
export interface Participant {
|
4
|
+
contact: Contact;
|
3
5
|
id: NonSerializedId;
|
4
6
|
isAdmin: boolean;
|
5
7
|
isSuperAdmin: boolean;
|
@@ -100,3 +102,23 @@ export interface NewCommunityGroup {
|
|
100
102
|
icon?: DataURL;
|
101
103
|
ephemeralDuration?: number;
|
102
104
|
}
|
105
|
+
export interface GenericGroupChangeEvent {
|
106
|
+
/**
|
107
|
+
* The contact who triggered this event. (E.g the contact who changed the group picture)
|
108
|
+
*/
|
109
|
+
author: Contact;
|
110
|
+
/**
|
111
|
+
* Some more information about the event
|
112
|
+
*/
|
113
|
+
body: string;
|
114
|
+
groupMetadata: GroupMetadata;
|
115
|
+
/**
|
116
|
+
* Base 64 encoded image
|
117
|
+
*/
|
118
|
+
groupPic: string;
|
119
|
+
id: MessageId;
|
120
|
+
/**
|
121
|
+
* Type of the event
|
122
|
+
*/
|
123
|
+
type: 'picutre' | 'create' | 'delete' | 'subject' | 'revoke_invite' | 'description' | 'restrict' | 'announce' | 'no_frequently_forwarded' | 'announce_msg_bounce' | 'add' | 'remove' | 'demote' | 'promote' | 'invite' | 'leave' | 'modify' | 'v4_add_invite_sent' | 'v4_add_invite_join' | 'growth_locked' | 'growth_unlocked' | 'linked_group_join';
|
124
|
+
}
|
@@ -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
|
+
};
|