@andrey4emk/npm-app-back-b24 0.5.28 → 0.5.30
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/chatApp.js +2 -1
- package/sendMessage/wappi.js +11 -14
package/package.json
CHANGED
package/sendMessage/chatApp.js
CHANGED
|
@@ -164,7 +164,8 @@ export class ChatApp {
|
|
|
164
164
|
// Сбрасываем флаг обновления токена
|
|
165
165
|
this.updateToken = false;
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
let check = data.data.exists;
|
|
168
|
+
return { error: false, message: `Телефон успешно проверен в ChatApp через ${messangerType}`, data: data, auth: newAuth, check: check };
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
|
package/sendMessage/wappi.js
CHANGED
|
@@ -39,15 +39,13 @@ export class Wappi {
|
|
|
39
39
|
if (messangerType === "max") {
|
|
40
40
|
url = `https://wappi.pro/maxapi/sync/message/send`;
|
|
41
41
|
}
|
|
42
|
-
let res = await fetch(url
|
|
42
|
+
let res = await fetch(url + `?profile_id=${this.profile_id}`, {
|
|
43
43
|
method: "POST",
|
|
44
44
|
headers: {
|
|
45
45
|
"Content-Type": "application/json",
|
|
46
46
|
Authorization: this.token,
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
profile_id: this.profile_id,
|
|
50
|
-
},
|
|
48
|
+
|
|
51
49
|
body: JSON.stringify({
|
|
52
50
|
recipient: phone,
|
|
53
51
|
body: message,
|
|
@@ -82,15 +80,13 @@ export class Wappi {
|
|
|
82
80
|
if (messangerType === "max") {
|
|
83
81
|
url = `https://wappi.pro/maxapi/async/message/file/url/send`;
|
|
84
82
|
}
|
|
85
|
-
let res = await fetch(url
|
|
83
|
+
let res = await fetch(url + `?profile_id=${this.profile_id}`, {
|
|
86
84
|
method: "POST",
|
|
87
85
|
headers: {
|
|
88
86
|
"Content-Type": "application/json",
|
|
89
87
|
Authorization: this.token,
|
|
90
88
|
},
|
|
91
|
-
|
|
92
|
-
profile_id: this.profile_id,
|
|
93
|
-
},
|
|
89
|
+
|
|
94
90
|
body: JSON.stringify({
|
|
95
91
|
recipient: phone,
|
|
96
92
|
url: fileUrl,
|
|
@@ -123,20 +119,21 @@ export class Wappi {
|
|
|
123
119
|
if (messangerType === "max") {
|
|
124
120
|
url = `https://wappi.pro/maxapi/sync/contact/check`;
|
|
125
121
|
}
|
|
126
|
-
let res = await fetch(url
|
|
122
|
+
let res = await fetch(url + `?profile_id=${this.profile_id}&phone=${phone}`, {
|
|
127
123
|
method: "get",
|
|
128
124
|
headers: {
|
|
129
125
|
"Content-Type": "application/json",
|
|
130
126
|
Authorization: this.token,
|
|
131
127
|
},
|
|
132
|
-
params: {
|
|
133
|
-
profile_id: this.profile_id,
|
|
134
|
-
phone: phone,
|
|
135
|
-
},
|
|
136
128
|
});
|
|
137
129
|
let data = await res.json();
|
|
138
130
|
if (data.status != "done") {
|
|
139
|
-
|
|
131
|
+
// Проверяем нашли max или нет
|
|
132
|
+
let check = false;
|
|
133
|
+
if (data.detail === "found" || data.on_max) {
|
|
134
|
+
check = true;
|
|
135
|
+
}
|
|
136
|
+
return { error: true, message: `Номер ${phone} проверен для мессенджера ${messangerType}`, data: data, check: check };
|
|
140
137
|
} else {
|
|
141
138
|
return { error: false, message: `Сообщение успешно отправлено в ChatApp через ${messangerType}`, data: data };
|
|
142
139
|
}
|