<?php
$token = 'EAAEdR4iWMnQBO2Ki6kSjZBqkGErMrs8UxrvWAsC5nZCEur7kZAPNhfpPNCIC2ZBSgJClOPvfasON7Cfv2yavtKvANe2WLyd7sJGZAGAarPIuSVZBv5D18eMKoio2yoFmhVtc4ZCZCElSJhf0o4Q6CgGOL7hBdp6ZAbZCIsiS3fqBCH1hUtclPAZCiUMfsrdiZBzvS1ZAk50Utiud2djZASsdFz';
$telefono = '8294014117';
$url = 'https://graph.facebook.com/v17.0/165221420014421/messages';
$mensaje = ''
. '{'
. '"messaging_product": "whatsapp", '
. '"to": "'.$telefono.'", '
. '"type": "text", '
. '"text": '
. '{'
. ' "body": "your-message-content"'
. '} '
. '}';
$header = array("Authorization: Bearer " . $token, "Content-Type: application/json",);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POSTFIELDS, $mensaje);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($curl), true);
print_r($response);
$status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
?>
|