Problem while sending multiple photos using telegram bot

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:
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:

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:
msg.payload = {
    chat_id: 1099927519, //example
    content: msg.payload,
    type: "photo"
};

return msg;

Final node before sending;

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

The error that i got;

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?

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.

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)

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.

Please do not double post topic, you have a previous open topic on this. Please continue there. Sending group of fotos with telegram bot