How do i send image on whatsapp using php?

    Table of contents
  • How to send image,audio or video through the WhatsApp API - PHP
  • Send Message by WhatsApp api using PHP
  • How To Send Images on WhatsApp using PHP
  • How to Send a Message by WhatsApp API using PHP easily
  • Send and Receive Media Messages with WhatsApp in PHP
  • API Whatsapp send file, php
  • I want to get whatsapp images in my php website using whatsapi. is it possible?

How to send image,audio or video through the WhatsApp API - PHP

//send picture
$w->sendMessageImage($target, "demo/x3.jpg");

Send Message by WhatsApp api using PHP

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);

How To Send Images on WhatsApp using PHP

$ mkdir demo
$ cd demo
$ touch twilioWhatsAppMessaging.php .env
$ composer require twilio/sdk vlucas/phpdotenv
load();

$sid    = getenv('TWILIO_SID');
$token  = getenv('TWILIO_TOKEN');


$twilio = new Client($sid, $token);

$message = $twilio->messages
                 ->create(
                     "whatsapp:+254712345678",
                     [
                              "mediaUrl" => ["https://images.unsplash.com/photo-1431250620804-78b175d2fada?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1600&h=900&fit=crop&ixid=eyJhcHBfaWQiOjF9"],
                              "from" => "whatsapp:+14155238886",
                              "body" => "Snacks maybe?"
                     ]
                 );
TWILIO_SID=your_twilio_sid
TWILIO_TOKEN=your_twilio_token

How to Send a Message by WhatsApp API using PHP easily

composer require ultramsg/whatsapp-php-sdk
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);
$to="put_your_mobile_number_here"; 
$caption="image Caption"; 
$image="https://file-example.s3-accelerate.amazonaws.com/images/test.jpg"; 
$api=$client->sendImageMessage($to,$caption,$image);
print_r($api);
$to="put_your_mobile_number_here"; 
$filename="image Caption"; 
$document="https://file-example.s3-accelerate.amazonaws.com/documents/cv.pdf"; 
$api=$client->sendDocumentMessage($to,$filename,$document);
print_r($api);
$to="put_your_mobile_number_here"; 
$audio="https://file-example.s3-accelerate.amazonaws.com/audio/2.mp3"; 
$api=$client->sendAudioMessage($to,$audio);
print_r($api);
$to="put_your_mobile_number_here"; 
$audio="https://file-example.s3-accelerate.amazonaws.com/voice/oog_example.ogg"; 
$api=$client->sendVoiceMessage($to,$audio);
print_r($api);
$to="put_your_mobile_number_here"; 
$video="https://file-example.s3-accelerate.amazonaws.com/video/test.mp4"; 
$api=$client->sendVideoMessage($to,$video);
print_r($api);
$to="put_your_mobile_number_here"; 
$link="https://ultramsg.com"; $api=$client->sendLinkMessage($to,$link);
print_r($api);
$to="put_your_mobile_number_here"; 
$contact="[email protected]"; 
$api=$client->sendContactMessage($to,$contact);
print_r($api);
$to="put_your_mobile_number_here"; 
$address="ABC company \n Sixth floor , office 38"; 
$lat="25.197197"; 
$lng="55.2721877"; 
$api=$client->sendLocationMessage($to,$address,$lat,$lng);
print_r($api);
$to="put_your_mobile_number_here"; 
$vcard="BEGIN:VCARD
VERSION:3.0
N:lastname;firstname
FN:firstname lastname
TEL;TYPE=CELL;waid=14000000001:14000000002
NICKNAME:nickname
BDAY:01.01.1987
X-GENDER:M
NOTE:note
ADR;TYPE=home
ADR;TYPE=work
END:VCARD";
$vcard = preg_replace("/[\n\r]/", "\n", $vcard);
$api=$client->sendVcardMessage($to,$vcard);
print_r($api)

Send and Receive Media Messages with WhatsApp in PHP

composer require twilio/sdk
php send_whatsapp_media.php
"subresource_uris": {"media": "/2010-04 01/Accounts/ACxxxxxxxx/Messages/SMxxxxxxxxxxxxx/Media.json"}

   Thanks for the message!

API Whatsapp send file, php

var $APIurl = 'https://api.chat-api.com/instanceYYYYY/';
var $token = 'abcdefgh22345678';
$message = $_GET['text'];
$phone = $_GET['phone'];
$data = json_encode(array(
    'chatId'=>$phone.'@c.us',
    'body'=>'https://domain.com/PHP/picture.jpg',
    'filename'=>'picture.jpg',
    'caption'=>'Hey! There is a file!'
));
$url = $apiURL.'sendFile?token='.$token;
$options = stream_context_create(['http' => [
    'method'  => 'POST',
    'header'  => 'Content-type: application/json',
    'content' => $data
]
]);
$response = file_get_contents($url,false,$options);
echo $response;
if(!isset($_GET['phone'])){ die('Not enough data');}

$apiURL = 'https://api.chat-api.com/instanceXXXXX/';
$token = 'abcdefgABCDEFG';

$phone = $_GET['phone'];

$data = json_encode(array(
    'chatId'=>$phone.'@c.us',
    'body'=>'https://domain.com/PHP/picture.jpg',
    'filename'=>'picture.jpg',
    'caption'=>'Hey! There is a file!'
));

$url = $apiURL.'sendFile?token='.$token;
$options = stream_context_create(['http' => [
    'method'  => 'POST',
    'header'  => 'Content-type: application/json',
    'content' => $data
]
]);
$response = file_get_contents($url,false,$options);
echo $response; exit;

I want to get whatsapp images in my php website using whatsapi. is it possible?

$this->wa->eventManager()->bind('onGetMessage', array($this, 'processReceivedMessage'));

Next Lesson PHP Tutorial

How do I integrate WhatsApp in PHP?

Programmable Messaging for WhatsApp and PHP Quickstart.
Sign up for Twilio and activate the Sandbox..
Set up your development environment to send and receive messages..
Opt-in to the Sandbox..
Send your first WhatsApp message..
Receive inbound WhatsApp messages..
Reply to incoming WhatsApp messages..

How do I send an image via WhatsApp?

How to share photos in WhatsApp for Android.
Tap the camera button on the right of the message field..
Tap the button to take your photo. Tap and hold to take a video instead..
Add a caption or use the crop and rotate tools to personalize it..
Tap the Send button to send your photo..

How can I send and receive messages on WhatsApp using PHP?

Here's another example:.
Use: https://api.whatsapp.com/send? phone=15551234567..
Don't use: https://api.whatsapp.com/send? phone=+001-(555)1234567..
UPDATE APRIL, 24 2022..
Use: https://wa.me/1XXXXXXXXXX..
Don't use: https://wa.me/+001-(XXX)XXXXXXX..

How can I send message to WhatsApp API?

Install the WhatsApp Business API Client — Install your API client. Once your client is working, you can update your application settings. Start using the client — Register your phone number with an API call to /account and send a test message with a call to /messages .