Convert Voice to WhatsApp Format (opus)
Convert any audio file to WhatsApp voice message format (ogg opus).
Usage
The Media facade's convertVoice method may be used to convert an audio file to a WhatsApp-compatible voice message format.
php
use NjoguAmos\Waha\Facades\Media;
use NjoguAmos\Waha\Dto\MediaConvertData;
$data = new MediaConvertData(
url: 'https://example.com/voice.mp3'
);
/** @var \Saloon\Http\Response $response */
$response = Media::convertVoice(data: $data);php
use NjoguAmos\Waha\Facades\Media;
use NjoguAmos\Waha\Dto\MediaConvertData;
$data = new MediaConvertData(
data: 'base64_encoded_audio_content'
);
/** @var \Saloon\Http\Response $response */
$response = Media::convertVoice(data: $data);Response
The response returned by the convertVoice method is an instance of Saloon\Http\Response. You may use the json method to retrieve the response as an array or use it as a binary stream.
php
/** @var \Saloon\Http\Response $response */
$response->status(); // 200
$response->json(); // If application/json is requestedEngines
| WEBJS | WPP | NOWEB | GOWS |
|---|---|---|---|
| ➕ | ➕ | ➕ | ➕ |