Camera Pi - Telegram Bot

Skip to first unread message

Nov 17, 2017, 3:14:19 PM11/17/17
to Node-RED
I need an example on how to snap photo from pi camera and send it to telegram bot. I can't find it in Google.
Thank you

Mark Setrem

Nov 17, 2017, 3:19:26 PM11/17/17
to Node-RED
The wonder of node-red is that it is fairly easy to join up the nodes yourself.

If you look at there are nodes to take a photo using a Pi Camera. There are also nodes for use with telegram.
By reading the info for the different nodes you can see where in the msg object the camera node puts the image and also where telegram wants the image.

If these aren't the same you can use a change node to move the image from one to the other.

Once you have started, if you get stuck come back, post your flow and I'm sure someone will be able to help you further.

Nov 18, 2017, 5:53:53 PM11/18/17
to Node-RED

Can anyone help me with this. I want to send picture to telegram bot. When i connect to telegram node it says "msg.payload.content is empty" is empty. 

Mark Setrem

Nov 18, 2017, 6:00:53 PM11/18/17
to Node-RED
so which of the pi photo nodes did you choose and where does it put the image file?

Nov 18, 2017, 8:52:35 PM11/18/17
to Node-RED
Image result for camerapi node flows

Mark Setrem

Nov 19, 2017, 5:38:27 AM11/19/17
to Node-RED

OK, so you have chosen to store the photo as a file "/home/pi/Pictures/photo1.JPEG"

But this isn't stored in the right format for the telegram bot.   So you need to provide that information by placing a node between the photo node and the telegram node.

Personally I'd use a function node, although I'm not near my RaspberryPi at the moment so I can't check this.

msg.payload.caption="Here's the caption";
msg.payload.content= "/home/pi/Pictures/photo1.JPEG";
return msg;

But I think you will also need to include a chatID?


Nov 19, 2017, 5:39:47 AM11/19/17
1) when someone asks what node you are using and you don’t want to waste their time, you should reply with the nodes name like ‘node-red-contrib-camerapi’. That way they can quickly find the node and not have to dig thru several nodes to see if they can determine which node you are using and then try to help you out.

2) When you don’t get the results you expect, it is very useful to add a ‘debug’ node to  the output of the node in question (and display the complete msg object). This way you can see the results and might be able to figure out yourself, what is going on.

3) you should look at the options, that the node you are using, provides. Is there more than one way it will create an output?

I think if you try  doing this, you might find you can solve this issue yourself. (grin)

Join us on Slack to continue the conversation:
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web, visit
For more options, visit

Nov 19, 2017, 12:22:28 PM11/19/17
to Node-RED
Thank you so much it works beautifully.  
If you don't mind how do i add a time stamp to the picture and send it to telegram. 

Thank you

Mark Setrem

Nov 19, 2017, 12:36:48 PM11/19/17
to Node-RED

I thought that Raspberry Pi added a timestamp to the exif data 

If you mean adding the text to a photo there are numerous tutorials that can show you how to do that.
You could for example use the exec node, but it is probably the time for you to have a try yourself.   
Reply all
Reply to author
0 new messages