Taking a picture and sending it via telegram

and the telegram node also fires saying

msg.payload.chatId is empty

i set the file mode to buffer and the same information was displayed

show me your flow and the debug output of the camera

  • add a debug on the output of the telegram command node
  • add a debug on the output camera node
  • add a debug (set to show complete message) just before the telegram reply node - lets see whats in there

inspect them - is everything in the right place?
Is the msg.payload.content a buffer?
is the msg.payload.chatId set correctly?

i am using the sample flow u sent above. i have done as u said. replacing the http node with a camera node and setting it as buffer

It works for me.

If you dont add the debugs - you'll never understand why it doesnt work.

It's likely your msg going into the telegram reply is mising 1 or more parts or the data is incorrect type.

Without debug nodes - its impossible to tell.

here is what i have with the debug nodes and wat they say
i can get images from my camera using motioneye but i dont know why it is not work here

The screenshot you have posted shows me that the camera node is not giving an image - but without doing what I asked, i have no idea.

Do that ^ and show me the debug output

I have sent a JPG to the family Telegram group, where my bot is also member. All users have received the JPG.

@DamianosS
Hi. May I ask flow example? Thank you in advance.

Just put this in a function node and send it to the Telegram sender.

var payload = { 
chatId: -12345678,
    type: "photo",
    content: "/home/pi/.node-red/static/back.png" };
return {payload};

chatID is the ID of the group! Change the path to the picture (in my case a static PNG).

Continuing the discussion from Taking a picture and sending it via telegram:

@eitijupaenoithoowohd, sorry for the late reply. Was on vacation! :slight_smile:
Here you go:

[{"id":"dbf323a0.38c35","type":"change","z":"74ffd0f7.cc645","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"attachments","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":320,"wires":[["8e4dd042.f49b7"]]},{"id":"8e4dd042.f49b7","type":"split","z":"74ffd0f7.cc645","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":650,"y":320,"wires":[["dcb44b12.386fc8"]]},{"id":"dcb44b12.386fc8","type":"change","z":"74ffd0f7.cc645","name":"compose filename and load content to payload","rules":[{"t":"set","p":"filename","pt":"msg","to":"\"/tmp/pics/\" & $millis() & \".jpg\"","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload.content","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":320,"wires":[["d691db08.fa4048","d6195c81.3c917"]]},{"id":"d691db08.fa4048","type":"file","z":"74ffd0f7.cc645","name":"Save picture to disk","filename":"","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":1290,"y":320,"wires":[[]]},{"id":"1ef91a2a.9a2506","type":"delay","z":"74ffd0f7.cc645","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":440,"wires":[["b0c164f1.a2c258"]]},{"id":"b0c164f1.a2c258","type":"function","z":"74ffd0f7.cc645","name":"Set topic and filename","func":"msg.method = \"sendPhoto\";\n\nmsg.payload = { \n    caption : msg.file,\n    photo : msg.filename  \n}\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":440,"wires":[["776e71b3.35424"]]},{"id":"776e71b3.35424","type":"telegrambot-payload","z":"74ffd0f7.cc645","name":"Send picture to Damos","bot":"","chatId":"xxxxxxxxxx","sendMethod":"sendPhoto","payload":"","x":860,"y":440,"wires":[["776d0362.0d7ecc"]]},{"id":"776d0362.0d7ecc","type":"delay","z":"74ffd0f7.cc645","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1080,"y":440,"wires":[["61cd4cc4.3aaec4"]]},{"id":"61cd4cc4.3aaec4","type":"file","z":"74ffd0f7.cc645","name":"Delete picture from disk","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"delete","encoding":"none","x":1310,"y":440,"wires":[[]]},{"id":"a07da3ab.19965","type":"inject","z":"74ffd0f7.cc645","name":"trigger email fetch","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":240,"wires":[["27b8b327.29751c","7bb543f9.646bec"]]},{"id":"27b8b327.29751c","type":"link out","z":"74ffd0f7.cc645","name":"","links":["58a75936.f6c428"],"x":315,"y":240,"wires":[]},{"id":"7bb543f9.646bec","type":"e-mail in","z":"74ffd0f7.cc645","name":"Fetch Emails from camera","protocol":"IMAP","server":"outlook.office365.com","useSSL":true,"port":"993","box":"Inbox/Reolink/Ierissos","disposition":"Read","criteria":"UNSEEN","repeat":"300","fetch":"trigger","inputs":1,"x":230,"y":320,"wires":[["dbf323a0.38c35"]]},{"id":"ed250162.649a4","type":"link in","z":"74ffd0f7.cc645","name":"","links":["d6195c81.3c917","579a65a3.118b4c","fcb1a714.d61448"],"x":160,"y":440,"wires":[["1ef91a2a.9a2506"]]},{"id":"d6195c81.3c917","type":"link out","z":"74ffd0f7.cc645","name":"","links":["ed250162.649a4","146b88bf.c418b7"],"x":1180,"y":380,"wires":[]}]
1 Like

@DamianosS
Thank you very mutch!

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