<?php /** * Telegram Bot Example whitout WebHook. * It uses getUpdates Telegram's API. * @author Gabriele Grillo <*****@*****.**> */ include "Telegram.php"; $bot_id = "bot_token"; $telegram = new Telegram($bot_id); // Get all the new updates and set the new correct update_id $req = $telegram->getUpdates(); for ($i = 0; $i < $telegram->UpdateCount(); $i++) { // You NEED to call serveUpdate before accessing the values of message in Telegram Class $telegram->serveUpdate($i); $text = $telegram->Text(); $chat_id = $telegram->ChatID(); if ($text == "/start") { $reply = "Working"; $content = array('chat_id' => $chat_id, 'text' => $reply); $telegram->sendMessage($content); } if ($text == "/test") { if ($telegram->messageFromGroup()) { $reply = "Chat Group"; } else { $reply = "Private Chat"; } // Create option for the custom keyboard. Array of array string $option = array(array("A", "B"), array("C", "D")); // Get the keyboard