# Problem while sending multiple photos using telegram bot

**URL:** <https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250>\
**Category:** General\
**Tags:** telegram\
**Created:** [8 February 2025 21:28 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250 "2025-02-08T21:28:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusufscelik](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yusufscelik/32/98689_2.png) [@yusufscelik](https://discourse.nodered.org/u/yusufscelik)\
**Post date:** [8 February 2025 21:28 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250/1 "2025-02-08T21:28:39Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc1929d4bb060d495961babae34850072ced22cd.png)

I am trying to send three photos using a **node-red-contrib-telegrambot**. My approach consists of the following steps:

1. **Generating the File Paths:**

- The first function determines the file paths of the three images dynamically.
- It constructs an array of file paths based on a variable `number_of_pages`:

```cpp
var number_of_pages = 1;

msg.payload = [  
  `/data/photos/${number_of_pages}.jpg`,
  `/data/photos/${number_of_pages+1}.jpg`,
  `/data/photos/${number_of_pages+2}.jpg`
];

return msg;

```

**Processing the Images:**

The paths are split, and each file is read individually.  
After reading, the images are grouped together again.  
Once joined, the msg.payload appears as an array of buffers:

```auto
2.2025, 22:10:08 node: debug 2
msg.payload : array[3]
[buffer[3097142], buffer[1620527], buffer[1667224] ]

```

**Formatting the Telegram Message:**

- A function formats the message to be sent via the Telegram bot.  
It encapsulates the buffer array within an object containing the chat\_id, content, and type:

```auto
msg.payload = {
    chat_id: 1099927519, //example
    content: msg.payload,
    type: "photo"
};

return msg;

```

**Final node before sending;**

```auto
msg.payload : Object
object
chat_id: 1099927519 //example
content: array[3]
type: "photo"

```

The error that i got;

```auto
Caught exception in sender node:

Error: EPARSE: Error parsing response: <html>

<head><title>414 Request-URI Too Large</title></head>

<body>

<center><h1>414 Request-URI Too Large</h1></center>

<hr><center>nginx/1.18.0</center>

</body>

</html>
when processing message: 
{"payload":{"content":[{"type":"Buffer","data":[255,216,255,225,31,136,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,12,1,0,0,3,0,0,0,1,7,181,0,0,1,1,0,3,0,0,0,1,11,4

```

I also tried "sendMediaGroup" method but it didnt work.  
Any suggestions?

---

<div class="post-metadata">

**Author:** ![ziga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ziga/32/98138_2.png) [@ziga](https://discourse.nodered.org/u/ziga)\
**Post date:** [8 February 2025 21:41 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250/2 "2025-02-08T21:41:57Z")

</div>

I'm not familiar with telegram and this node in particular but the error suggests you're sending to much data in a GET request to server so it can't handle it. Nothing much you can do here.

Do they support POST API requests? If so use those.

---

<div class="post-metadata">

**Author:** ![yusufscelik](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yusufscelik/32/98689_2.png) [@yusufscelik](https://discourse.nodered.org/u/yusufscelik)\
**Post date:** [8 February 2025 21:44 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250/3 "2025-02-08T21:44:06Z")

</div>

Actually i dont even use GET or POST method because it is handled my the "telegram sender" node. So how it works and which method it uses i dont even know. Maybe there is an another way to send group of photos instead of using type:"foto". Because normally 3 images are nothing for an API to send.(as i know)

---

<div class="post-metadata">

**Author:** ![ziga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ziga/32/98138_2.png) [@ziga](https://discourse.nodered.org/u/ziga)\
**Post date:** [8 February 2025 21:55 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250/4 "2025-02-08T21:55:10Z")

</div>

I checked this node documentation and there's no reference that content can be an image buffer. It can be a reference to a file or url.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 February 2025 22:01 UTC](https://discourse.nodered.org/t/problem-while-sending-multiple-photos-using-telegram-bot/95250/5 "2025-02-08T22:01:32Z")

</div>

Please do not double post topic, you have a previous open topic on this. Please continue there. [Sending group of fotos with telegram bot](https://discourse.nodered.org/t/sending-group-of-fotos-with-telegram-bot/95228)
