You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.telegramService.sendDocument({
chat_id: 100500,
document: fs.createReadStream('error.txt') // <--- need to have Buffer here, tried a lot of ways to make it
}).subscribe()
Telegram API answers with code 400 without explanation.
Works:
import * as FormData from 'form-data';
...
const form = new FormData();
form.append('chat_id', chat_id);
form.append('document', Buffer.alloc(text.length, text), {filename: 'error.txt'});
form.submit(`https://api.telegram.org/bot${settings.telegramBot.key}/sendDocument`, function(err, response) {
console.log(err, response);
});
The text was updated successfully, but these errors were encountered:
Does not work:
Telegram API answers with code 400 without explanation.
Works:
The text was updated successfully, but these errors were encountered: