1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-05 22:53:35 +02:00
Files
OpenIntegrations/docs/en/md/Telegram/Data-sending/Send-document.md

87 lines
2.5 KiB
Markdown
Raw Normal View History

---
sidebar_position: 5
---
# 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 | Description |
|-|-|-|-|
| Token | --token | String | Bot token |
| ChatID | --chat | String, Number | Target chat ID or ChatID*TopicID |
| Text | --text | String | Message text |
2024-10-11 09:59:59 +03:00
| Document | --doc | BinaryData, String | Document file |
| Keyboard | --keyboard | String | Keyboard. See FormKeyboardFromButtonArray |
| Markup | --parsemode | String | Text processing type (HTML, Markdown, MarkdownV2) |
| FileName | --filename | String | Custom displayed file name with extension, if necessary |
2024-10-09 09:42:00 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
2024-07-10 14:05:58 +03:00
<br/>
2024-10-11 09:59:59 +03:00
:::tip
Method at API documentation: [sendDocument](https://core.telegram.org/bots/api#senddocument)
:::
<br/>
2024-07-10 13:58:29 +03:00
```bsl title="Code example"
2024-09-24 11:38:18 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
ChannelID = "@testsichee";
Text = "Строковое значение";
2024-10-15 10:07:27 +03:00
Document = "https://api.athenaeum.digital/test_data/document.docx";
2024-08-13 16:47:32 +03:00
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");
```
2024-10-15 09:53:37 +03:00
```json title="Result"
2024-08-14 09:06:31 +03:00
{
2024-10-06 16:55:08 +03:00
"ok": true,
"result": {
2024-10-09 09:42:00 +03:00
"message_id": 8307,
"from": {
2024-10-06 16:55:08 +03:00
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
2024-10-06 16:55:08 +03:00
"id": 461699897,
"first_name": "Anton",
"last_name": "Titowets",
"username": "JKIee",
"type": "private"
},
2024-10-09 09:42:00 +03:00
"date": 1728453390,
"document": {
2024-10-06 16:55:08 +03:00
"file_name": "document.docx",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
2024-10-09 09:42:00 +03:00
"file_id": "BQACAgIAAxkDAAIgc2cGGw4a6yPdiNLubNQsFLQQPLHoAAJPWgAC_cg4SJF9HYfiILIbNgQ",
"file_unique_id": "AgADT1oAAv3IOEg",
2024-10-06 16:55:08 +03:00
"file_size": 24069
},
2024-10-06 16:55:08 +03:00
"caption": "Строковое значение"
}
}
```