1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2026-05-22 10:05:29 +02:00
Files
OpenIntegrations/docs/en/md/VKTeams/Message-sending/Send-file.mdx
T
Vitaly the Alpaca (bot) 2e809b51b0 Main build (Jenkins)
2024-11-17 16:09:58 +03:00

89 lines
2.5 KiB
Plaintext

---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Send file
Sends the file to the chat
`Function SendFile(Val Token, Val ChatID, Val File, Val Text = "", Val FileName = "", Val Markup = "MarkdownV2") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| ChatID | --chatid | String, Number | ✔ | Chat ID for sending |
| File | --file | BinaryData, String | ✔ | File for sending |
| Text | --text | String | ✖ | File caption |
| FileName | --filename | String | ✖ | Displayed file name |
| Markup | --parsemod | String | ✖ | Markup type for message text: MarkdownV2 or HTML |
Returns: Map Of KeyAndValue - serialized JSON response from VK Teams
<br/>
:::tip
Method at API documentation: [POST /messages/sendFile](https://teams.vk.com/botapi/#/messages/post_messages_sendFile)<br/>
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "001.3501506236.091...";
ChatID = "AoLI0egLWBSLR1Ngn2w";
Text = "File caption";
File = "https://api.athenaeum.digital/test_data/document.docx"; // URL
FilePath = GetTempFileName("docx"); // Path
CopyFile(File, FilePath);
FileBD = New BinaryData(FilePath); // Binary
Result = OPI_VKTeams.SendFile(Token, ChatID, File);
Result = OPI_VKTeams.SendFile(Token, ChatID, FilePath, Text);
Result = OPI_VKTeams.SendFile(Token, ChatID, FileBD, Text, "ImportantDocument.docx");
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint vkteams SendFile \
--token "***" \
--chatid "AoLI0egLWBSLR1Ngn2w" \
--file "C:\Users\Administrator\AppData\Local\Temp\01rdidh0rey.tmp" \
--text "File caption" \
--filename "ImportantDocument.docx"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint vkteams SendFile ^
--token "***" ^
--chatid "AoLI0egLWBSLR1Ngn2w" ^
--file "C:\Users\Administrator\AppData\Local\Temp\01rdidh0rey.tmp" ^
--text "File caption" ^
--filename "ImportantDocument.docx"
```
</TabItem>
</Tabs>
```json title="Result"
{
"fileId": "UevBE3dRlqHftBiESLglDn670621531bd",
"msgId": "7423657676132845883",
"ok": true
}
```