mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-03-07 15:20:39 +02:00
2.0 KiB
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 = FunctionParameters["VkTeams_Token"];
ChatID = FunctionParameters["VkTeams_ChatID2"];
ReplyID = FunctionParameters["VkTeams_MessageID"];
Text = "File caption";
File = FunctionParameters["Audio2"] ; // URL
FilePath = GetTempFileName("m4a"); // Path
CopyFile(File, FilePath);
FileBD = New BinaryData(FilePath); // Binary
Result = OPI_VKTeams.SendVoice(Token, ChatID, File);
OPI_TestDataRetrieval.WriteLog(Result, "SendVoice (URL)", "VkTeams");
Result = OPI_VKTeams.SendVoice(Token, ChatID, FilePath, ,ReplyID);
OPI_TestDataRetrieval.WriteLog(Result, "SendVoice (Path)", "VkTeams");
Result = OPI_VKTeams.SendVoice(Token, ChatID, File);
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%