@open-wa/wa-automate 4.76.0 → 5.0.0-alpha.2
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/README.md +14 -165
- package/dist/cli-runtime-B7_3MM0c.cjs +798 -0
- package/dist/cli-runtime-B7_3MM0c.cjs.map +1 -0
- package/dist/cli-runtime-CmpYxFCk.d.cts +31 -0
- package/dist/cli-runtime-CmpYxFCk.d.cts.map +1 -0
- package/dist/cli.cjs +17 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/index.cjs +224 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +81 -0
- package/dist/index.d.cts.map +1 -0
- package/package.json +34 -177
- package/CNAME +0 -1
- package/_tsconfig.docs.json +0 -140
- package/bin/config-schema.json +0 -1
- package/bin/oas-type-schemas.json +0 -1
- package/bin/server.js +0 -45
- package/build/build-config-json-for-bin.ts +0 -56
- package/build/generate-oas-types.ts +0 -31
- package/dist/api/Client.d.ts +0 -2255
- package/dist/api/Client.js +0 -4358
- package/dist/api/functions/exposed.enum.d.ts +0 -7
- package/dist/api/functions/exposed.enum.js +0 -11
- package/dist/api/model/aliases.d.ts +0 -110
- package/dist/api/model/aliases.js +0 -3
- package/dist/api/model/button.d.ts +0 -24
- package/dist/api/model/button.js +0 -2
- package/dist/api/model/call.d.ts +0 -51
- package/dist/api/model/call.js +0 -18
- package/dist/api/model/chat.d.ts +0 -221
- package/dist/api/model/chat.js +0 -52
- package/dist/api/model/config.d.ts +0 -836
- package/dist/api/model/config.js +0 -111
- package/dist/api/model/contact.d.ts +0 -143
- package/dist/api/model/contact.js +0 -2
- package/dist/api/model/errors.d.ts +0 -90
- package/dist/api/model/errors.js +0 -117
- package/dist/api/model/events.d.ts +0 -120
- package/dist/api/model/events.js +0 -127
- package/dist/api/model/group-metadata.d.ts +0 -124
- package/dist/api/model/group-metadata.js +0 -25
- package/dist/api/model/id.d.ts +0 -5
- package/dist/api/model/id.js +0 -2
- package/dist/api/model/index.d.ts +0 -110
- package/dist/api/model/index.js +0 -128
- package/dist/api/model/label.d.ts +0 -24
- package/dist/api/model/label.js +0 -2
- package/dist/api/model/media.d.ts +0 -93
- package/dist/api/model/media.js +0 -12
- package/dist/api/model/message.d.ts +0 -422
- package/dist/api/model/message.js +0 -40
- package/dist/api/model/product.d.ts +0 -141
- package/dist/api/model/product.js +0 -2
- package/dist/api/model/reactions.d.ts +0 -76
- package/dist/api/model/reactions.js +0 -2
- package/dist/api/model/sessionInfo.d.ts +0 -77
- package/dist/api/model/sessionInfo.js +0 -2
- package/dist/build/build-postman.d.ts +0 -1
- package/dist/build/build-postman.js +0 -262
- package/dist/cli/cli-options.d.ts +0 -9
- package/dist/cli/cli-options.js +0 -289
- package/dist/cli/collections.d.ts +0 -2
- package/dist/cli/collections.js +0 -251
- package/dist/cli/file-utils.d.ts +0 -1
- package/dist/cli/file-utils.js +0 -71
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -231
- package/dist/cli/integrations/chatwoot.d.ts +0 -49
- package/dist/cli/integrations/chatwoot.js +0 -672
- package/dist/cli/integrations/cloudflare.d.ts +0 -6
- package/dist/cli/integrations/cloudflare.js +0 -76
- package/dist/cli/logo.d.ts +0 -1
- package/dist/cli/logo.js +0 -49
- package/dist/cli/server.d.ts +0 -24
- package/dist/cli/server.js +0 -540
- package/dist/cli/setup.d.ts +0 -30
- package/dist/cli/setup.js +0 -308
- package/dist/config/puppeteer.config.d.ts +0 -11
- package/dist/config/puppeteer.config.js +0 -65
- package/dist/controllers/auth.d.ts +0 -36
- package/dist/controllers/auth.js +0 -322
- package/dist/controllers/browser.d.ts +0 -17
- package/dist/controllers/browser.js +0 -603
- package/dist/controllers/events.d.ts +0 -82
- package/dist/controllers/events.js +0 -173
- package/dist/controllers/init_patch.d.ts +0 -13
- package/dist/controllers/init_patch.js +0 -42
- package/dist/controllers/initializer.d.ts +0 -22
- package/dist/controllers/initializer.js +0 -511
- package/dist/controllers/launch_checks.d.ts +0 -8
- package/dist/controllers/launch_checks.js +0 -130
- package/dist/controllers/patch_manager.d.ts +0 -37
- package/dist/controllers/patch_manager.js +0 -231
- package/dist/controllers/popup/index.d.ts +0 -3
- package/dist/controllers/popup/index.html +0 -168
- package/dist/controllers/popup/index.js +0 -148
- package/dist/controllers/script_preloader.d.ts +0 -17
- package/dist/controllers/script_preloader.js +0 -88
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -36
- package/dist/lib/README.md +0 -5
- package/dist/lib/base64.js +0 -1
- package/dist/lib/hash.js +0 -1
- package/dist/lib/jsSha.min.js +0 -1
- package/dist/lib/launch.js +0 -1
- package/dist/lib/qr.min.js +0 -1
- package/dist/lib/wapi.js +0 -2163
- package/dist/logging/custom_transport.d.ts +0 -9
- package/dist/logging/custom_transport.js +0 -35
- package/dist/logging/logging.d.ts +0 -50
- package/dist/logging/logging.js +0 -196
- package/dist/structures/Collector.d.ts +0 -202
- package/dist/structures/Collector.js +0 -391
- package/dist/structures/Dialog.d.ts +0 -55
- package/dist/structures/Dialog.js +0 -21
- package/dist/structures/MessageCollector.d.ts +0 -78
- package/dist/structures/MessageCollector.js +0 -145
- package/dist/structures/preProcessors.d.ts +0 -58
- package/dist/structures/preProcessors.js +0 -181
- package/dist/utils/pid_utils.d.ts +0 -1
- package/dist/utils/pid_utils.js +0 -26
- package/dist/utils/tools.d.ts +0 -152
- package/dist/utils/tools.js +0 -494
- package/tos.md +0 -77
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { STATE } from '.';
|
|
2
|
-
export interface SessionInfo {
|
|
3
|
-
WA_VERSION: string;
|
|
4
|
-
PAGE_UA: string;
|
|
5
|
-
WA_AUTOMATE_VERSION: string;
|
|
6
|
-
BROWSER_VERSION: string;
|
|
7
|
-
LAUNCH_TIME_MS?: number;
|
|
8
|
-
NUM?: string;
|
|
9
|
-
OS?: string;
|
|
10
|
-
START_TS?: number;
|
|
11
|
-
PHONE_VERSION?: string;
|
|
12
|
-
NUM_HASH?: string;
|
|
13
|
-
PATCH_HASH?: string;
|
|
14
|
-
OW_KEY?: string;
|
|
15
|
-
INSTANCE_ID?: string;
|
|
16
|
-
RAM_INFO?: string;
|
|
17
|
-
PPTR_VERSION?: string;
|
|
18
|
-
LATEST_VERSION?: boolean;
|
|
19
|
-
CLI?: boolean;
|
|
20
|
-
ACC_TYPE?: 'PERSONAL' | 'BUSINESS';
|
|
21
|
-
}
|
|
22
|
-
export interface HealthCheck {
|
|
23
|
-
/**
|
|
24
|
-
* The number of messages queued up in the browser. Messages can start being queued up due to the web app awaiting a connection with the host device.
|
|
25
|
-
*
|
|
26
|
-
* Healthy: 0
|
|
27
|
-
*/
|
|
28
|
-
queuedMessages?: number;
|
|
29
|
-
/**
|
|
30
|
-
* The state of the web app.
|
|
31
|
-
*
|
|
32
|
-
* Healthy: 'CONNECTED'
|
|
33
|
-
*/
|
|
34
|
-
state?: STATE;
|
|
35
|
-
/**
|
|
36
|
-
* Whether or not the "Phone is disconnected" message is showing within the web app.
|
|
37
|
-
*
|
|
38
|
-
* Healthy: `false`
|
|
39
|
-
*/
|
|
40
|
-
isPhoneDisconnected?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Returns `true` if "Use Here" button is not detected
|
|
43
|
-
*
|
|
44
|
-
* Healthy: `true`
|
|
45
|
-
*/
|
|
46
|
-
isHere?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Returns `true` if the `WAPI` object is detected.
|
|
49
|
-
*
|
|
50
|
-
* Healthy: `true`
|
|
51
|
-
*/
|
|
52
|
-
wapiInjected?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Result of `window.navigator.onLine`
|
|
55
|
-
*
|
|
56
|
-
* Healthy: `true`
|
|
57
|
-
*/
|
|
58
|
-
online?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Returns `true` if "trying to reach phone" dialog is detected
|
|
61
|
-
*
|
|
62
|
-
* Healthy: `false`
|
|
63
|
-
*/
|
|
64
|
-
tryingToReachPhone?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Returns the number of seconds the "Retrying in ..." dialog is indicating. If the dialog is not showing, it will return `0`.
|
|
67
|
-
*
|
|
68
|
-
* Healthy: `0`
|
|
69
|
-
*/
|
|
70
|
-
retryingIn?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Returns `true` if "Phone battery low" message is detected
|
|
73
|
-
*
|
|
74
|
-
* Healthy: `false`
|
|
75
|
-
*/
|
|
76
|
-
batteryLow?: boolean;
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generatePostmanJson: (setup?: any) => Promise<any>;
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.generatePostmanJson = void 0;
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
40
|
-
const path = __importStar(require("path"));
|
|
41
|
-
const parse_url_1 = __importDefault(require("parse-url"));
|
|
42
|
-
let noCase;
|
|
43
|
-
const format = (s) => s === null || s === void 0 ? void 0 : s.replace(/[[/g,'').replace(/]]/g, '').replace(/@param/g, 'Parameter:');
|
|
44
|
-
const ignoredMethods = [
|
|
45
|
-
'pup',
|
|
46
|
-
'loaded',
|
|
47
|
-
'createMessageCollector',
|
|
48
|
-
'awaitMessages',
|
|
49
|
-
"logger"
|
|
50
|
-
];
|
|
51
|
-
const aliasExamples = {
|
|
52
|
-
"ChatId": "00000000000@c.us or 00000000000-111111111@g.us",
|
|
53
|
-
"GroupChatId": "00000000000-111111111@g.us",
|
|
54
|
-
"Content": 'Hello World!',
|
|
55
|
-
"DataURL": 'data:[<mediatype>][;base64],<data>',
|
|
56
|
-
"Base64": "Learn more here: https://developer.mozilla.org/en-US/docs/Glossary/Base64",
|
|
57
|
-
"MessageId": "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
|
|
58
|
-
"ContactId": "00000000000@c.us"
|
|
59
|
-
};
|
|
60
|
-
const paramNameExamples = {
|
|
61
|
-
"ChatId": "00000000000@c.us or 00000000000-111111111@g.us",
|
|
62
|
-
};
|
|
63
|
-
const primatives = [
|
|
64
|
-
'number',
|
|
65
|
-
'string',
|
|
66
|
-
'boolean'
|
|
67
|
-
];
|
|
68
|
-
function getMethodsWithDocs() {
|
|
69
|
-
var _a;
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const { Project } = yield Promise.resolve().then(() => __importStar(require("ts-morph")));
|
|
72
|
-
const project = new Project({
|
|
73
|
-
compilerOptions: {
|
|
74
|
-
target: 99,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
const res = [];
|
|
78
|
-
const fp = fs.existsSync(path.resolve(__dirname, '../api/Client.d.ts')) ? '../api/Client.d.ts' : '../api/Client.ts';
|
|
79
|
-
const sourceFile = project.addSourceFileAtPath(path.resolve(__dirname, fp));
|
|
80
|
-
for (const method of sourceFile.getClass('Client').getMethods()) {
|
|
81
|
-
if (!method.hasModifier(120)) {
|
|
82
|
-
res.push({
|
|
83
|
-
name: method.getName(),
|
|
84
|
-
parameters: method.getParameters().map(param => {
|
|
85
|
-
var _a, _b, _c, _d;
|
|
86
|
-
return {
|
|
87
|
-
name: param.getName(),
|
|
88
|
-
type: ((_a = param.getTypeNode()) === null || _a === void 0 ? void 0 : _a.getText()) || ((_d = (((_b = param.getType()) === null || _b === void 0 ? void 0 : _b.getAliasSymbol()) || ((_c = param.getType()) === null || _c === void 0 ? void 0 : _c.getSymbol()))) === null || _d === void 0 ? void 0 : _d.getEscapedName()),
|
|
89
|
-
isOptional: param.isOptional(),
|
|
90
|
-
};
|
|
91
|
-
}),
|
|
92
|
-
text: format((_a = method.getJsDocs()[0]) === null || _a === void 0 ? void 0 : _a.getInnerText())
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return res;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const generatePostmanJson = (setup = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
-
if (!noCase)
|
|
101
|
-
noCase = (yield Promise.resolve().then(() => __importStar(require("change-case")))).noCase;
|
|
102
|
-
if (setup === null || setup === void 0 ? void 0 : setup.apiHost) {
|
|
103
|
-
if (setup.apiHost.includes(setup.sessionId)) {
|
|
104
|
-
const parsed = (0, parse_url_1.default)(setup.apiHost);
|
|
105
|
-
setup.host = parsed.resource;
|
|
106
|
-
setup.port = parsed.port;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const s = yield getMethodsWithDocs();
|
|
110
|
-
const x = s.filter(({ visibility }) => visibility == 2 || visibility == undefined).filter(({ name }) => !name.startsWith('on')).filter(({ name }) => !ignoredMethods.includes(name)).map(method => (Object.assign({ text: s[method.name] || '' }, method)));
|
|
111
|
-
const postmanGen = postmanRequestGeneratorGenerator(setup);
|
|
112
|
-
const pm = x.map(postmanGen);
|
|
113
|
-
const postmanWrap = postmanWrapGen(setup);
|
|
114
|
-
const res = postmanWrap(pm);
|
|
115
|
-
if (!(setup === null || setup === void 0 ? void 0 : setup.skipSavePostmanCollection))
|
|
116
|
-
fs.writeFileSync(`./open-wa-${setup.sessionId}.postman_collection.json`, JSON.stringify(res));
|
|
117
|
-
return res;
|
|
118
|
-
});
|
|
119
|
-
exports.generatePostmanJson = generatePostmanJson;
|
|
120
|
-
function escape(key, val) {
|
|
121
|
-
if (typeof (val) != "string")
|
|
122
|
-
return val;
|
|
123
|
-
return val
|
|
124
|
-
.replace(/["]/g, '\\"')
|
|
125
|
-
.replace(/[\\]/g, '\\\\')
|
|
126
|
-
.replace(/[/]/g, '\\/')
|
|
127
|
-
.replace(/[\b]/g, '\\b')
|
|
128
|
-
.replace(/[\f]/g, '\\f')
|
|
129
|
-
.replace(/[\n]/g, '\\n')
|
|
130
|
-
.replace(/[\r]/g, '\\r')
|
|
131
|
-
.replace(/[\t]/g, '\\t');
|
|
132
|
-
}
|
|
133
|
-
const postmanRequestGeneratorGenerator = setup => method => {
|
|
134
|
-
// if(!noCase) noCase = await import("change-case");
|
|
135
|
-
const args = {};
|
|
136
|
-
method.parameters.forEach(function (param) {
|
|
137
|
-
args[param.name] = aliasExamples[param.type] ? aliasExamples[param.type] : paramNameExamples[param.name] ? paramNameExamples[param.name] : primatives.includes(param.type) ? param.type : 'Check documentation in description';
|
|
138
|
-
});
|
|
139
|
-
const hostpath = setup.apiHost ? (0, parse_url_1.default)(setup.apiHost).pathname.substring(1) : false;
|
|
140
|
-
const url = {
|
|
141
|
-
"raw": setup.apiHost ? `{{address}}:{{port}}${hostpath ? `/${hostpath}` : ''}/${method.name}` : (setup === null || setup === void 0 ? void 0 : setup.useSessionIdInPath) ? "{{address}}:{{port}}/{{sessionId}}/" + method.name : "{{address}}:{{port}}/" + method.name,
|
|
142
|
-
"host": [
|
|
143
|
-
"{{address}}"
|
|
144
|
-
],
|
|
145
|
-
"port": "{{port}}",
|
|
146
|
-
"path": (setup === null || setup === void 0 ? void 0 : setup.apiHost) ? [
|
|
147
|
-
(0, parse_url_1.default)(setup.apiHost).pathname.substring(1),
|
|
148
|
-
"" + method.name
|
|
149
|
-
].filter(x => x) : (setup === null || setup === void 0 ? void 0 : setup.useSessionIdInPath) ? [
|
|
150
|
-
"{{sessionId}}",
|
|
151
|
-
"" + method.name
|
|
152
|
-
] : ["" + method.name]
|
|
153
|
-
};
|
|
154
|
-
const name = noCase(method.name).replace(/\b[a-z]|['_][a-z]|\B[A-Z]/g, function (x) { return x[0] === "'" || x[0] === "_" ? x : String.fromCharCode(x.charCodeAt(0) ^ 32); });
|
|
155
|
-
const request = {
|
|
156
|
-
"auth": {
|
|
157
|
-
"type": "apikey",
|
|
158
|
-
"apikey": [
|
|
159
|
-
{
|
|
160
|
-
"key": "value",
|
|
161
|
-
"value": setup === null || setup === void 0 ? void 0 : setup.preAuthDocs && setup.key,
|
|
162
|
-
"type": "string"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"key": "key",
|
|
166
|
-
"value": "key",
|
|
167
|
-
"type": "string"
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
"method": "POST",
|
|
172
|
-
"header": [
|
|
173
|
-
{
|
|
174
|
-
"key": "Content-Type",
|
|
175
|
-
"name": "Content-Type",
|
|
176
|
-
"type": "text",
|
|
177
|
-
"value": "application/json"
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
"body": {
|
|
181
|
-
"mode": "raw",
|
|
182
|
-
"raw": JSON.stringify({ args: args }, escape, 4),
|
|
183
|
-
"options": {
|
|
184
|
-
"raw": {
|
|
185
|
-
"language": "json"
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
url,
|
|
190
|
-
"documentationUrl": `https://docs.openwa.dev/docs/reference/api/Client/classes/Client#${(method.name || "").toLowerCase()}`,
|
|
191
|
-
"description": `${method.text}\n[External Documentation](https://docs.openwa.dev/docs/reference/api/Client/classes/Client#${(method.name || "").toLowerCase()})`
|
|
192
|
-
};
|
|
193
|
-
if (!(setup === null || setup === void 0 ? void 0 : setup.key))
|
|
194
|
-
delete request.auth;
|
|
195
|
-
if (method.parameters.length === 0) {
|
|
196
|
-
request.body.raw = "{}";
|
|
197
|
-
// delete request.body;
|
|
198
|
-
}
|
|
199
|
-
const resp = {
|
|
200
|
-
name,
|
|
201
|
-
"originalRequest": request,
|
|
202
|
-
"code": 200,
|
|
203
|
-
"_postman_previewlanguage": "json",
|
|
204
|
-
"header": request.header,
|
|
205
|
-
"cookie": [],
|
|
206
|
-
"body": "{\n \"success\": true\n}"
|
|
207
|
-
};
|
|
208
|
-
return {
|
|
209
|
-
name,
|
|
210
|
-
request,
|
|
211
|
-
"response": [resp]
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
const postmanWrapGen = setup => item => ({
|
|
215
|
-
"info": {
|
|
216
|
-
"_postman_id": "0df31aa3-b3ce-4f20-b042-0882db0fd3a2",
|
|
217
|
-
"name": `@open-wa - ${setup.sessionId}`,
|
|
218
|
-
"description": "Requests for use with open-wa",
|
|
219
|
-
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
220
|
-
},
|
|
221
|
-
item,
|
|
222
|
-
"event": [
|
|
223
|
-
{
|
|
224
|
-
"listen": "prerequest",
|
|
225
|
-
"script": {
|
|
226
|
-
"id": "d1f29ae1-7df9-46d0-8f67-4f53f562ad7e",
|
|
227
|
-
"type": "text/javascript",
|
|
228
|
-
"exec": [
|
|
229
|
-
""
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
"listen": "test",
|
|
235
|
-
"script": {
|
|
236
|
-
"id": "370a2b6c-41d3-418f-ad9b-0404865429ce",
|
|
237
|
-
"type": "text/javascript",
|
|
238
|
-
"exec": [
|
|
239
|
-
""
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
],
|
|
244
|
-
"variable": [
|
|
245
|
-
{
|
|
246
|
-
"id": "43c133cc-7b9f-4dbe-a513-8832b664adb4",
|
|
247
|
-
"key": "address",
|
|
248
|
-
"value": (setup === null || setup === void 0 ? void 0 : setup.host) || "localhost"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"id": "fda078e5-712a-41bf-9da0-468fe3586d18",
|
|
252
|
-
"key": "port",
|
|
253
|
-
"value": (setup === null || setup === void 0 ? void 0 : setup.port) || "8008"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"id": "c1573a97-c016-4cf4-8b29-938c45146d04",
|
|
257
|
-
"key": "sessionId",
|
|
258
|
-
"value": (setup === null || setup === void 0 ? void 0 : setup.sessionId) || "session"
|
|
259
|
-
}
|
|
260
|
-
],
|
|
261
|
-
"protocolProfileBehavior": {}
|
|
262
|
-
});
|
package/dist/cli/cli-options.js
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optionList = void 0;
|
|
4
|
-
exports.optionList = [{
|
|
5
|
-
name: 'no-api',
|
|
6
|
-
default: false,
|
|
7
|
-
alias: 'n',
|
|
8
|
-
type: Boolean,
|
|
9
|
-
description: "Don't expose the api. This may be useful if you just want to set the webhooks."
|
|
10
|
-
}, {
|
|
11
|
-
name: 'bot-press-url',
|
|
12
|
-
alias: 'b',
|
|
13
|
-
type: String,
|
|
14
|
-
typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
|
|
15
|
-
description: "The Botpress URL that ends with your bot id."
|
|
16
|
-
}, {
|
|
17
|
-
name: 'twilio-webhook',
|
|
18
|
-
alias: 't',
|
|
19
|
-
type: String,
|
|
20
|
-
typeLabel: '{blue {underline http://localhost:5555/incoming}}',
|
|
21
|
-
description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
|
|
22
|
-
}, {
|
|
23
|
-
name: 'chatwoot-url',
|
|
24
|
-
type: String,
|
|
25
|
-
typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
|
|
26
|
-
description: "The URL of the specific Chatwoot inbox you set up for this session"
|
|
27
|
-
}, {
|
|
28
|
-
name: 'chatwoot-api-access-token',
|
|
29
|
-
type: String,
|
|
30
|
-
typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
|
|
31
|
-
description: "The access token of the specific Chatwoot inbox you set up for this session"
|
|
32
|
-
}, {
|
|
33
|
-
name: 'force-update-cw-webhook',
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: false,
|
|
36
|
-
description: "Updates the chatwoot inbox webhook with the --api-host value on every launch"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'port',
|
|
40
|
-
alias: 'p',
|
|
41
|
-
default: 8002,
|
|
42
|
-
type: Number,
|
|
43
|
-
typeLabel: '{blue {underline 8080}}',
|
|
44
|
-
description: "Set the port for the api. Default to 8002."
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'forcePort',
|
|
48
|
-
type: Number,
|
|
49
|
-
description: "Sometimes --port is overridden by environmental variables or the config file. Use this flag to force the port to be used."
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'api-host',
|
|
53
|
-
type: String,
|
|
54
|
-
typeLabel: '{yellow {underline localhost}}',
|
|
55
|
-
description: "The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well."
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'host',
|
|
59
|
-
alias: 'h',
|
|
60
|
-
default: 'localhost',
|
|
61
|
-
type: String,
|
|
62
|
-
typeLabel: '{red {underline localhost}}',
|
|
63
|
-
description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'webhook',
|
|
67
|
-
alias: 'w',
|
|
68
|
-
type: String,
|
|
69
|
-
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
|
70
|
-
description: "Webhook to use for the listeners."
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'verbose',
|
|
74
|
-
alias: 'v',
|
|
75
|
-
default: false,
|
|
76
|
-
type: Boolean,
|
|
77
|
-
description: "Enable console transport for internal logger."
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'ev',
|
|
81
|
-
alias: 'e',
|
|
82
|
-
type: String,
|
|
83
|
-
typeLabel: '{green {underline https://webhook.site/....}}',
|
|
84
|
-
description: "Send launch events to this URL."
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: 'ef',
|
|
88
|
-
type: String,
|
|
89
|
-
//@ts-ignore
|
|
90
|
-
default: ["qr", "STARTUP", "MD_DETECT", "qrUrl"],
|
|
91
|
-
isMultiple: true,
|
|
92
|
-
typeLabel: '{blueBright {underline qr,STARTUP}}',
|
|
93
|
-
description: "Filters which namespaces trigger the webhook set in -e/--ev."
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: 'allow-session-data-wh',
|
|
97
|
-
alias: 'x',
|
|
98
|
-
default: false,
|
|
99
|
-
type: Boolean,
|
|
100
|
-
description: "By default, if you set -e flag, the session data is not transferred to the webhook as it is extremely sensitive data. In order to bypass this security measure, use this flag."
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'key',
|
|
104
|
-
alias: 'k',
|
|
105
|
-
type: String,
|
|
106
|
-
typeLabel: '{redBright {underline apikey}}',
|
|
107
|
-
description: "Specify an api key to use as a check for all requests. If you add -k by itself, a key will be autogenerated for you."
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'config',
|
|
111
|
-
alias: 'c',
|
|
112
|
-
type: String,
|
|
113
|
-
typeLabel: '{yellowBright {underline ./cli.config.json}}',
|
|
114
|
-
description: "The relative json file that contains the config. By default the system will look for cli.config.json which will override any config variables set. Default: './cli.config.json'."
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'session',
|
|
118
|
-
alias: 's',
|
|
119
|
-
type: String,
|
|
120
|
-
typeLabel: '{magentaBright {underline BASE64}}',
|
|
121
|
-
description: "A base64 string representing the session data."
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 'keep-alive',
|
|
125
|
-
alias: 'a',
|
|
126
|
-
type: Boolean,
|
|
127
|
-
description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'use-session-id-in-path',
|
|
131
|
-
alias: 'i',
|
|
132
|
-
type: Boolean,
|
|
133
|
-
description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'generate-api-docs',
|
|
137
|
-
alias: 'd',
|
|
138
|
-
type: Boolean,
|
|
139
|
-
default: true,
|
|
140
|
-
description: "Generate postman collection and expose api docs to open in browser."
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: 'session-data-only',
|
|
144
|
-
alias: 'o',
|
|
145
|
-
type: Boolean,
|
|
146
|
-
description: "Kill the process when the session data is saved.",
|
|
147
|
-
default: false
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: 'skip-save-postman-collection',
|
|
151
|
-
type: Boolean,
|
|
152
|
-
description: "Don't save the postman collection.",
|
|
153
|
-
default: false
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'headful',
|
|
157
|
-
type: Boolean,
|
|
158
|
-
description: "Show the browser window on your machine.",
|
|
159
|
-
default: false
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'pre-auth-docs',
|
|
163
|
-
type: Boolean,
|
|
164
|
-
description: "Pre authenticate documentation site [High security risk]."
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: 'stats',
|
|
168
|
-
type: Boolean,
|
|
169
|
-
description: "Exposes API swagger-statistics.",
|
|
170
|
-
default: false
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: 'pre-auth-docs',
|
|
174
|
-
type: Boolean,
|
|
175
|
-
description: "Grab config options from the environment variables.",
|
|
176
|
-
default: false
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: 'no-kill-on-logout',
|
|
180
|
-
type: Boolean,
|
|
181
|
-
description: "Keeps the process alive when host account logs out of session. default is false",
|
|
182
|
-
default: false
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'debug',
|
|
186
|
-
type: Boolean,
|
|
187
|
-
description: "Print out the CLI flag values and the WA_* env vars. default is false",
|
|
188
|
-
default: false
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: 'cors',
|
|
192
|
-
type: Boolean,
|
|
193
|
-
description: "Enable all cors requests",
|
|
194
|
-
default: false
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: 'socket',
|
|
198
|
-
type: Boolean,
|
|
199
|
-
description: "Expose a socket.io middleware on the server.",
|
|
200
|
-
default: false
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: 'license-key',
|
|
204
|
-
alias: 'l',
|
|
205
|
-
type: String,
|
|
206
|
-
typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
|
|
207
|
-
description: "The license key you want to use for this server. License keys are used to unlock features. Learn more here https://github.com/open-wa/wa-automate-nodejs#license-key"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: 'ready-webhook',
|
|
211
|
-
type: String,
|
|
212
|
-
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
|
213
|
-
description: "Webhook that fires when the EASY API is completely ready"
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: 'on-call',
|
|
217
|
-
type: String,
|
|
218
|
-
typeLabel: '{yellow {underline "Please do not call this number"}}',
|
|
219
|
-
description: "A default message to send to any number that is trying to call the host account"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: 'auto-reject',
|
|
223
|
-
type: Boolean,
|
|
224
|
-
description: "Automatically reject incoming phone and video calls to the host account."
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: 'emit-unread',
|
|
228
|
-
type: Boolean,
|
|
229
|
-
description: "Emit all unread messages via onMessage webhooks on launch.",
|
|
230
|
-
default: false
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: 'skip-url-check',
|
|
234
|
-
type: Boolean,
|
|
235
|
-
description: "Don't validate webhook URLs. Enables use of non-FQDNs."
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: 'tunnel',
|
|
239
|
-
type: Boolean,
|
|
240
|
-
description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured. By default it will use a random cloudflare tunnel URL. Make sure you have cloudflared installed and running."
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: 'cf-tunnel-host-domain',
|
|
244
|
-
type: String,
|
|
245
|
-
typeLabel: '{yellow {underline "mycool.site"}}',
|
|
246
|
-
description: "If you have a domain set up in a cloudflare account and have run cloudflared login on your machine, you can use this to expose the tunnel on your own domain. For example, if you set --cf-tunnel-host-domain mycool.site, the tunnel will be exposed on https://session_id_owa.mycool.site"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
name: 'cf-tunnel-namespace',
|
|
250
|
-
type: String,
|
|
251
|
-
typeLabel: '{yellow {underline "owa"}}',
|
|
252
|
-
description: "You can set a sub-subdomain namespace on which the tunnel will be exposed. Needs to be set in conjunction with --tunnel & --cf-tunnel-host-domain. For example, if you set --cf-tunnel-namespace owa, the tunnel will be exposed on https://session_id.owa.mycool.site"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: 'pm2',
|
|
256
|
-
type: Boolean,
|
|
257
|
-
typeLabel: '{yellow {underline "--max-memory-restart 300M"}}',
|
|
258
|
-
description: "Offload the EASY API to local instance of pm2. You can add pm2 specific arguments also if you want."
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
name: 'privkey',
|
|
262
|
-
type: String,
|
|
263
|
-
typeLabel: '{yellow {underline "./privatekey.pem"}}',
|
|
264
|
-
description: "The private key to use for the TLS connection. --cert is also required"
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: 'cert',
|
|
268
|
-
type: String,
|
|
269
|
-
typeLabel: '{yellow {underline "./certificate.pem"}}',
|
|
270
|
-
description: "The certificate to use for the TLS connection. --privkey is also required"
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'helmet',
|
|
274
|
-
type: Boolean,
|
|
275
|
-
description: "Enable helmet middleware for security.",
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: 'allow-ips',
|
|
279
|
-
type: String,
|
|
280
|
-
//@ts-ignore
|
|
281
|
-
isMultiple: true,
|
|
282
|
-
typeLabel: '{blueBright {underline 192.168.0.1,192.168.0.2}}',
|
|
283
|
-
description: "Allow only these IPs to connect to the EASY API. By default, all IPs are allowed."
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: 'help',
|
|
287
|
-
description: 'Print this usage guide.'
|
|
288
|
-
}
|
|
289
|
-
];
|