windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
262 stars 116 forks source link

Sending a Photo: not only from save-file? How to flow? #211

Closed ozett closed 2 years ago

ozett commented 3 years ago

on my flow an image is coming as base64 over MQTT. i always save that and asemmble the send-message with a save-file as content. are there other ways in node red to send that image without saving as a file?

How do i get the base64 image adressed in the content-option?

image

j-expression:

{
   "chatId": "-123456789",
   "type": "photo",
   "caption": "AI gesichtet: "  & msg.name & " (" & msg.confidence & "% )",
   "content": "/tmp/fm.jpg",
   "options": 
    {
       "disable_notification": "true"
    } 

}

image

thanks a lot for ideas...

windkh commented 3 years ago

https://discourse.nodered.org/t/node-red-sending-picture-to-telegram/39656

you can use the buffer as content if it is a known format: e.g. Jpeg….

ozett commented 3 years ago

wow, real quick. i look up your hint instantly ...

found also something with multpart... but dont know how to use that... 🤫

https://core.telegram.org/bots/api#sending-files image

windkh commented 3 years ago

The send function checks if the content is a file_id, a url,or a buffer…. if it is a buffer then the media type is determined and then send right away …. Make sure that the buffer size does not exceed the limit and that the format is supported.

ozett commented 3 years ago

thanks for helping. fantastic. got it working with the func-node.

the last part is to reference msg.name in the function-node as part of the caption. (?) must be another secret syntax for me stupid low-coder... 😄 image

windkh commented 3 years ago

caption : „AI gesichtet: „ + msg.name + „ „ + msg.confidence,

gänsefüßchen natürlich oben…

windkh commented 3 years ago

Btw typo: picture not piture … in line 3

windkh commented 3 years ago

Funktioniert das double-take?

ozett commented 3 years ago

ja, danke. 💐 auch noch so spät: Jsonata "&" -> javascript "+" exchanged the concatenation to javascript-style (and correct the typo 😄 )

🟢 caption: "AI gesichtet: " + msg.name + " (" + msg.confidence + "% )",

ozett commented 3 years ago

Funktioniert das double-take?

astrein, letzte beta! mit compreface bissl gefummel mit docker-compose. läuft jetzt bei mir paralell zu python und yolo, und kann für face-rec optimiert werden... spannend...

ozett commented 3 years ago

spannend: https://documenter.getpostman.com/view/1013188/TzsWuAa8#aa26f5ce-f215-4771-a6cc-efb40a24c99e

ozett commented 3 years ago

image

windkh commented 3 years ago

Muss ich auch mal probieren

windkh commented 3 years ago

Hm kann das auch trainiert werden um namen zuzuordnen?

ozett commented 3 years ago

Hm kann das auch trainiert werden um namen zuzuordnen?

genauso läufts... 😄

image

windkh commented 3 years ago

Oh ja das sieht gut aus… musst mir mal live zeigen…

ozett commented 3 years ago

😉 -> https://github.com/jakowenko/double-take#docker-compose