Send Message by WhatsApp api using PHP

How to Send Message by WhatsApp API using PHP?


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.

Example usage

Send your first WhatsApp message

require_once ('vendor/autoload.php'); // if you use Composer
//require_once('ultramsg.class.php'); // if you download ultramsg.class.php
$token="tof7lsdJasdloaa57e"; // token
$instance_id="instance1150"; // instance id
$client = new UltraMsg\WhatsAppApi($token,$instance_id);
$body="Hello world"; 

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.

WhatsApp Chat WhatsApp Chat Hello, how can I help you ?