You can Send a ppt audio recording to the phone number or group, But WhatsApp is sensitive to this extension, you need to be in OGG format and the codecs should be the opus .
Example opus Ogg file :
Initially, to send a Voice clip using WhatsApp API you can use this route :
https://docs.ultramsg.com/api/post/messages/voice
.OGG example file :
https://file-example.s3-accelerate.amazonaws.com/voice/oog_example.ogg
You can record an audio clip in the WhatsApp application on the phone, then upload the file and upload it to your site or to a CDN, then use the URL and send the audio clip through the WhatsApp API to your customers,Or you can convert any mp3 or wav audio file to OGG using one of the free tools as in the next step.
Convert audio file to Ogg format:
Go to convertio.co website, And follow these steps :
congratulations… The file will be converted, and the file can be downloaded and uploaded to your site, then the OGG file will be sent via WhatsApp API through Ultramsg.
Convert Audio Files to WhatsApp-Compatible OGG Format Using PHP and FFmpeg
<?php
// Path to the input file
$inputFile = '1.mpeg'; // Update the path to your source audio file
// Path to the output file
$outputFile = 'output.ogg'; // Name of the output file
// Conversion settings for WhatsApp compatibility
$bitrate = '32k'; // Bitrate (32k is recommended for WhatsApp compatibility)
$samplingRate = '48000'; // Sampling rate (48000 Hz is required by WhatsApp)
$channels = '1'; // Single channel (Mono)
// Verify FFmpeg is installed on the server
$ffmpegPath = 'ffmpeg'; // If FFmpeg is installed in a different location, update the path here
// FFmpeg command to convert the file
$command = escapeshellcmd("$ffmpegPath -i " . escapeshellarg($inputFile) . // Specify the input file
" -c:a libopus -b:a $bitrate -ar $samplingRate -ac $channels " . // Set codec, bitrate, sample rate, and channels
escapeshellarg($outputFile)); // Specify the output file
// Execute the command
exec($command, $output, $returnVar);
// Check if the conversion was successful
if ($returnVar === 0) {
echo "The file was successfully converted to a WhatsApp-compatible OGG format!";
} else {
echo "Error: File conversion failed. Please check your FFmpeg installation and the input file.";
}
?>