Skip to main content
Version: 3.x

Request Timeouts

By default, there is a 60 second timeout for waiting response from Telegram Bot API servers, after this time is passed Guzzle exception will be thrown.

However, it is possible to change this behaviour by calling setTimeOut($seconds) or setConnectTimeOut($seconds) before making any API request or at the time of initializing the library.

Connection timeout

Default connection timeout is 10 seconds. It can be changed by calling setConnectTimeOut($seconds).

# Standalone
->sendPhoto(['chat_id' => 'CHAT_ID', 'photo' => 'path/to/photo.jpg']);

# Laravel
Telegram::sendPhoto(['chat_id' => 'CHAT_ID', 'photo' => 'path/to/photo.jpg']);

General timeout

Default timeout of Telegram Bot API server response is 60 seconds. It can be changed by calling setTimeOut($seconds).

# Standalone
$updates = $telegram->getUpdates(['timeout' => 30]);

$telegram->sendMessage(['chat_id' => 'CHAT_ID', 'text' => 'message']);

# Laravel
$updates = Telegram::getUpdates(['timeout' => 30]);

Telegram::sendMessage(['chat_id' => 'CHAT_ID', 'text' => 'message']);