@open-wa/wa-automate 4.26.0 → 4.26.1
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.
@@ -62,7 +62,6 @@ const chatwootMiddleware = (cliConfig, client) => {
|
|
62
62
|
});
|
63
63
|
try {
|
64
64
|
const processAndSendResult = yield processMesssage();
|
65
|
-
console.log("🚀 ~ file: chatwoot.ts ~ line 58 ~ return ~ processAndSendResult", processAndSendResult);
|
66
65
|
res.status(200).send(processAndSendResult);
|
67
66
|
}
|
68
67
|
catch (error) {
|
@@ -79,15 +78,16 @@ const setupChatwootOutgoingMessageHandler = (cliConfig, client) => __awaiter(voi
|
|
79
78
|
const _u = new URL(u);
|
80
79
|
const origin = _u.origin;
|
81
80
|
const port = _u.port || 80;
|
82
|
-
const accountId = u.match(
|
83
|
-
const
|
84
|
-
|
81
|
+
const [accountId, inboxId] = u.match(/\/(app|(api\/v1))\/accounts\/\d*\/inbox\/\d*/g)[0].split('/').filter(Number);
|
82
|
+
// const accountId = u.match(/accounts\/\d*/g) && u.match(/accounts\/\d*/g)[0].replace('accounts/', '')
|
83
|
+
const resolvedInbox = inboxId || u.match(/inboxes\/\d*/g) && u.match(/inboxes\/\d*/g)[0].replace('inboxes/', '');
|
85
84
|
const cwReq = (path, method, data) => {
|
86
|
-
|
85
|
+
const url = `${origin}/api/v1/accounts/${accountId}/${path}`.replace('app.bentonow.com', 'chat.bentonow.com');
|
86
|
+
console.log(url, method, data);
|
87
87
|
return axios_1.default({
|
88
88
|
method,
|
89
89
|
data,
|
90
|
-
url
|
90
|
+
url,
|
91
91
|
headers: {
|
92
92
|
api_access_token
|
93
93
|
}
|
package/package.json
CHANGED