Telegram trigger - how many images transmitted and how to get all pictures


I want to create telegram bot, which gets one or twe image and then use it.
But I don’t understand how to find out how many images have been transmitted and how to get these pictures if there are two of them.

If I send to trigger several images, I see in JSON key - “media_group_id”
But binary data has only one first picture.

  1. I need to know how many images have been transmitted to bot
  2. If no one or more than two - send error message to user
  3. If there is one image - I use it in one procedure, if two images - another procedure.

PS. I want to create bot for stereo (3d) picture. As a result bot sends to user three picture - for cross eye, parallel eye and anaglyph (for spetial glasses).

Hi @pamir75, could you share your workflow along with some example data and elaborate a bit on your questions? For example, for " 1. I need to know how many images have been transmitted to bot", are you referring to the total number of images ever sent to a Telegram bot? Or just the number of images you are processing in the current workflow execution?

Thanx for reply.
As for workflow - for testing it is single Telegram trigger. It listen message.
And of couse I need to know the number of images in current execution to understend one or two images (or more) sent user to bot at a time

When I send to bot single image, I can see that:

When I send to bot several images at a time (album), I can see that:

I see “media_group_id” (that is mean several images in message), but I can’t get all of them.

Okay, so you are actually receiving data from Telegram, not sending data to Telegram here. Does your trigger node receive binary data for these photos? You can check this by clicking Binary on the output panel:

Yes, if I set Download images/filess to TRUE, then trigger receives binary, But only one.

I send by application Telegram to bot two image in one message:

but trigger recevies only one

Thanks for confirming @pamir75! I was able to reproduce this on my end and will add it to our bug tracker for a closer look.

In the meantime, perhaps you can consider sending only one image at a time/split multiple images across multiple Telegram messages?

Thank you very much. Yes, I have changed the behavior of the bot. He demands one picture at a time and the next step asks a question with buttons (inline keyboard). And depending on the answer, it expects further actions.

1 Like

Hi @pamir75, @Michael_Kret looked into this and it seems this is the expected behaviour. When sending multiple images, the trigger will start separate executions for each image it receives.

What is the best way to solve that problem, now?

I have also been investigating this issue recently. I found that when I send multiple images to the bot at once, multiple updates actually occur. Each update corresponds to one of the images, with the first image possibly having a caption if one is provided. All of these images have the same media_group_id, which is used to link them together