'How Can I send documents with extensions like xslx or something else in Telegram Bot?
I am stuck trying to send documents with different extensions to my Telegram using sendDocument(). I use it like
this.bot.telegram.sendDocument(chatId, 'abc.com/api/telegram/download/${file.path}/${file.name}
It should download file from S3 first then upload it to telegram. But it works well with pdf, gif, as documentation says. What if I want to send some other docs like xslx, rtf or something else? How can I handle this?
Solution 1:[1]
So, answer was simple enough, I should download file from S3, then pass file.data to source field of sendDocument function second parameter:
fileService.download(path, name).then(file => ...sendDocument(chatId, {
source: file.data,
filename: file.name,
}));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Timofey Melentev |
