APIDoc

Did You Know?

SINGLE WhatsApp API (POST)

Using this WhatsApp API can send tex and media whatsapp message.

Base URL

                                          https://hajanaone.com/api/waAPI.php
                                    

Important Parameters

Follow the following parameters during SMS API Integration.

        
Parameters Requeired Where it
apikey Yes Get your api key from your Dashboard.
waid Yes your whatsapp API number.
phone Yes Add your phone num with Country code. EX: 923354678925
message Yes Enter your message content here. (paste media URL if message type is not text
type Message content tyle text, image, audio, video, document

PHP Code

                                        
                                        
<?php 

$user_api   =    '******';
$number     =    923001234567;
$waid     =    '923218528520';
$message    =    'Test whatsapp message from Hajana One';
$type     =    'text';

// sending whatsapp message

$url = "https://hajanaone.com/api/waAPI.php";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Content-Type: application/x-www-form-urlencoded",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$data = "apikey=$user_api&waid=$waid&phone=$number&message=rawurlencode($message)&type=$type";

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);

?>
                                        
                                         
                                    

Java Script/AJAX Code

                                        
                                        
<script> 

var url = "https://hajanaone.com/api/waAPI.php";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
      console.log(xhr.status);
      console.log(xhr.responseText);
   }};


var data = "apikey=************&waid=923354812520&phone=923336458112&message=hello+test&type=text";

xhr.send(data);

</script>
                                        
                                         
                                    

C# / .NET Code

                                        
                                        


var url = "https://hajanaone.com/api/waAPI.php";

var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";

httpRequest.ContentType = "application/x-www-form-urlencoded";

var data = "apikey=****************&waid=923354812520&phone=923336458112&message=hello%20test&type=text";

using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
{
   streamWriter.Write(data);
}

var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
   var result = streamReader.ReadToEnd();
}

Console.WriteLine(httpResponse.StatusCode);