Код: Выделить всё
$phone_number = "MOBILENUMBER"; // The phone number of the recipient in international format
$message_text = "Hello, this is a test message from the WhatsApp Business API!"; // The message text
$api_endpoint = 'https://graph.facebook.com/v20.0//messages';
// for more details https://developers.facebook.com/docs/whatsapp/business-management-api/get-started/
$api_token = "YOUR_TOKEN_HERE"; // Replace with your own API token
$data = array(
'messaging_product' => "whatsapp",
'to' => $phone_number,
// 'type' => "template",
// 'template' => array("name"=> "hello_world",'language'=>array("code"=>"en_Us"))
'type' => 'text',
'text' => array("preview_url"=> false,'body'=>$message_text)
);
$ch = curl_init($api_endpoint);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', "Authorization: Bearer $api_token"));
$result = curl_exec($ch);
curl_close($ch);
Подробнее здесь: https://stackoverflow.com/questions/789 ... t-for-same