Answer the question
In order to leave comments, you need to log in
How to register webhook telegram?
The cart writes the answer that the webhook is deleted, this answer should be if you send an empty request
https://api.telegram.org/bot1111111:aaaaaaa/setWebhook
but I write from-data and put it in the body, it is logical to assume that I am not correctly forming from-data, who knows what the error is?{ ok: true, result: true, description: 'Webhook is already deleted' }
var formdata = new FormData();
//for( let key in body ) formdata.append( key, body[ key ] );
formdata.append("url", "https://api.domain.ru/telegram/bot1111111:aaaaaaa");
formdata.append("certificate", fs.readFileSync("/etc/api.domain.ru/cert.pem"), { filename: 'cert.pem' });
console.log(formdata)
var requestOptions = {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: formdata
};
fetch("https://api.telegram.org/bot1111111:aaaaaaa/setWebhook", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
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