
Send Whatsapp Text Message
Send Text Message to Whatsapp Number Using API in PHP
Before Sending Message Scan Whatsapp QR Code

Send Text Message:
GET /api/sendText?token=<instance id>&phone=<phone>&message=<message>
http://whatsappsms.domain.in/api/sendText?token=<instanceid>&phone=91xxxxxxxxxx&message=hello
Request Parameter
token: instance id
phone: phone number with country code before phone no. e.g. for India 91xxxxxxxxxx
message: Use urlencode to message before sending
Response
{
"status": "success",
"message": "00-Success",
"data": {
"connStatus": true,
"messageIDs": [
"61b84e20683424077a302b00"
]
},
"responsetime": 4.589305109
}
Using PHP Curl Function to Send Whatsapp API
<?php
$instance = '123XXX456XXXX789';
$whatsapp_number = '123XXXXXX'; // with country Code
$content = 'Hello World';
$url = "http://whatsappsms.domain.in/api/sendText?token=".$instance."&phone=".$whatsapp_number."&message=".urlencode($content)."";
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL,$url);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_close($ch);
?>
Output :

