Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
voice |
InputFile or String |
Yes |
Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data. |
duration |
Integer |
Optional |
Duration of sent audio in seconds |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply