Skip to main content

Send voice

Sends an audio file as a voice message

Function SendVoice(Val Token, Val ChatID, Val File, Val FileType = "m4a", Val ReplyID = 0, Val Keyboard = "") Export

ParameterCLI optionTypeDescription
Token--tokenStringBot token
ChatID--chatidString, NumberChat ID for sending
File--fileBinaryData, StringFile for sending
FileType--typeStringAudio type: aac, ogg or m4a
ReplyID--replyString, NumberReplying message id if necessary
Keyboard--keyboardArray Of StringButtons to the message if necessary

Returns: Map Of KeyAndValue - Serialized JSON response from VK Teams


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


Code example
    Token   = "001.3501506236.091...";
ChatID = "689203963@chat.agent";
ReplyID = "7407047289547522916";
Text = "File caption";

File = "https://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);
CLI command example
    
oint vkteams SendVoice --token "001.3501506236.091..." --chatid "689203963@chat.agent" --file "https://openintegrations.dev/test_data/song.m4a // URL" --type %type% --reply "7402287649739767956" --keyboard %keyboard%

Result
{
"fileId": "I000brjuglT3K5cB4dWEht66c111071bd",
"msgId": "7404217984136249577",
"ok": true
}