unbl0ck3r
unbl0ck3r

Reputation: 379

Why Telegram Bot API Web hook repeated infinitely?

I using laravel and php bot sdk for my bot. here is the laravel route code :

Route::post('268XXXX:XXXXXX/webhook',function(){
Telegram::commandsHandler(true);
Telegram::setWebHook(['url'=>URL::to('/').'/268XXXX:XXXXXX/webhook']);
return response()->json("{}")->setStatusCode(200);

});

and help command executed infinitely!

Upvotes: 4

Views: 1466

Answers (1)

علیرضا
علیرضا

Reputation: 2652

When Telegram send an update to your server, if your server return any status except 200, then Telegram consider that you doesn't notify about the update, so Telegram repeat the update continuously!

Also some times; an error accrues in your code execution and code stopped at the certain line. In these case, you can save & check update_id of received update in database, at first lines of your program, so you can ignore such repeated updates.

Upvotes: 2

Related Questions