How to have a dynamic amount of node parameters

Hello,
I’m trying to send a Media Group message with the Telegram node.

From the Telegram node I can specify the Media File dynamically like this (expression is missing but it’s to make it clear what I write in the field)

If I have 3 images, I just click “Add Media” and specify all the files/URLs to send.

In my case, the images I’m trying to send are URLs got from an HTTP request.

I’d need to “simulate” the Add Media button for each URL in the response, and set its expression to {{$json.data.image1}} for the first URL, {{$json.data.image2}} for the second and so on, basically a dynamic amount of expression parameters.

From what I see it seems you have to know all the Medias beforehand, is that right?

I know I can split the images and use the Function Item node to send a single message at a time, but I wanted to know if it’s possible to do it with the Media Group message.

Thank you!

Hey @Havock94, you can’t use a dynamic number of parameters unfortunately. If there’s a limited amount of options (like 1, 2, or 3 images) you could consider using the Switch node for each possible case.

If there is an unknown number of incoming URLs, you could consider splitting your URLs into separate items first (so you have one item per URL). You’ll then be able to run the Send Photo operation of the Telegram node with a single parameter and it’ll run for each item.