1. Go to this page and download the library: Download joemunapo/whatsapp-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$payload = // ... webhook payload from WhatsApp
$message = Whatsapp::handleWebhook($payload);
if ($message) {
// Process the message
$message->reply('Thank you for your message!');
}
$mediaId = 'media_id_from_webhook_payload';
$mediaInfo = $whatsapp->getMedia($mediaId);
// The $mediaInfo will contain details about the media, including the URL to download it
$mediaUrl = $mediaInfo['url'];
// You can then download and process the media as needed