# Send a file to telegram messenger

**URL:** https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672
**Category:** General
**Created:** [30 April 2019 11:44 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672 "2019-04-30T11:44:34Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)
#### Post date: [30 April 2019 11:44 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/1 "2019-04-30T11:44:34Z")

</div>

Hi,

Im trying to send a file to my telegram messenger.

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2270d8bdb9a046c1a180d9a662df3f8216aca40d.png)  
This is my flow.  
Is it possible to send a file to Telegram Messenger and if so how can I do this?

The aim is that when I send a command to my bot he grabs the file and I can view it in the chat.

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [30 April 2019 12:12 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/2 "2019-04-30T12:12:52Z")

</div>

You don't say which telegram node you are using.  
But if you read the ReadMe of the node, generally they will include the information you need.

What do you think the flow you posted does?

---

<div class="post-metadata">

### Author: ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)
#### Post date: [30 April 2019 12:59 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/5 "2019-04-30T12:59:14Z")

</div>

Using the `node-red-contrib-telegrambot` I send rpi camera images to my chat via myTelegram bot, specifically using the sender node.

The image can either be taken and sent to the Telegram chat by an external trigger, or by me sending a message from the chat back to the receiver node.

Look at the doco for the telegrambot nodes.

---

<div class="post-metadata">

### Author: ![vignesk70](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vignesk70/32/12326_2.png) [@vignesk70](https://discourse.nodered.org/u/vignesk70)
#### Post date: [20 September 2019 08:40 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/6 "2019-09-20T08:40:11Z")

</div>

Was looking for a solution like this but keep failing to get it to work. Would you find sharing your flow and respective javascript. Still a newbie at node-red

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [20 September 2019 08:48 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/7 "2019-09-20T08:48:38Z")

</div>

Their [documentation has an example](https://flows.nodered.org/node/node-red-contrib-telegrambot).

---

<div class="post-metadata">

### Author: ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)
#### Post date: [21 September 2019 03:29 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/8 "2019-09-21T03:29:57Z")

</div>

Specifically which part are you having trouble with? The Telegram part or the camera part?

---

<div class="post-metadata">

### Author: ![vignesk70](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vignesk70/32/12326_2.png) [@vignesk70](https://discourse.nodered.org/u/vignesk70)
#### Post date: [21 September 2019 13:17 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/9 "2019-09-21T13:17:17Z")

</div>

The part on sending an image that is immediate captured as a buffer from the rpi cam. i have tried using a http request and response and it seems to work fine. wanted to figure out how to do it by using a telegram bot.

```auto
[{"id":"b41eab85.18f638","type":"tab","label":"Homepic","disabled":false,"info":""},{"id":"837d9a14.550c08","type":"http in","z":"b41eab85.18f638","name":"","url":"/pic","method":"get","upload":false,"swaggerDoc":"","x":130,"y":169,"wires":[["8965ee66.63579"]]},{"id":"8965ee66.63579","type":"camerapi-takephoto","z":"b41eab85.18f638","filemode":"0","filename":"pic.jpg","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"3","rotation":"270","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"Photo","x":365,"y":171,"wires":[["f0b93408.f3cbe8","13441894.8b6c27"]]},{"id":"f0b93408.f3cbe8","type":"http response","z":"b41eab85.18f638","name":"","statusCode":"","headers":{"content-type":"image/png"},"x":612,"y":142,"wires":[]},{"id":"13441894.8b6c27","type":"debug","z":"b41eab85.18f638","name":"picdebug","active":true,"console":"false","complete":"true","x":616,"y":202,"wires":[]},{"id":"798a30a2.532a28","type":"inject","z":"b41eab85.18f638","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120.5,"y":236,"wires":[["8965ee66.63579"]]}]

```

Tried the following but still failing to send an image.

```auto
[{"id":"a0d605c5.f02328","type":"debug","z":"b51e2383.80a08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":615,"y":307,"wires":[]},{"id":"8bd4dac1.0f4488","type":"telegrambot-notify","z":"b51e2383.80a08","name":"","bot":"c43b9d15.ca50a","chatId":"","message":"","parseMode":"Markdown","x":638,"y":362,"wires":[]},{"id":"4b4f266f.2843d8","type":"telegrambot-payload","z":"b51e2383.80a08","name":"","bot":"c43b9d15.ca50a","chatId":"","sendMethod":"sendPhoto","payload":"{\n \"photo\":\"http://vignesk.dlinkddns.com:1880/pic\"\n}","x":388,"y":345,"wires":[["a0d605c5.f02328","8bd4dac1.0f4488"]]},{"id":"add472da.f207c","type":"camerapi-takephoto","z":"b51e2383.80a08","filemode":"0","filename":"pic.jpg","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"3","rotation":"270","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"Photo","x":321,"y":262,"wires":[["4b4f266f.2843d8"]]},{"id":"dca0d43a.2cfc48","type":"telegrambot-command","z":"b51e2383.80a08","name":"test","bot":"c43b9d15.ca50a","command":"/test","commandType":"str","commandCase":false,"x":162,"y":306,"wires":[["4b4f266f.2843d8","add472da.f207c"]]},{"id":"c43b9d15.ca50a","type":"telegrambot-config","z":"","botname":"vighome_bot","usernames":"","chatIds":"","pollInterval":"300"}]

```

---

<div class="post-metadata">

### Author: ![gleba](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gleba/32/50938_2.png) [@gleba](https://discourse.nodered.org/u/gleba)
#### Post date: [22 October 2022 01:55 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/10 "2022-10-22T01:55:18Z")

</div>

read the file from your pc and convert it into a buffer, then with a function node save the buffer in a file specifying name and extension

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 October 2022 12:23 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/11 "2022-10-22T12:23:36Z")

</div>

Do you realize this thread is three years old?  
I’ll be closing it.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 October 2022 12:23 UTC](https://discourse.nodered.org/t/send-a-file-to-telegram-messenger/10672/12 "2022-10-22T12:23:44Z")

</div>


