@open-wa/wa-automate 4.54.5 → 4.55.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -737,7 +737,7 @@ export declare class Client {
737
737
  * @param quotedMsgId string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
738
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
739
739
  */
740
- sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId: MessageId): Promise<MessageId>;
740
+ sendPtt(to: ChatId, file: AdvancedFile, quotedMsgId?: MessageId): Promise<MessageId>;
741
741
  /**
742
742
  * Send an audio file with the default audio player (not PTT/voice message)
743
743
  * @param to chat id `xxxxx@c.us`
@@ -1847,7 +1847,7 @@ class Client {
1847
1847
  */
1848
1848
  sendPtt(to, file, quotedMsgId) {
1849
1849
  return __awaiter(this, void 0, void 0, function* () {
1850
- return this.sendImage(to, file, 'ptt.ogg', '', quotedMsgId, true, true);
1850
+ return this.sendImage(to, file, 'ptt.ogg', '', quotedMsgId ? quotedMsgId : null, true, true);
1851
1851
  });
1852
1852
  }
1853
1853
  /**
@@ -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`
package/dist/cli/index.js CHANGED
@@ -20,7 +20,6 @@ const axios_1 = __importDefault(require("axios"));
20
20
  const setup_1 = require("./setup");
21
21
  const collections_1 = require("./collections");
22
22
  const server_1 = require("./server");
23
- const localtunnel_1 = __importDefault(require("localtunnel"));
24
23
  const chatwoot_1 = require("./integrations/chatwoot");
25
24
  let checkUrl = (s) => (typeof s === "string") && (0, is_url_superb_1.default)(s);
26
25
  const ready = (config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -105,6 +104,7 @@ function start() {
105
104
  }
106
105
  try {
107
106
  const client = yield (0, index_1.create)(Object.assign({}, createConfig));
107
+ (0, server_1.setupMetaProcessMiddleware)(client, cliConfig);
108
108
  yield (0, server_1.setupHttpServer)(cliConfig);
109
109
  if (cliConfig.autoReject) {
110
110
  yield client.autoReject(cliConfig.onCall);
@@ -201,13 +201,8 @@ function start() {
201
201
  });
202
202
  if (cliConfig.tunnel) {
203
203
  spinner.info(`\n• Setting up external tunnel`);
204
- const tunnel = yield (0, localtunnel_1.default)({
205
- port: PORT,
206
- host: process.env.WA_TUNNEL_SERVER || "https://public.openwa.cloud",
207
- subdomain: yield client.getTunnelCode()
208
- });
209
- cliConfig.apiHost = cliConfig.tunnel = tunnel.url;
210
- spinner.succeed(`\n\t${(0, terminal_link_1.default)('External address', tunnel.url)}`);
204
+ const tunnelUrl = yield (0, server_1.setupTunnel)(cliConfig, yield client.getTunnelCode(), PORT);
205
+ spinner.succeed(`\n\t${(0, terminal_link_1.default)('External address', tunnelUrl)}`);
211
206
  }
212
207
  const apiDocsUrl = cliConfig.apiHost ? `${cliConfig.apiHost}/api-docs/ ` : `${cliConfig.host.includes('http') ? '' : 'http://'}${cliConfig.host}:${PORT}/api-docs/ `;
213
208
  const link = (0, terminal_link_1.default)('API Explorer', apiDocsUrl);
@@ -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
+ };