Telegram: Send files using InputFile(binary data)

As far as I know, you can send to the file to telegram not only with file_id or URL link to the file.
To send binary data according to the documentation, you need to use InputFile.

This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.

Example Curl query:

curl --location --request POST '' \
--header 'Content-Type: application/json' \
--form '[email protected]"/home/image.png"' \
--form 'chat_id="chat_id"'

Can this feature be added to the following methods?

  • sendPhoto
  • sendDocument
  • sendAudio
  • sendVideo

Can you tell me how difficult it is to make this improvement?
Now I have to use S3 to send files, and it is very expensive.

I had a quick look and it’s not difficult. It’s most about available time.

1 Like