---
sidebar_position: 7
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
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 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`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Bot token |
  | ChatID | --chat | String, Number | &#x2714; | Target chat ID or ChatID*TopicID |
  | Text | --text | String | &#x2714; | Message text |
  | FileMapping | --media | Map of KeyAndValue | &#x2714; | File collection: Key > File, Value > Media Type |
  | Keyboard | --keyboard | String | &#x2716; | Keyboard. See FormKeyboardFromButtonArray |
  | Markup | --parsemode | String | &#x2716; | Text processing type (HTML, Markdown, MarkdownV2) |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Telegram

:::tip
Method at API documentation: [sendMediaGroup](https://core.telegram.org/bots/api#sendmediagroup)
:::
<br/>


```bsl title="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);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # 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/veqzrjcq.ta4.docx':'document'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: 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/veqzrjcq.ta4.docx':'document'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "ok": true,
 "result": [
  {
   "message_id": 18411,
   "from": {
    "id": 6129457865,
    "is_bot": true,
    "first_name": "Бот Виталий",
    "username": "sicheebot"
   },
   "chat": {
    "id": 461699897,
    "first_name": "Anton",
    "last_name": "Titovets",
    "username": "bayselonarrend",
    "type": "private"
   },
   "date": 1765390491,
   "media_group_id": "14123123932817578",
   "photo": [
    {
     "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3MAAzYE",
     "file_unique_id": "AQAD6A9rGwABqoBJeA",
     "file_size": 1568,
     "width": "***",
     "height": 67
    },
    {
     "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA20AAzYE",
     "file_unique_id": "AQAD6A9rGwABqoBJcg",
     "file_size": 21633,
     "width": "***",
     "height": 240
    },
    {
     "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3gAAzYE",
     "file_unique_id": "AQAD6A9rGwABqoBJfQ",
     "file_size": 99260,
     "width": "***",
     "height": 600
    },
    {
     "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3kAAzYE",
     "file_unique_id": "AQAD6A9rGwABqoBJfg",
     "file_size": 218651,
     "width": "***",
     "height": 960
    },
    {
     "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3cAAzYE",
     "file_unique_id": "AQAD6A9rGwABqoBJfA",
     "file_size": 650214,
     "width": "***",
     "height": 1920
    }
   ],
   "caption": "Строковое значение"
  },
  {
   "message_id": 18412,
   "from": {
    "id": 6129457865,
    "is_bot": true,
    "first_name": "Бот Виталий",
    "username": "sicheebot"
   },
   "chat": {
    "id": 461699897,
    "first_name": "Anton",
    "last_name": "Titovets",
    "username": "bayselonarrend",
    "type": "private"
   },
   "date": 1765390491,
   "media_group_id": "14123123932817578",
   "video": {
    "duration": 5,
    "width": "***",
    "height": 480,
    "file_name": "video1",
    "mime_type": "video/mp4",
    "thumbnail": {
     "file_id": "AAMCAgADFQdpObib-9eX5PZykc2n4Y3z6EvSzAACUpAAAorsyEkI8dwx8BPymAEAB20AAzYE",
     "file_unique_id": "AQADUpAAAorsyEly",
     "file_size": 20106,
     "width": "***",
     "height": 240
    },
    "thumb": {
     "file_id": "AAMCAgADFQdpObib-9eX5PZykc2n4Y3z6EvSzAACUpAAAorsyEkI8dwx8BPymAEAB20AAzYE",
     "file_unique_id": "AQADUpAAAorsyEly",
     "file_size": 20106,
     "width": "***",
     "height": 240
    },
    "file_id": "BAACAgIAAxUHaTm4m_vXl-T2cpHNp-GN8-hL0swAAlKQAAKK7MhJCPHcMfAT8pg2BA",
    "file_unique_id": "AgADUpAAAorsyEk",
    "file_size": 1137878
   }
  }
 ]
}
```
