Send media group
Sends a set of files to a chat or channel. Media types: audio, document, photo, video
- Parameters
- Advanced call ?
Function SendMediaGroup(Val Token, Val ChatID, Val Text, Val FileMapping, Val Keyboard = "", Val Markup = "Markdown") Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Token | --token | String | ✔ | Bot token |
| ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
| Text | --text | String | ✔ | Message text |
| FileMapping | --media | Map of KeyAndValue | ✔ | File collection: Key > File, Value > Media Type |
| Keyboard | --keyboard | String | ✖ | Keyboard. See FormKeyboardFromButtonArray |
| Markup | --parsemode | String | ✖ | Text processing type (HTML, Markdown, MarkdownV2) |
Returns
Map Of KeyAndValue - serialized JSON response from Telegram
| Parameter | Description |
|---|---|
| proxy | InternetProxy or a structure with fields Protocol, Host, Port, User, Password, UseOSAuthentication |
| timeout | Request execution timeout |
| adv_response | Formats the response as a complete HTTP structure with fields code, body, and headers |
| retries | Number of HTTP request send attempts on 5** status codes or internal client errors |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
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);
- Bash
- CMD/Bat
# 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/0fzpdyxt.ziy.docx':'document'}"
:: 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/0fzpdyxt.ziy.docx':'document'}"
Result
{
"ok": true,
"result": [
{
"message_id": 21756,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1779801776,
"media_group_id": "14238414211280514",
"photo": [
{
"file_id": "AgACAgIAAxkDAAJULmoTw3F0g929wxeavL_yMqOtGLNaAAIhIWsbcsGZSLK5DC2W3Y18AQADAgADcwADOwQ",
"file_unique_id": "AQADISFrG3LBmUh4",
"file_size": 1569,
"width": "***",
"height": 67
},
{
"file_id": "AgACAgIAAxkDAAJULmoTw3F0g929wxeavL_yMqOtGLNaAAIhIWsbcsGZSLK5DC2W3Y18AQADAgADbQADOwQ",
"file_unique_id": "AQADISFrG3LBmUhy",
"file_size": 21511,
"width": "***",
"height": 240
},
{
"file_id": "AgACAgIAAxkDAAJULmoTw3F0g929wxeavL_yMqOtGLNaAAIhIWsbcsGZSLK5DC2W3Y18AQADAgADeAADOwQ",
"file_unique_id": "AQADISFrG3LBmUh9",
"file_size": 98652,
"width": "***",
"height": 600
},
{
"file_id": "AgACAgIAAxkDAAJULmoTw3F0g929wxeavL_yMqOtGLNaAAIhIWsbcsGZSLK5DC2W3Y18AQADAgADeQADOwQ",
"file_unique_id": "AQADISFrG3LBmUh-",
"file_size": 217083,
"width": "***",
"height": 960
},
{
"file_id": "AgACAgIAAxkDAAJULmoTw3F0g929wxeavL_yMqOtGLNaAAIhIWsbcsGZSLK5DC2W3Y18AQADAgADdwADOwQ",
"file_unique_id": "AQADISFrG3LBmUh8",
"file_size": 645868,
"width": "***",
"height": 1920
}
],
"caption": "Строковое значение"
},
{
"message_id": 21757,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1779801776,
"media_group_id": "14238414211280514",
"video": {
"duration": 5,
"width": "***",
"height": 480,
"file_name": "video1",
"mime_type": "video/mp4",
"thumbnail": {
"file_id": "AAMCAgADFQdqFZ6w1CynXFeppc56_AlCJgduoAAC9ZwAAnLBqUiU3laQmAkHHwEAB20AAzsE",
"file_unique_id": "AQAD9ZwAAnLBqUhy",
"file_size": 19807,
"width": "***",
"height": 240
},
"thumb": {
"file_id": "AAMCAgADFQdqFZ6w1CynXFeppc56_AlCJgduoAAC9ZwAAnLBqUiU3laQmAkHHwEAB20AAzsE",
"file_unique_id": "AQAD9ZwAAnLBqUhy",
"file_size": 19807,
"width": "***",
"height": 240
},
"file_id": "BAACAgIAAxUHahWesNQsp1xXqaXOevwJQiYHbqAAAvWcAAJywalIlN5WkJgJBx87BA",
"file_unique_id": "AgAD9ZwAAnLBqUg",
"file_size": 1137878
}
}
]
}