Skip to main content

Send media group

Sends a set of files to a chat or channel. Media types: audio, document, photo, video

Function SendMediaGroup(Val Token, Val ChatID, Val Text, Val FileMapping, Val Keyboard = "", Val Markup = "Markdown") Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringBot token
ChatID--chatString, NumberTarget chat ID or ChatID*TopicID
Text--textStringMessage text
FileMapping--mediaMap of KeyAndValueFile collection: Key > File, Value > Media Type
Keyboard--keyboardStringKeyboard. See FormKeyboardFromButtonArray
Markup--parsemodeStringText processing type (HTML, Markdown, MarkdownV2)

Returns: Map Of KeyAndValue - serialized JSON response from Telegram

tip

Method at API documentation: sendMediaGroup


1C:Enterprise/OneScript code example
    Token  = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
Text = "Строковое значение";
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
Video = "https://hut.openintegrations.dev/test_data/video.mp4";

ImagePath = GetTempFileName("png");
CopyFile(Image, ImagePath);

VideoPath = GetTempFileName("mp4");
CopyFile(Video, VideoPath);

VideoDD = New BinaryData(VideoPath);

MediaGroup = New Map;
MediaGroup.Insert(ImagePath, "photo");
MediaGroup.Insert(VideoDD , "video");

Result = OPI_Telegram.SendMediaGroup(Token, ChatID, Text, MediaGroup);
    # JSON data can also be passed as a path to a .json file

oint telegram SendMediaGroup \
--token "***" \
--chat "***" \
--text "Строковое значение" \
--media "{'https://hut.openintegrations.dev/test_data/document.docx':'document','/tmp/ivxkzceh.fjr.docx':'document'}"
Result
{
"ok": true,
"result": [
{
"message_id": 20464,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1774428168,
"media_group_id": "14195425347980530",
"photo": [
{
"file_id": "AgACAgIAAxkDAAJPamnDV2gXtIHwgSZT1YtocwNJfqctAAKaFGsbL0kgSut3mL3_-S-dAQADAgADcwADOgQ",
"file_unique_id": "AQADmhRrGy9JIEp4",
"file_size": 1569,
"width": "***",
"height": 67
},
{
"file_id": "AgACAgIAAxkDAAJPamnDV2gXtIHwgSZT1YtocwNJfqctAAKaFGsbL0kgSut3mL3_-S-dAQADAgADbQADOgQ",
"file_unique_id": "AQADmhRrGy9JIEpy",
"file_size": 21511,
"width": "***",
"height": 240
},
{
"file_id": "AgACAgIAAxkDAAJPamnDV2gXtIHwgSZT1YtocwNJfqctAAKaFGsbL0kgSut3mL3_-S-dAQADAgADeAADOgQ",
"file_unique_id": "AQADmhRrGy9JIEp9",
"file_size": 98652,
"width": "***",
"height": 600
},
{
"file_id": "AgACAgIAAxkDAAJPamnDV2gXtIHwgSZT1YtocwNJfqctAAKaFGsbL0kgSut3mL3_-S-dAQADAgADeQADOgQ",
"file_unique_id": "AQADmhRrGy9JIEp-",
"file_size": 217083,
"width": "***",
"height": 960
},
{
"file_id": "AgACAgIAAxkDAAJPamnDV2gXtIHwgSZT1YtocwNJfqctAAKaFGsbL0kgSut3mL3_-S-dAQADAgADdwADOgQ",
"file_unique_id": "AQADmhRrGy9JIEp8",
"file_size": 645868,
"width": "***",
"height": 1920
}
],
"caption": "Строковое значение"
},
{
"message_id": 20465,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1774428168,
"media_group_id": "14195425347980530",
"video": {
"duration": 5,
"width": "***",
"height": 480,
"file_name": "video1",
"mime_type": "video/mp4",
"thumbnail": {
"file_id": "AAMCAgADFQdpw6AIc1Fz7F3mhTKbwrvcIXSxTgACZJEAAi9JIEpr6Vtffq5gLwEAB20AAzoE",
"file_unique_id": "AQADZJEAAi9JIEpy",
"file_size": 19807,
"width": "***",
"height": 240
},
"thumb": {
"file_id": "AAMCAgADFQdpw6AIc1Fz7F3mhTKbwrvcIXSxTgACZJEAAi9JIEpr6Vtffq5gLwEAB20AAzoE",
"file_unique_id": "AQADZJEAAi9JIEpy",
"file_size": 19807,
"width": "***",
"height": 240
},
"file_id": "BAACAgIAAxUHacOgCHNRc-xd5oUym8K73CF0sU4AAmSRAAIvSSBKa-lbX36uYC86BA",
"file_unique_id": "AgADZJEAAi9JIEo",
"file_size": 1137878
}
}
]
}