Answer the question
In order to leave comments, you need to log in
Telegram form not submitting from JavaScript?
I want to send a form to telegram directly from a js file. New to all this.
const TOKEN = token;
const CHAT_ID = id;
function sendMsg() {
var url = 'https://api.telegram.org/bot' + TOKEN + '/sendMessage';
var body = JSON.stringify({
chat_id: CHAT_ID,
parse_mode: 'Markdown',
text: "Сообщение"
});
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8'); //
xhr.send(body);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question