@andrey4emk/npm-app-back-b24 0.6.10 → 0.6.11
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/package.json +1 -1
- package/sendMessage/wappi.js +6 -5
package/package.json
CHANGED
package/sendMessage/wappi.js
CHANGED
|
@@ -21,6 +21,7 @@ export class Wappi {
|
|
|
21
21
|
this.whatsAppAuth = whatsAppAuth;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// bot_id=1 нужно чтобы сообщение отображалось в открытой линии Битрикс24
|
|
24
25
|
async sendMessageWappi(messangerType, messageData) {
|
|
25
26
|
if (!["whatsApp"].includes(messangerType) && !["telegram"].includes(messangerType) && !["max"].includes(messangerType)) {
|
|
26
27
|
return { error: true, message: "Неверный тип мессенджера", data: null };
|
|
@@ -39,12 +40,12 @@ export class Wappi {
|
|
|
39
40
|
if (messangerType === "telegram") {
|
|
40
41
|
token = this.telegaAuth.token;
|
|
41
42
|
profile_id = this.telegaAuth.profile_id;
|
|
42
|
-
url = `https://wappi.pro/tapi/sync/message/send?profile_id=${profile_id}`;
|
|
43
|
+
url = `https://wappi.pro/tapi/sync/message/send?bot_id=1&profile_id=${profile_id}`;
|
|
43
44
|
}
|
|
44
45
|
if (messangerType === "max") {
|
|
45
46
|
token = this.maxAuth.token;
|
|
46
47
|
profile_id = this.maxAuth.profile_id;
|
|
47
|
-
url = `https://wappi.pro/maxapi/sync/message/send?profile_id=${profile_id}`;
|
|
48
|
+
url = `https://wappi.pro/maxapi/sync/message/send?bot_id=1&profile_id=${profile_id}`;
|
|
48
49
|
}
|
|
49
50
|
let res = await fetch(url, {
|
|
50
51
|
method: "POST",
|
|
@@ -100,17 +101,17 @@ export class Wappi {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
if (fileName.includes(".pdf")) {
|
|
103
|
-
url = `https://wappi.pro/tapi/sync/message/document/send?profile_id=${profile_id}`;
|
|
104
|
+
url = `https://wappi.pro/tapi/sync/message/document/send?bot_id=1&profile_id=${profile_id}`;
|
|
104
105
|
}
|
|
105
106
|
// Если отправили картинку .png, .jpg и т.д.
|
|
106
107
|
if (fileName.includes(".png" || ".jpg" || ".jpeg" || ".gif")) {
|
|
107
|
-
url = `https://wappi.pro/tapi/sync/message/img/send?profile_id=${profile_id}`;
|
|
108
|
+
url = `https://wappi.pro/tapi/sync/message/img/send?bot_id=1&profile_id=${profile_id}`;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
if (messangerType === "max") {
|
|
111
112
|
token = this.maxAuth.token;
|
|
112
113
|
profile_id = this.maxAuth.profile_id;
|
|
113
|
-
url = `https://wappi.pro/maxapi/async/message/file/url/send?profile_id=${profile_id}`;
|
|
114
|
+
url = `https://wappi.pro/maxapi/async/message/file/url/send?bot_id=1&profile_id=${profile_id}`;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
// Max при отправке pdf не прикрепляет сообщение caption: message, поэтому отправляем его отдельно
|