@andrey4emk/npm-app-back-b24 0.9.5 → 0.9.6
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 +17 -8
package/package.json
CHANGED
package/sendMessage/wappi.js
CHANGED
|
@@ -34,20 +34,25 @@ export class Wappi {
|
|
|
34
34
|
let url;
|
|
35
35
|
let token;
|
|
36
36
|
let profile_id;
|
|
37
|
+
|
|
38
|
+
// Отображаем в открытой линии или нет (по умолчанию true)
|
|
39
|
+
let sendOpenLine = messageData.sendOpenLine ?? true;
|
|
40
|
+
sendOpenLine = sendOpenLine ? "bot_id=1&" : "";
|
|
41
|
+
|
|
37
42
|
if (messangerType === "whatsApp") {
|
|
38
43
|
token = this.whatsAppAuth.token;
|
|
39
44
|
profile_id = this.whatsAppAuth.profile_id;
|
|
40
|
-
url = `https://wappi.pro/api/async/message/send
|
|
45
|
+
url = `https://wappi.pro/api/async/message/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
41
46
|
}
|
|
42
47
|
if (messangerType === "telegram") {
|
|
43
48
|
token = this.telegaAuth.token;
|
|
44
49
|
profile_id = this.telegaAuth.profile_id;
|
|
45
|
-
url = `https://wappi.pro/tapi/sync/message/send
|
|
50
|
+
url = `https://wappi.pro/tapi/sync/message/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
46
51
|
}
|
|
47
52
|
if (messangerType === "max") {
|
|
48
53
|
token = this.maxAuth.token;
|
|
49
54
|
profile_id = this.maxAuth.profile_id;
|
|
50
|
-
url = `https://wappi.pro/maxapi/sync/message/send
|
|
55
|
+
url = `https://wappi.pro/maxapi/sync/message/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
51
56
|
}
|
|
52
57
|
let res = await fetch(url, {
|
|
53
58
|
method: "POST",
|
|
@@ -88,6 +93,10 @@ export class Wappi {
|
|
|
88
93
|
let profile_id;
|
|
89
94
|
let base64;
|
|
90
95
|
|
|
96
|
+
// Отображаем в открытой линии или нет (по умолчанию true)
|
|
97
|
+
let sendOpenLine = messageData.sendOpenLine ?? true;
|
|
98
|
+
sendOpenLine = sendOpenLine ? "bot_id=1&" : "";
|
|
99
|
+
|
|
91
100
|
if (messangerType === "whatsApp") {
|
|
92
101
|
token = this.whatsAppAuth.token;
|
|
93
102
|
profile_id = this.whatsAppAuth.profile_id;
|
|
@@ -100,11 +109,11 @@ export class Wappi {
|
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
if (fileName.includes(".pdf")) {
|
|
103
|
-
url = `https://wappi.pro/api/async/message/document/send
|
|
112
|
+
url = `https://wappi.pro/api/async/message/document/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
104
113
|
}
|
|
105
114
|
// Если отправили картинку .png, .jpg и т.д.
|
|
106
115
|
if (fileName.includes(".png") || fileName.includes(".jpg") || fileName.includes(".jpeg") || fileName.includes(".gif")) {
|
|
107
|
-
url = `https://wappi.pro/api/async/message/img/send
|
|
116
|
+
url = `https://wappi.pro/api/async/message/img/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
if (messangerType === "telegram") {
|
|
@@ -119,17 +128,17 @@ export class Wappi {
|
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
if (fileName.includes(".pdf")) {
|
|
122
|
-
url = `https://wappi.pro/tapi/sync/message/document/send
|
|
131
|
+
url = `https://wappi.pro/tapi/sync/message/document/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
123
132
|
}
|
|
124
133
|
// Если отправили картинку .png, .jpg и т.д.
|
|
125
134
|
if (fileName.includes(".png") || fileName.includes(".jpg") || fileName.includes(".jpeg") || fileName.includes(".gif")) {
|
|
126
|
-
url = `https://wappi.pro/tapi/sync/message/img/send
|
|
135
|
+
url = `https://wappi.pro/tapi/sync/message/img/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
138
|
if (messangerType === "max") {
|
|
130
139
|
token = this.maxAuth.token;
|
|
131
140
|
profile_id = this.maxAuth.profile_id;
|
|
132
|
-
url = `https://wappi.pro/maxapi/async/message/file/url/send
|
|
141
|
+
url = `https://wappi.pro/maxapi/async/message/file/url/send?${sendOpenLine}profile_id=${profile_id}`;
|
|
133
142
|
}
|
|
134
143
|
|
|
135
144
|
// Max при отправке pdf не прикрепляет сообщение caption: message, поэтому отправляем его отдельно
|