I'm using Chat API of whatsApp to send message to recipient with PHP. How can I use html tag in the body to send message ?
$msg ="
Please visit this link.
<a href='example.com'>VISIT US</a>
";
$data = [
'phone' => '+16666666666',
'body' => "$msg", // Message
];
$json = json_encode($data); // Encode data to JSON
// URL for request POST /message
$token = 'xxxxxxxx';
$instanceId = 'xxxxx';
$url = 'https://api.chat-api.com/instance'.$instanceId.'/message?token='.$token;
// Make a POST request
$options = stream_context_create(['http' => [
'method' => 'POST',
'header' => 'Content-type: application/json',
'content' => $json
]
]);
// Send a request
$result = file_get_contents($url, false, $options);