In this tutorial, we will create a page to send WhatsApp message via api using php
Just download ultramsg.class.php or use Composer:
composer require ultramsg/whatsapp-php-sdk
Sign up and Go to your instance dashboard and copy your Instance ID and Token which will be used for authenticating.
require_once ('vendor/autoload.php'); // if you use Composer
//require_once('ultramsg.class.php'); // if you download ultramsg.class.php
$token="tof7lsdJasdloaa57e"; // Ultramsg.com token
$instance_id="instance1150"; // Ultramsg.com instance id
$client = new UltraMsg\WhatsAppApi($token,$instance_id);
$to="put_your_mobile_number_here";
$body="Hello world";
$api=$client->sendChatMessage($to,$body);
print_r($api);
you can also send ( Image , Document , Audio , Voice , Video , Link , Contact , Location , Vcard )
and setup webhook and receive messages and more ..
All the code, Full Documentation, is available on GitHub.