Current telegram integration requires an actual file on storage for it to be sent. For example if I generate an image in memory, and want to send it using telegram integration, I first need to save it to disk, and then send the file path to integration for it to be sent. Writing to disk and reading again leads to unnecessary issues (latency, atleast 3 disk I/O -write-read-delete, file name conflicts etc). Some of the use cases which will benefit are -
- camera snapshots could directly be sent to telegram without any file management overhead.
- any web scarped images could also be directly sent to telegram without file IO
- Any image creation (e.g. QR code), or image editing (resizing etc) could all be done in memory and directly sent to telegram
Since it is possible to post a buffer to telegram endpoint (even current bot library will have to read the file in buffer anyways to submit the multipart form post request) , the integration should also accept a buffer to send to telgram servers in addition to a file path. It should be a trivial change to skip the file reading and instead directly using user provided buffer.
Unfortunately I code in javascript (and not in python) so can’t submit a PR but will be happy to share my node-red function node which does exactly same.