Send voice
Sends an audio file as a voice message
- Parameters
- Advanced call ?
Function SendVoice(Val Token, Val ChatID, Val File, Val FileType = "m4a", Val ReplyID = 0, Val Keyboard = "") 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 |
| FileType | --type | String | ✖ | Audio type: aac, ogg or m4a |
| ReplyID | --reply | String, Number | ✖ | Replying message id if necessary |
| Keyboard | --keyboard | Array Of String | ✖ | Buttons to the message if necessary |
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
If you want the client to display this file as a playable voice message, it must be in aac, ogg, or m4a format
Method at API documentation: POST /messages/sendVoice
Parameters with Binary data type can also accept file paths on disk and URLs
1C:Enterprise/OneScript code example
Token = "001.3501506236.091...";
ChatID = "689203963@chat.agent";
ReplyID = "7567354422724936211";
File = "https://hut.openintegrations.dev/test_data/song.m4a"; // URL
FilePath = GetTempFileName("m4a"); // Path
CopyFile(File, FilePath);
FileBD = New BinaryData(FilePath); // Binary
Result = OPI_VKTeams.SendVoice(Token, ChatID, File);
Result = OPI_VKTeams.SendVoice(Token, ChatID, FilePath, , ReplyID);
Result = OPI_VKTeams.SendVoice(Token, ChatID, FileBD);
- Bash
- CMD/Bat
oint vkteams SendVoice \
--token "***" \
--chatid "***" \
--file "/tmp/uudahyc1.4he"
oint vkteams SendVoice ^
--token "***" ^
--chatid "***" ^
--file "/tmp/uudahyc1.4he"
Result
{
"fileId": "I000bglGupHpgZZShjZ82s6a1590f11bd",
"msgId": "7644175307292825801",
"ok": true
}