<?php
include('php_gene1.php');
// echo '*** WH VCRXOL';
// This is your webhook. You must configure it in the number settings section. 

// $data = json_decode($_POST["data"]); 

//    $instance=$dat->instanceId;
//    $messages=$dat->messages;
//    $numero=$data->autor;
// $numero='593996030903';
$numero='593998898014';
//    $numero='593996030568';
echo '/*/*/*/*'.$numero;
//    echo send_wsapp1($numero,' ESTOY ESCUCHANDO RECIBIDO OK : '.date('Y-m-d H:i:s').$data->text);   


// When you receive a message an INBOX event is created 
// if ($data->event=="INBOX") 
// { 
//   // Default answer 
//   $my_answer = "This is an autoreply from VCRXOL.COM!. You (". $data->from .") wrote: ". $data->text; 

   
//    $numero=$data->autor;
//    send_wsapp1($numero,'RECIBIDO OK : '.$data->body);   
   
//   // You can evaluate the received message and prepare your new answer. 
//   $texto=trim(strtoupper($data->text));
//   if(substr($texto,0,8)=='REGISTRO')
//   {
//     $xcia=$texto;
//     $xcia=trim(substr($xcia,8,20)); $refx=$xcia;
    
//     $xcia=trim(substr($xcia,0,strpos($xcia,' ')));
    
     
// //     $my_answer='Prueba de respuesta';
//   }
//   else if(!(strpos(strtoupper($data->text), "PRICING")===false))
//   {$my_answer = "Sing up in our platform and you will get our pricing list!";}
//   else if(!(strpos(strtoupper($data->text), "INFORMATION")===false))
//   {$my_answer = "Of course! For more information you can access to our website http://www.vcrxol.com!";} 

//   /* You don't need any APIKEY to answer to your customer from a webhook */ 
//   $response = new StdClass(); 
//   $response->apiwha_autoreply = $my_answer; // Attribute "apiwha_autoreply" is very important! 
//   echo json_encode($response); // Don't forget to reply in JSON format 

// }
// elseif ($data->event=="MESSAGEPROCESSED")
// {
//   /* Here, you can do whatever you want */ 
// //   "custom_data":"your own id 1234"
// }
// elseif ($data->event=="MESSAGEFAILED")
// { 
//   // NO TIENE WHATASSPP
//   /* Here, you can do whatever you want */ 
// //   "custom_data":"your own id 1234"
// } 



?>