2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 7
2025-05-05 11:15:20 +03:00
description: Send media group and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# 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`
2024-10-15 15:15:47 +03:00
| 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) |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [sendMediaGroup](https://core.telegram.org/bots/api#sendmediagroup)
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-10-21 11:36:43 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
Text = "Строковое значение";
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
Video = "https://hut.openintegrations.dev/test_data/video.mp4";
2024-10-15 10:16:04 +03:00
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);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2025-10-07 19:27:04 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint telegram SendMediaGroup \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-07-05 18:56:59 +03:00
--chat "@testsichee" \
2024-10-22 08:59:24 +03:00
--text "Строковое значение" \
2025-10-15 14:32:00 +03:00
--media "{'https://hut.openintegrations.dev/test_data/document.docx':'document','/tmp/a2vj4aty.r3p.docx':'document'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2025-10-07 19:27:04 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint telegram SendMediaGroup ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-07-05 18:56:59 +03:00
--chat "@testsichee" ^
2024-10-22 08:59:24 +03:00
--text "Строковое значение" ^
2025-10-15 14:32:00 +03:00
--media "{'https://hut.openintegrations.dev/test_data/document.docx':'document','/tmp/a2vj4aty.r3p.docx':'document'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"ok": true,
"result": [
{
2025-10-15 14:32:00 +03:00
"message_id": 17195,
2024-10-15 10:16:04 +03:00
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
2025-09-12 20:23:31 +03:00
"last_name": "Titovets",
"username": "bayselonarrend",
2024-10-15 10:16:04 +03:00
"type": "private"
},
2025-10-15 14:32:00 +03:00
"date": 1760516489,
"media_group_id": "14084131914453890",
2024-10-15 10:16:04 +03:00
"photo": [
{
2025-10-07 19:27:04 +03:00
"file_id": "AgACAgIAAxkDAAJBAAFo3CVN6Pf6v6X3uuGDQ4vNCBViJgACzwEyG_J74Uoy83-foYP4SgEAAwIAA3MAAzYE",
"file_unique_id": "AQADzwEyG_J74Up4",
2024-10-15 10:16:04 +03:00
"file_size": 1568,
"width": 90,
"height": 67
},
{
2025-10-07 19:27:04 +03:00
"file_id": "AgACAgIAAxkDAAJBAAFo3CVN6Pf6v6X3uuGDQ4vNCBViJgACzwEyG_J74Uoy83-foYP4SgEAAwIAA20AAzYE",
"file_unique_id": "AQADzwEyG_J74Upy",
2024-10-15 10:16:04 +03:00
"file_size": 21633,
"width": 320,
"height": 240
},
{
2025-10-07 19:27:04 +03:00
"file_id": "AgACAgIAAxkDAAJBAAFo3CVN6Pf6v6X3uuGDQ4vNCBViJgACzwEyG_J74Uoy83-foYP4SgEAAwIAA3gAAzYE",
"file_unique_id": "AQADzwEyG_J74Up9",
2024-10-15 10:16:04 +03:00
"file_size": 99260,
"width": 800,
"height": 600
},
{
2025-10-07 19:27:04 +03:00
"file_id": "AgACAgIAAxkDAAJBAAFo3CVN6Pf6v6X3uuGDQ4vNCBViJgACzwEyG_J74Uoy83-foYP4SgEAAwIAA3kAAzYE",
"file_unique_id": "AQADzwEyG_J74Up-",
2024-10-15 10:16:04 +03:00
"file_size": 218651,
"width": 1280,
"height": 960
},
{
2025-10-07 19:27:04 +03:00
"file_id": "AgACAgIAAxkDAAJBAAFo3CVN6Pf6v6X3uuGDQ4vNCBViJgACzwEyG_J74Uoy83-foYP4SgEAAwIAA3cAAzYE",
"file_unique_id": "AQADzwEyG_J74Up8",
2024-10-15 10:16:04 +03:00
"file_size": 650214,
"width": 2560,
"height": 1920
}
],
"caption": "Строковое значение"
},
{
2025-10-15 14:32:00 +03:00
"message_id": 17196,
2024-10-15 10:16:04 +03:00
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
2025-09-12 20:23:31 +03:00
"last_name": "Titovets",
"username": "bayselonarrend",
2024-10-15 10:16:04 +03:00
"type": "private"
},
2025-10-15 14:32:00 +03:00
"date": 1760516489,
"media_group_id": "14084131914453890",
2024-10-15 10:16:04 +03:00
"video": {
"duration": 5,
"width": 640,
"height": 480,
"file_name": "video1",
"mime_type": "video/mp4",
"thumbnail": {
2025-10-15 14:32:00 +03:00
"file_id": "AAMCAgADFQdo71mI3blCfHufVouomgiODDuqqwACKoYAAjdveUs9ROBECfqx2QEAB20AAzYE",
"file_unique_id": "AQADKoYAAjdveUty",
2024-10-15 10:16:04 +03:00
"file_size": 20106,
"width": 320,
"height": 240
},
"thumb": {
2025-10-15 14:32:00 +03:00
"file_id": "AAMCAgADFQdo71mI3blCfHufVouomgiODDuqqwACKoYAAjdveUs9ROBECfqx2QEAB20AAzYE",
"file_unique_id": "AQADKoYAAjdveUty",
2024-10-15 10:16:04 +03:00
"file_size": 20106,
"width": 320,
"height": 240
},
2025-10-15 14:32:00 +03:00
"file_id": "BAACAgIAAxUHaO9ZiN25Qnx7n1aLqJoIjgw7qqsAAiqGAAI3b3lLPUTgRAn6sdk2BA",
"file_unique_id": "AgADKoYAAjdveUs",
2024-10-15 10:16:04 +03:00
"file_size": 1137878
}
}
]
}
```