You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-05-22 10:05:29 +02:00
67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
---
|
|
sidebar_position: 3
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# 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 | 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
|
|
|
|
<br/>
|
|
|
|
:::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](https://teams.vk.com/botapi/#/messages/post_messages_sendVoice)<br/>
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="Code example"
|
|
Token = "001.3501506236.091...";
|
|
ChatID = "689203963@chat.agent";
|
|
ReplyID = "7425684917876428136";
|
|
|
|
File = "https://api.athenaeum.digital/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);
|
|
```
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"fileId": "I000bPC37Th9syNcxyaG4r670621651bd",
|
|
"msgId": "7423657753442257991",
|
|
"ok": true
|
|
}
|
|
```
|