Send file
Sends the file to the chat
- Parameters
- Advanced call ?
Function SendFile(Val Token, Val ChatID, Val File, Val Text = "", Val FileName = "", Val Markup = "MarkdownV2", Val ContentType = "image/jpeg") 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 |
| ContentType | --type | String | ✖ | Content type for sending |
Returns
Map Of KeyAndValue - serialized JSON response from VK Teams
| Parameter | Description |
|---|---|
| proxy | InternetProxy or a structure with fields Protocol, Host, Port, User, Password, UseOSAuthentication |
| timeout | Request execution timeout |
| adv_response | Formats the response as a complete HTTP structure with fields code, body, and headers |
| retries | Number of HTTP request send attempts on 5** status codes or internal client errors |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
Method at API documentation: POST /messages/sendFile
Parameters with Binary data type can also accept file paths on disk and URLs
1C:Enterprise/OneScript code example
Token = "001.3501506236.091...";
ChatID = "AoLI0egLWBSLR1Ngn2w";
Text = "File caption";
File = "https://hut.openintegrations.dev/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");
- Bash
- CMD/Bat
oint vkteams SendFile \
--token "***" \
--chatid "***" \
--file "/tmp/dvr3n1eh.w1f" \
--text "File caption" \
--filename "ImportantDocument.docx"
oint vkteams SendFile ^
--token "***" ^
--chatid "***" ^
--file "/tmp/dvr3n1eh.w1f" ^
--text "File caption" ^
--filename "ImportantDocument.docx"
Result
{
"fileId": "zdwGrmsIdg4JVjzDXQvFTi6a1590ea1bd",
"msgId": "7644175277228048824",
"ok": true
}