Closed maddymathan closed 1 year ago
Hi @maddymathan show your code please. Thanks.
require_once 'vendor/autoload.php';
use Netflie\WhatsAppCloudApi\Message\Media\LinkID; use Netflie\WhatsAppCloudApi\Message\Media\MediaObjectID;
$document_id = 'EAAGSBUkK7tsBALDFPuZB29O6k7bFk53AsEp2KW1yNIBsxeqs8FuWfQsfUtk3b0llw2WsZBkou1NZB7Kr4mW3j2LIqws5WGGM3FqJX9IFXBVNdmhHOaGIgv8MyVDbJFqj9kL10OuDXOKZA7W9zCJN94jfynQq5drxlAyj4QsnkUMqYQbmPByL'; $document_name = 'ATM001_08-10-2022.pdf'; $document_caption = 'WhastApp API Cloud Guide';
// With the Media Object ID of some document upload on the WhatsApp Cloud servers $media_id = new MediaObjectID($document_id); $whatsapp_cloud_api->sendDocument('918248175266', $media_id, $document_name, $document_caption);
// Or //$document_link = 'https://netflie.es/wp-content/uploads/2022/05/image.png'; //$link_id = new LinkID($document_link); //$whatsapp_cloud_api->sendDocument('918248175266', $link_id, $document_name, $document_caption);
i have updated the code
The variable $whatsapp-cloud-api is not instantiated in your code.
//whatsapp-cloud-api
I don't understand whatsapp-cloud-api was not available in your sample code. You have using as whatsapp_cloud_api but still is not working brother.
Notice: Undefined variable: whatsapp_cloud_api in E:\xampp_7.4.6\xampp\htdocs\whatsapp_api\wa_cloud_api\index.php on line 14
Fatal error: Uncaught Error: Call to a member function sendDocument() on null in E:\xampp_7.4.6\xampp\htdocs\whatsapp_api\wa_cloud_api\index.php:14 Stack trace: #0 {main} thrown in E:\xampp_7.4.6\xampp\htdocs\whatsapp_api\wa_cloud_api\index.php on line 14