How to download multiple files from a telegram group

I am trying to download multiple images from a telegram channel , but not getting required output. only getting 1 image in the output.

Given input - (2 images in my first group)

123abc

but I am only getting first image in the output.

scenario

output bundle.

[
{
“message”: null,
“update_id”: 665954840,
“channel_post”: {
“message_id”: 1028,
“sender_chat”: {
“id”: -1001955557092,
“title”: “Sandbox - Testing”,
“username”: “upscmotivationquote”,
“type”: “channel”
},
“chat”: {
“id”: -1001955557092,
“title”: “Sandbox - Testing”,
“username”: “upscmotivationquote”,
“type”: “channel”
},
“date”: “2023-10-01T13:48:30.000Z”,
“media_group_id”: “13569344885637789”,
“photo”: [
{
“file_id”: “AgACAgUAAx0CdI9u5AACBARlGXiuARRjPE0YroSoaPoYjM3wBAACHbkxG2Ci0FQdGd6WWWPPWwEAAwIAA3MAAzAE”,
“file_unique_id”: “AQADHbkxG2Ci0FR4”,
“file_size”: 2151,
"width": 90,
“height”: 90,
“type”: “Photo”
},
{
“file_id”: “AgACAgUAAx0CdI9u5AACBARlGXiuARRjPE0YroSoaPoYjM3wBAACHbkxG2Ci0FQdGd6WWWPPWwEAAwIAA20AAzAE”,
“file_unique_id”: “AQADHbkxG2Ci0FRy”,
“file_size”: 32363,
“width”: 320,
“height”: 320
},
{
“file_id”: “AgACAgUAAx0CdI9u5AACBARlGXiuARRjPE0YroSoaPoYjM3wBAACHbkxG2Ci0FQdGd6WWWPPWwEAAwIAA3gAAzAE”,
“file_unique_id”: “AQADHbkxG2Ci0FR9”,
“file_size”: 115282,
“width”: 800,
“height”: 800
},
{
“file_id”: “AgACAgUAAx0CdI9u5AACBARlGXiuARRjPE0YroSoaPoYjM3wBAACHbkxG2Ci0FQdGd6WWWPPWwEAAwIAA3kAAzAE”,
“file_unique_id”: “AQADHbkxG2Ci0FR-”,
“file_size”: 153410,
“width”: 1080,
“height”: 1080
}
],
“attachment”: {
“file_id”: “AgACAgUAAx0CdI9u5AACBARlGXiuARRjPE0YroSoaPoYjM3wBAACHbkxG2Ci0FQdGd6WWWPPWwEAAwIAA3MAAzAE”,
“file_unique_id”: “AQADHbkxG2Ci0FR4”,
“file_size”: 2151,
“width”: 90,
“height”: 90,
“type”: “Photo”
}
},
“inline_query”: null,
“callback_query”: null,
“edited_message”: null,
“edited_channel_post”: null
}
]

only getting the first image in 4 different formats .
is there a way around to get the data of all the files from the first channel.

blueprint -

blueprint (3).json (108.3 KB)

Hi :wave:t5:

This, actually, is caused by the Telegram Bot API.

Multiple images in one message are always being sent in multiple webhooks from Telegram’s side.
Each with a unique “Message ID”.
This means multiple images sent in one message trigger your scenario multiple times.

In case the images are sent in “Group items” mode, they all have a different “Message ID” but the same “media_group_id”.

I am not really sure whether it could be applied to your scenario idea but you potentially could have one scenario collecting image data with their IDs and “media_group_ids” which you could save to the Data Store and then a secondary scenario that would output (and group) the images data based on the “media_group_id”.

I hope it makes sense.

Cheerio.

2 Likes