--- sidebar_position: 5 description: "Send document" 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 document Sends a document to a chat or channel `Function SendDocument(Val Token, Val ChatID, Val Text, Val Document, Val Keyboard = "", Val Markup = "Markdown", Val FileName = "") 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 | | Document | --doc | BinaryData, String | ✔ | Document file | | Keyboard | --keyboard | String, Structure Of KeyAndValue | ✖ | Keyboard. See FormKeyboardFromButtonArray | | Markup | --parsemode | String | ✖ | Text processing type (HTML, Markdown, MarkdownV2) | | FileName | --filename | String | ✖ | Custom displayed file name with extension, if necessary | Returns: Map Of KeyAndValue - serialized JSON response from Telegram
:::tip Method at API documentation: [sendDocument](https://core.telegram.org/bots/api#senddocument) Parameters with Binary data type can also accept file paths on disk and URLs :::
```bsl title="1C:Enterprise/OneScript code example" Token = "6129457865:AAFyzNYOAFbu..."; ChatID = "461699897"; ChannelID = "@testsichee"; Text = "Строковое значение"; Document = "https://api.athenaeum.digital/test_data/document.docx"; DocumentPath = GetTempFileName("docx"); CopyFile(Document, DocumentPath); DocumentDD = New BinaryData(DocumentPath); Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document); Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document, , , "customname.docx"); Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath); Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD, , , "customname.docx"); ``` ```bash oint telegram SendDocument \ --token "***" \ --chat "@testsichee" \ --text "Строковое значение" \ --doc "C:\Users\Administrator\AppData\Local\Temp\yvtfo550e23.docx" \ --filename "custom.docx" ``` ```batch oint telegram SendDocument ^ --token "***" ^ --chat "@testsichee" ^ --text "Строковое значение" ^ --doc "C:\Users\Administrator\AppData\Local\Temp\yvtfo550e23.docx" ^ --filename "custom.docx" ``` ```json title="Result" { "ok": true, "result": { "message_id": 8307, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": 461699897, "first_name": "Anton", "last_name": "Titowets", "username": "JKIee", "type": "private" }, "date": 1728453390, "document": { "file_name": "document.docx", "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "file_id": "BQACAgIAAxkDAAIgc2cGGw4a6yPdiNLubNQsFLQQPLHoAAJPWgAC_cg4SJF9HYfiILIbNgQ", "file_unique_id": "AgADT1oAAv3IOEg", "file_size": 24069 }, "caption": "Строковое значение" } } ```