windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
264 stars 117 forks source link

Send full link in getFile operation #358

Closed gmag11 closed 8 months ago

gmag11 commented 8 months ago

When invoking the getFile method, the bot responds with the following data:

{
    "content": {
        "file_id": "AgAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "file_path": "photos/file_19.jpg",
        "file_size": 258305,
        "file_unique_id": "AQAxxxxxxxxxxx"
    },
    "getfile": {
        "fileId": "AgACAgQxxxxxxxxxxxxxxxxxx-n0fHjoyHyxxxxxxxxxxxxxxxxBAAMCAAN3AAM0BA"
    },
    "type": "photo"
}

To download the file, a complete web link is required, similar to how the message receiver gets a link when a file is sent to the bot.

I am working with callbacks that include messages with photos. I prefer not to use the downloadFile command as I wish to pass raw data directly to the subsequent node instead of saving to the file system.

I am considering three potential solutions:

  1. Add a webLink property to the msg object in response to getFile.
  2. Implement an additional getFileLink command.
  3. Include a webLink in callback responses that refer to a message containing a file.

Which one do you think it would be better?

windkh commented 8 months ago

I saw your commit. Well, you can use the autodownload feature, the file id or as you prefered the complete weblink.

In my eyes all of those are valid use cases. So returning the weblink sounds like a useful idea.

windkh commented 8 months ago

merged and released: @gmag11 thanks for your contribution