Привет.
При отправке формы TelegramBot выдает 502 Bad Gateway.
Ниже обработчик
Сайт на vue.js
crossDomainPost({commit}, param) {
const chatBot = 21312;
const chatId = 123123;
const iframe = document.createElement("iframe");
const uniqueString = "CHANGE_THIS_TO_SOME_UNIQUE_STRING";
document.body.appendChild(iframe);
iframe.style.display = "none";
iframe.contentWindow.name = uniqueString;
const form = document.createElement("form");
form.target = uniqueString;
if (param === 'feedback') {
const subject = 'Feedback';
const field1 = 'Name:';
const field2 = 'Company:';
const field3 = 'Email:';
const field4 = 'Phone:';
form.action =
"
https://api.telegram.org/bot" + chatBot + ":AAFbKchTA9zDxOSfRW-8IVH2A6r3VTAjUV4/sendMessage?chat_id=" + chatId + "&text=" + subject + "%0A" + field1 + " " + document.querySelector('input[name="feedName"]').value + "%0A" + field2 + " " + document.querySelector('input[name="feedCompany"]').value + "%0A" + field3 + " " + document.querySelector('input[name="feedEmail"]').value + "%0A" + field4 + " " + document.querySelector('input[name="feedPhone"]').value;
}
form.method = "POST";
// repeat for each parameter
const input = document.createElement("input");
input.type = "hidden";
input.name = "INSERT_YOUR_PARAMETER_NAME_HERE";
input.value = "INSERT_YOUR_PARAMETER_VALUE_HERE";
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}