How to send File via Telegram Bot

telegram-bot

I need to send txt File using TelegramBot API .

I already tried https://api.telegram.org/botMYT0KEN/sendDocument?chat_id=569502265&document=/Users/users/Desktop/file.txt

and have issue :

{"ok":false,"error_code":400,"description":"Bad Request: wrong remote
file id specified: Wrong string length”}

Best Answer

To complete Donny's answer, I would like to add an example of sending .txt file as a document.

Looks like you're using OS X as an operating system, which has curl utility preinstalled.

Open terminal and make a request like this:

curl -v -F "chat_id=569502265" -F document=@/Users/users/Desktop/file.txt https://api.telegram.org/bot<TOKEN>/sendDocument
Related Topic