1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-01 22:29:52 +02:00
Files
OpenIntegrations/docs/en/md/Telegram/Data-sending/Send-media-group.mdx

194 lines
5.8 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 7
2025-05-05 10:07:34 +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-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
Text = "Строковое значение";
Image = "https://api.athenaeum.digital/test_data/picture.jpg";
Video = "https://api.athenaeum.digital/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);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +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 "***" \
--chat "@testsichee" \
--text "Строковое значение" \
2025-05-01 20:09:27 +03:00
--media "{'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/document.docx':'document','C:\\Users\\Administrator\\AppData\\Local\\Temp\\qyo1ply53ig.docx':'document'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +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 "***" ^
--chat "@testsichee" ^
--text "Строковое значение" ^
2025-05-01 20:09:27 +03:00
--media "{'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/document.docx':'document','C:\\Users\\Administrator\\AppData\\Local\\Temp\\qyo1ply53ig.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": [
{
"message_id": 8310,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titowets",
"username": "JKIee",
"type": "private"
},
"date": 1728453419,
"media_group_id": "13827627353456290",
"photo": [
{
"file_id": "AgACAgIAAxkDAAIfmWb-MR8PQhrvZHiqLmG6UdiAAznzAALj5DEb1I7wSxB3bmqDIveAAQADAgADcwADNgQ",
"file_unique_id": "AQAD4-QxG9SO8Et4",
"file_size": 1568,
"width": 90,
"height": 67
},
{
"file_id": "AgACAgIAAxkDAAIfmWb-MR8PQhrvZHiqLmG6UdiAAznzAALj5DEb1I7wSxB3bmqDIveAAQADAgADbQADNgQ",
"file_unique_id": "AQAD4-QxG9SO8Ety",
"file_size": 21633,
"width": 320,
"height": 240
},
{
"file_id": "AgACAgIAAxkDAAIfmWb-MR8PQhrvZHiqLmG6UdiAAznzAALj5DEb1I7wSxB3bmqDIveAAQADAgADeAADNgQ",
"file_unique_id": "AQAD4-QxG9SO8Et9",
"file_size": 99260,
"width": 800,
"height": 600
},
{
"file_id": "AgACAgIAAxkDAAIfmWb-MR8PQhrvZHiqLmG6UdiAAznzAALj5DEb1I7wSxB3bmqDIveAAQADAgADeQADNgQ",
"file_unique_id": "AQAD4-QxG9SO8Et-",
"file_size": 218651,
"width": 1280,
"height": 960
},
{
"file_id": "AgACAgIAAxkDAAIfmWb-MR8PQhrvZHiqLmG6UdiAAznzAALj5DEb1I7wSxB3bmqDIveAAQADAgADdwADNgQ",
"file_unique_id": "AQAD4-QxG9SO8Et8",
"file_size": 650214,
"width": 2560,
"height": 1920
}
],
"caption": "Строковое значение"
},
{
"message_id": 8311,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titowets",
"username": "JKIee",
"type": "private"
},
"date": 1728453419,
"media_group_id": "13827627353456290",
"video": {
"duration": 5,
"width": 640,
"height": 480,
"file_name": "video1",
"mime_type": "video/mp4",
"thumbnail": {
"file_id": "AAMCAgADFQdnBhsq6-bI-FK3CYb2iTi0EMaRSQACU1oAAv3IOEhuDaGGTZyj9AEAB20AAzYE",
"file_unique_id": "AQADU1oAAv3IOEhy",
"file_size": 20106,
"width": 320,
"height": 240
},
"thumb": {
"file_id": "AAMCAgADFQdnBhsq6-bI-FK3CYb2iTi0EMaRSQACU1oAAv3IOEhuDaGGTZyj9AEAB20AAzYE",
"file_unique_id": "AQADU1oAAv3IOEhy",
"file_size": 20106,
"width": 320,
"height": 240
},
"file_id": "BAACAgIAAxUHZwYbKuvmyPhStwmG9ok4tBDGkUkAAlNaAAL9yDhIbg2hhk2co_Q2BA",
"file_unique_id": "AgADU1oAAv3IOEg",
"file_size": 1137878
}
}
]
}
```