2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 5
2025-05-05 11:15:20 +03:00
description: Download file 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
# Download file
Download file from Telegram servers
`Function DownloadFile(Val Token, Val FileID) Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Token |
| FileID | --fileid | String | ✔ | File ID for downloading |
2024-10-15 10:16:04 +03:00
Returns: BinaryData - file's binary data
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [getFile](https://core.telegram.org/bots/api#getfile)
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"
2025-06-27 11:47:43 +03:00
FileID = FunctionParameters["Telegram_FileID"];
Token = FunctionParameters["Telegram_Token"];
2024-10-15 10:16:04 +03:00
Result = OPI_Telegram.DownloadFile(Token, FileID);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram DownloadFile \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-06-18 21:53:54 +03:00
--fileid "CQACAgIAAx0EcNsaZQACRdRoUvCZXBQV_SJ69h82-RsIYuqw-AAC_X4AAlxdmErRGvmCDBh0XzYE"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram DownloadFile ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-06-18 21:53:54 +03:00
--fileid "CQACAgIAAx0EcNsaZQACRdRoUvCZXBQV_SJ69h82-RsIYuqw-AAC_X4AAlxdmErRGvmCDBh0XzYE"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
NOT JSON: 49 44 33 03 00 00 00 05 1F 76 54 49 54 32 00 00 00 0B 00 00 01 FF FE 44 00 6F 00 67 00 73 00 54 50 45 31 00 00 00 15 00 00 01 FF FE 4D 00 6F 00 74 00 6F 00 72 00 68 00 65 00 61 00 64 00 54 59…
```