1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-10 11:10:31 +02:00
OpenIntegrations/docs/en/md/VKTeams/Message-sending/Send-voice.md
2024-09-29 17:27:25 +03:00

2.0 KiB

sidebar_position
3

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

Parameter CLI option Type 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


:::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 :::

    Token   = "001.3501506236.091...";
    ChatID  = "689203963@chat.agent";
    ReplyID = "7420064343284255240";
    Text    = "File caption";

    File     = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/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);
    
  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%

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