All the template messages that I post once will be received twice by the opposite user. I send messages through php API. I have two apps under one business account, and both are having the same problems. My PHP curl code is:

$messageBody = 'Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.' ; $template_array = array(     "name" => $templateName, //     "language" => '{ "code": "en_US" }',      //"components" => '' //for parameters ) ; $text_arr = array(     'preview_url' => 'false',      'body' => $messageBody ); $fields = array(     'messaging_product' => 'whatsapp',     'recipient_type' => 'individual',     'to' => 91 . $toMobile,     'type' => 'template',     'template' => $template_array,     'type' => 'text',     'text' => $text_arr ); $headers = array( "Authorization: Bearer " . $accessToken, "Content-Type: application/json", ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $postUrl); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($fields) ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers ); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = json_decode(curl_exec($curl), true); //print_r($response); $jsonResult = curl_exec($curl) ; $resultCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); echo $resultCode . ' - ' . $jsonResult ; curl_close($curl); 

Tag:php, curl, whatsapp

Add a new comment.