From webcam image to file [for Telegram bot]

Hi all !

I'm using NR 7.2.10 inside HA and I'd like to send (to Telegram) a snapshopt from my Reolink ipcamera when an event is triggered (MQTT message from BlueIris).
I have success configuring the bot and to send Telegram text messages.

With same script as below, I have success to send a picture if 'content' is a .jpg (or something else) FILE taken from the web

if (msg.payload == "0")
  msg.payload = {
    chatId: 'mychatID',
    type: "photo",
    content: ",204,203,200_.jpg" 
  return msg;

BUT, if I chance content to image from my Reolink camera,
content: ""
it does not work.

Considering that the address works perfectly in my browser but not in Telegram, I suppose it's due to the fact the link it's not a file... is it correct ?

Probably I should somehow create a picture from camera address and use it for telegram..
How could I do this ?

Any help is really appreciated !

Try replacing all the & in you url with &

content: ""

How do you expect the telegram server to have access to your local network. The url has to be accessible from the internet.

What I do is to get the image from camera via HTTP node request. In the following node I write the image to /tmp directory and finally I build, in a Function node, the message to Telegram like this:

msg.payload = {chatId: <yourchatid>, type: 'photo', content: '/tmp/securitycam1picture.jpg'};
return msg;

Replace with you actual Chat Id.

There is no need to create a file, this can be all done in-memory

grab the a buffer image from camera, build the telegram msg in a function, send it...

Here is a demo: Node red sending picture to telegram - #4 by Steve-Mcl


Note: I've added a telegram tag to the forum as this is a commonly used service with Node-RED. I've tagged this thread and the one that Steve linked.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.