January 6, 2022
WhatsApp API by ultramsg & php
Introduction
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
Example usage
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);
What’s next?
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.
For more information about the integration with WhatsApp API
Visit the ultramsg.com