# Taking a picture and sending it via telegram

**URL:** <https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905>\
**Category:** General\
**Created:** [6 June 2020 17:48 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905 "2020-06-06T17:48:41Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discourse.nodered.org/u/Chenko)\
**Post date:** [9 June 2020 07:08 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/21 "2020-06-09T07:08:30Z")

</div>

and the telegram node also fires saying

```auto
msg.payload.chatId is empty

```

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 June 2020 07:14 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/22 "2020-06-09T07:14:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discourse.nodered.org/u/Chenko)\
**Post date:** [9 June 2020 07:20 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/23 "2020-06-09T07:20:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 June 2020 07:30 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/24 "2020-06-09T07:30:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chenko](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@Chenko](https://discourse.nodered.org/u/Chenko)\
**Post date:** [9 June 2020 07:41 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/25 "2020-06-09T07:41:49Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/a/4ab1d77fe5e39d6d6a970c3d0728f69d366a33ee.png)

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 June 2020 12:49 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/26 "2020-06-09T12:49:41Z")

</div>

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.

> [@Steve-Mcl](#):
>
> - 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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2a9ddec04e4bf2b74cac17e1a6801e63f1731ea8.png)

Do that ^ and show me the debug output

---

<div class="post-metadata">

**Author:** ![stefan24](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stefan24/32/23075_2.png) [@stefan24](https://discourse.nodered.org/u/stefan24)\
**Post date:** [9 June 2020 19:26 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/27 "2020-06-09T19:26:46Z")

</div>

> [@wb666greene](#):
>
> My issues were setting up Telegram and using the "botfather" I got the node-red to send a message but I couldn't get it to send to multiple users as a single group.

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

---

<div class="post-metadata">

**Author:** ![eitijupaenoithoowohd](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@eitijupaenoithoowohd](https://discourse.nodered.org/u/eitijupaenoithoowohd)\
**Post date:** [3 August 2020 11:20 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/28 "2020-08-03T11:20:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stefan24](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stefan24/32/23075_2.png) [@stefan24](https://discourse.nodered.org/u/stefan24)\
**Post date:** [3 August 2020 14:10 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/29 "2020-08-03T14:10:13Z")

</div>

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

```auto
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).

---

<div class="post-metadata">

**Author:** ![DamianosS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/damianoss/32/16990_2.png) [@DamianosS](https://discourse.nodered.org/u/DamianosS)\
**Post date:** [18 August 2020 13:28 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/30 "2020-08-18T13:28:21Z")

</div>

Continuing the discussion from [Taking a picture and sending it via telegram](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/28):

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

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![eitijupaenoithoowohd](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@eitijupaenoithoowohd](https://discourse.nodered.org/u/eitijupaenoithoowohd)\
**Post date:** [18 August 2020 15:32 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/31 "2020-08-18T15:32:56Z")

</div>

@DamianosS  
Thank you very mutch!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 October 2020 15:32 UTC](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/32 "2020-10-17T15:32:57Z")

</div>

Closed on 17 October 2020 15:32 UTC

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

[Previous page](https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905.md?page=1)
