0

We want to send HTML based messages with hyperlinks to Whatsapp through PHP, how it can be possible. We are using api from https://cloudwhats.com

Attaching the code we are using, but its removing the hyperlinks from the URLs.

function sendapp_wp($number,$dr,$dt,$ti,$cen,$name){
    $ch = curl_init();
$message = 'Dear '.$name.', Your Appointment is confirmed with us, '.$cen.'. '.chr(10).chr(10).'Doctor: '.$dr.' '.chr(10).'Date: '.$dt.' '.chr(10).'Time: '.$ti.' '.chr(10).chr(10).'Please report our reception at least 10 min before your scheduled appointment time. Keep at least one hour free time for complete history and examinations by our doctors. Bring hardcopy or soft copies of all old reports and prescriptions.'.chr(10).chr(10).'Click for location map: https://goo.gl/maps/7tG7zsJBQefZYwDm7'.chr(10).'Click here for details: https://www.google.com'.chr(10).'You may call +919339657857 for further details.'.chr(10);
$ii_id='644CB5*******';
$accesstoken='5c3d1bad2c127afdbf4714***********';
    $url = "https://app.wappapi.in/api/send.php";
    $dataArray = ['number' => $number, 'type' => 'text', 'message' => $message, 'instance_id' => $ii_id, 'access_token' => $accesstoken];
    $data = http_build_query($dataArray);
    $getUrl = $url."?".$data;
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_URL, $getUrl);
    curl_setopt($ch, CURLOPT_TIMEOUT, 80);
    $response = curl_exec($ch);
    if(curl_error($ch)){
        echo 'Request Error:' . curl_error($ch);
    }else{
        echo $response;
    }
    curl_close($ch);
}

Please help us in this regard.

Code is working, message also send through WhatsApp to specified number, but its removing the links hyperlinks from the message and make it a plain text, I want it to be a HTML based message.

I want to send text message as such:

I want to make such

But, its coming such, the hyperlinks are removed.

Hyperlinks removed

0 Answers0