Skip to main content
Version: 1.x

Available Methods & Examples

Available Methods

The library supports all the methods listed on Telegram Bot API docs page.

sendMessage - Send a Message

See sendMessage docs for a list of supported parameters and other info.

$response = $telegram->sendMessage('CHAT_ID', 'Hello World');
$messageId = $response->getMessageId();

forwardMessage - Forward a Message

See forwardMessage docs for a list of supported parameters and other info.

$response = $telegram->forwardMessage('CHAT_ID', 'FROM_CHAT_ID', 'MESSAGE_ID');
$messageId = $response->getMessageId();

sendPhoto - Send a Photo

See sendPhoto docs for a list of supported parameters and other info.

$response = $telegram->sendPhoto('CHAT_ID', 'path/to/photo.jpg', 'Some caption');
$messageId = $response->getMessageId();

sendChatAction - Send a Chat Action

See sendChatAction docs for a list of supported actions and other info.

$response = $telegram->sendChatAction('CHAT_ID', 'typing');
$messageId = $response->getMessageId();

There is also a helper method for supplying the chat action. This is especially useful with code completion with your IDE.

$telegram->sendChatAction('CHAT_ID', Actions::RECORD_VIDEO);

getUserProfilePhotos - Get User Profile Photos

See getUserProfilePhotos docs for a list of supported parameters and other info.

$response = $telegram->getUserProfilePhotos('USER_ID');

$photos_count = $response->getTotalCount();
$photos = $response->getPhotos();

getUpdates - Get Updates

See getUpdates docs for a list of supported parameters and other info.

$updates = $telegram->getUpdates();