K
K
ksandr_maykop2018-03-16 12:28:27
Bots
ksandr_maykop, 2018-03-16 12:28:27

Telegram bot (telegram_bot_sdk library) endless webhook requests, why?

Some commands (from some bot users) sent to the bot cause an endless stream of calls to the handler. As I understand it, the response 200 OK is not returned, but I can not understand how to control this.

include('vendor/autoload.php');
use Telegram\Bot\Api; 

$telegram = new Api('***'); 
$result = $telegram -> getWebhookUpdates(); 

$text = $result["message"]["text"]; 
$chat_id = $result["message"]["chat"]["id"]; 
$name = $result["message"]["from"]["username"]; 
$first_name = $result["message"]["chat"]["first_name"]; 
$last_name = $result["message"]["chat"]["last_name"];

if ($text == "Производство") {        
 $reply = "Доступные отчеты по запросу ПРОИЗВОДСТВО:";

 $reply_markup = $telegram->replyKeyboardMarkup([
   'inline_keyboard' => $keyboard_proizvodstvo
 ]);

 $telegram->sendMessage([
  'chat_id' => $chat_id, 
  'text' => $reply, 
  'reply_markup' => $reply_markup 
 ]);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question