Telegram: Send files using InputFile(binary data) [GOT CREATED]

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.

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 'https://api.telegram.org/bot-key/sendPhoto' \
--header 'Content-Type: application/json' \
--form 'photo=@"/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

Hi!
You canā€™t get it in the near future to refine it?

Keeping an S3 server to send files to the cart is quite wastefulā€¦

@a1ekseev
Please consider these options: MinIO and Wasabi.

They both use S3 compatible API but MinIO is self hosted and Wasabi.com is about 80% cheaper than S3! with free egress. At last look Itā€™s $5.99/TB/m

Wasabi is fantastic and super fast, MinIO is easy to setup and I believe Linode (and other providers) have one-click options for it, as well as their own S3 type storage called Object Storage (and an API).

I do not see the point of keeping a repository of files, just to send binary data to the chat telegram.

There could be another optionā€¦

@pemontto put this together the other day, it just needs to be checked and merged and you will be good to go: āœØ Add binary upload for Telegram by pemontto Ā· Pull Request #2247 Ā· n8n-io/n8n Ā· GitHub

2 Likes

I just reviewed the PR that @Jon mentioned and made some changes. It will probably be available in the next release.

1 Like

Thank you!
Very much looking forward to it.

Hey I had the same issue as you so wrote the PR. However as a workaround you can still perform the binary upload with an HTTP Request node. Try this:

4 Likes

Thanks very much for the contribution @pemontto. Good to see you here in the community.

1 Like

Got released with [email protected]

1 Like

Just convert it once it arrives?

Try this, ignore the IMAP part, but itā€™s about turning a file into Binary: