i want my telegram bot to notify my php script when new message is received ... basically when someone send a message to my telegram bot ... i want my bot redirect that message to a php script
i've set the webhook
function set_webhook(){
$adta = file_get_contents("https://api.telegram.org/bottoken/setWebhook?url=". base_url()."index/telegramcallback");
var_dump($adta);
}
and it was hooked ok
now in my callback function i have something like
function telegramcallback(){
$to = 'mymail@gmail.com';
$subject = 'new telegram message';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, json_encode($_REQUEST), $headers);
}
and it kinda works , but i receive an empty email ... im not sure if im getting message body wrong or telegram bot doesnt send the messages just calls the callback url ?