Property | Type | Description | |
---|---|---|---|
$accessToken | Telegram Bot API Access Token. | ||
$client | The Telegram client service. | ||
$commandBus | Telegram Command Bus. | ||
$connectTimeOut | integer | Connection timeout of the request in seconds. | |
$container | IoC Container | ||
$isAsyncRequest | Indicates if the request to Telegram will be asynchronous (non-blocking). | ||
$lastResponse | Stores the last request made to Telegram Bot API. | ||
$timeOut | integer | Timeout of the request in seconds. |
Method | Description | |
---|---|---|
__call ( $method, $arguments ) : boolean | |
Magic method to process any "get" requests. | |
__construct ( string $token = null, boolean $async = false, Telegram\Bot\HttpClients\HttpClientInterface $httpClientHandler = null ) | Instantiates a new Telegram super-class object. | |
answerCallbackQuery ( array $params ) : boolean | Send answers to callback queries sent from inline keyboards. | |
answerInlineQuery ( array $params = [] ) : boolean | Use this method to send answers to an inline query. | |
commandsHandler ( boolean $webhook = false ) : |
Processes Inbound Commands. | |
detectMessageType ( |
Detect Message Type Based on Update or Message Object. | |
editMessageCaption ( array $params ) : |
Edit captions of messages sent by the bot or via the bot (for inline bots). | |
editMessageReplyMarkup ( array $params ) : |
Edit only the reply markup of messages sent by the bot or via the bot (for inline bots). | |
editMessageText ( array $params ) : |
Edit text messages sent by the bot or via the bot (for inline bots). | |
forceReply ( array $params = [] ) : |
Display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). | |
forwardMessage ( array $params ) : |
Forward messages of any kind. | |
getAccessToken ( ) : string | Returns Telegram Bot API Access Token. | |
getChat ( array $params ) : Telegram\Bot\Objects\Chat | Get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, | |
getChatAdministrators ( array $params ) : |
Get a list of administrators in a chat. | |
getChatMember ( array $params ) : |
Get information about a member of a chat. | |
getChatMembersCount ( array $params ) : integer | Get the number of members in a chat | |
getClient ( ) : Telegram\Bot\TelegramClient | Returns the TelegramClient service. | |
getCommandBus ( ) : |
Returns SDK's Command Bus. | |
getConnectTimeOut ( ) : integer | ||
getContainer ( ) : Illuminate\Contracts\Container\Container | Get the IoC Container. | |
getFile ( array $params ) : Telegram\Bot\Objects\File | Returns basic info about a file and prepare it for downloading. | |
getLastResponse ( ) : |
Returns the last response returned from API request. | |
getMe ( ) : Telegram\Bot\Objects\User | A simple method for testing your bot's auth token. | |
getTimeOut ( ) : integer | ||
getUpdates ( array $params = [], boolean $shouldEmitEvents = true ) : |
Use this method to receive incoming updates using long polling. | |
getUserProfilePhotos ( array $params ) : Telegram\Bot\Objects\UserProfilePhotos | Returns a list of profile pictures for a user. | |
getWebhookUpdate ( $shouldEmitEvent = true ) : |
Returns a webhook update sent by Telegram. | |
getWebhookUpdates ( boolean $shouldEmitEvent = true ) : |
Alias for getWebhookUpdate | |
hasContainer ( ) : boolean | Check if IoC Container has been set. | |
isAsyncRequest ( ) : boolean | Check if this is an asynchronous request (non-blocking). | |
isMessageType ( string $type, |
Determine if a given type is the message. | |
kickChatMember ( array $params ) : boolean | Kick a user from a group or a supergroup. | |
manager ( $config ) : |
Invoke Bots Manager. | |
processCommand ( |
Check update object for a command and process. | |
removeWebhook ( ) : |
Removes the outgoing webhook (if any). | |
replyKeyboardHide ( array $params = [] ) : string | Hide the current custom keyboard and display the default letter-keyboard. | |
replyKeyboardMarkup ( array $params ) : string | Builds a custom keyboard markup. | |
sendAudio ( array $params ) : |
Send regular audio files. | |
sendChatAction ( array $params ) : boolean | Broadcast a Chat Action. | |
sendContact ( array $params ) : |
Send phone contacts. | |
sendDocument ( array $params ) : |
Send general files. | |
sendLocation ( array $params ) : |
Send point on the map. | |
sendMessage ( array $params ) : |
Send text messages. | |
sendPhoto ( array $params ) : |
Send Photos. | |
sendSticker ( array $params ) : |
Send .webp stickers. | |
sendVenue ( array $params ) : |
Send information about a venue. | |
sendVideo ( array $params ) : |
Send Video File, Telegram clients support mp4 videos (other formats may be sent as Document). | |
sendVoice ( array $params ) : |
Send voice audio files. | |
setAccessToken ( string $accessToken ) : |
Sets the bot access token to use with API requests. | |
setAsyncRequest ( boolean $isAsyncRequest ) : |
Make this request asynchronous (non-blocking). | |
setConnectTimeOut ( integer $connectTimeOut ) | ||
setContainer ( Illuminate\Contracts\Container\Container $container ) : void | Set the IoC Container. | |
setTimeOut ( integer $timeOut ) | ||
setWebhook ( array $params ) : |
Set a Webhook to receive incoming updates via an outgoing webhook. | |
triggerCommand ( string $name, |
Helper to Trigger Commands. | |
unbanChatMember ( array $params ) : boolean | Unban a previously kicked user in a supergroup. |
Method | Description | |
---|---|---|
get ( string $endpoint, array $params = [] ) : |
Sends a GET request to Telegram Bot API and returns the result. | |
isValidFileOrUrl ( string $name, string $contents ) : boolean | Determines if the string passed to be uploaded is a valid file on the local file system, or a valid remote URL. | |
markUpdateAsRead ( $params ) : |
An alias for getUpdates that helps readability. | |
post ( string $endpoint, array $params = [], boolean $fileUpload = false ) : |
Sends a POST request to Telegram Bot API and returns the result. | |
request ( string $method, string $endpoint, array $params = [] ) : Telegram\Bot\TelegramRequest | Instantiates a new TelegramRequest entity. | |
sendRequest ( string $method, string $endpoint, array $params = [] ) : |
Sends a request to Telegram Bot API and returns the result. | |
uploadFile ( string $endpoint, array $params = [] ) : |
Sends a multipart/form-data request to Telegram Bot API and returns the result. |
public __construct ( string $token = null, boolean $async = false, Telegram\Bot\HttpClients\HttpClientInterface $httpClientHandler = null ) | ||
$token | string | The Telegram Bot API Access Token. |
$async | boolean | (Optional) Indicates if the request to Telegram will be asynchronous (non-blocking). |
$httpClientHandler | Telegram\Bot\HttpClients\HttpClientInterface | (Optional) Custom HTTP Client Handler. |
$params = [
'callback_query_id' => '',
'text' => '',
'show_alert' => '',
];
public answerCallbackQuery ( array $params ) : boolean | ||
$params | array | |
return | boolean |
$params = [
'inline_query_id' => '',
'results' => [],
'cache_time' => 0,
'is_personal' => false,
'next_offset' => '',
'switch_pm_text' => '',
'switch_pm_parameter' => '',
];
public answerInlineQuery ( array $params = [] ) : boolean | ||
$params | array | |
return | boolean |
public commandsHandler ( boolean $webhook = false ) : |
||
$webhook | boolean | |
return |
public detectMessageType ( |
||
$object | ||
return | string | null |
$params = [
'chat_id' => '',
'message_id' => '',
'inline_message_id' => '',
'caption' => '',
'reply_markup' => '',
];
public editMessageCaption ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'message_id' => '',
'inline_message_id' => '',
'reply_markup' => '',
];
public editMessageReplyMarkup ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'message_id' => '',
'inline_message_id' => '',
'text' => '',
'parse_mode' => '',
'disable_web_page_preview' => '',
'reply_markup' => '',
];
public editMessageText ( array $params ) : |
||
$params | array | |
return |
$params = [
'force_reply' => true,
'selective' => false,
];
public static forceReply ( array $params = [] ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'from_chat_id' => '',
'disable_notification' => '',
'message_id' => '',
];
public forwardMessage ( array $params ) : |
||
$params | array | |
return |
public getAccessToken ( ) : string | ||
return | string |
$params = [
'chat_id' => '',
];
$params = [
'chat_id' => '',
];
public getChatAdministrators ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'user_id' => '',
];
public getChatMember ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
];
public getChatMembersCount ( array $params ) : integer | ||
$params | array | |
return | integer |
public getClient ( ) : Telegram\Bot\TelegramClient | ||
return | Telegram\Bot\TelegramClient |
public getCommandBus ( ) : |
||
return |
public getContainer ( ) : Illuminate\Contracts\Container\Container | ||
return | Illuminate\Contracts\Container\Container |
$params = [
'file_id' => '',
];
The file can then be downloaded via the link
https://api.telegram.org/file/bot
public getLastResponse ( ) : |
||
return |
public getMe ( ) : Telegram\Bot\Objects\User | ||
return | Telegram\Bot\Objects\User |
$params = [
'offset' => '',
'limit' => '',
'timeout' => '',
];
public getUpdates ( array $params = [], boolean $shouldEmitEvents = true ) : |
||
$params | array | |
$shouldEmitEvents | boolean | |
return |
$params = [
'user_id' => '',
'offset' => '',
'limit' => '',
];
public getUserProfilePhotos ( array $params ) : Telegram\Bot\Objects\UserProfilePhotos | ||
$params | array | |
return | Telegram\Bot\Objects\UserProfilePhotos |
public getWebhookUpdate ( $shouldEmitEvent = true ) : |
||
return |
public getWebhookUpdates ( boolean $shouldEmitEvent = true ) : |
||
$shouldEmitEvent | boolean | |
return |
public hasContainer ( ) : boolean | ||
return | boolean |
public isAsyncRequest ( ) : boolean | ||
return | boolean |
public isMessageType ( string $type, |
||
$type | string | |
$object |
$params = [
'chat_id' => '',
'user_id' => '',
];
public kickChatMember ( array $params ) : boolean | ||
$params | array | |
return | boolean |
public static manager ( $config ) : |
||
$config | ||
return |
protected markUpdateAsRead ( $params ) : |
||
$params | ||
return |
public processCommand ( |
||
$update |
public removeWebhook ( ) : |
||
return |
$params = [
'hide_keyboard' => true,
'selective' => false,
];
public static replyKeyboardHide ( array $params = [] ) : string | ||
$params | array | |
return | string |
$params = [
'keyboard' => '',
'resize_keyboard' => '',
'one_time_keyboard' => '',
'selective' => '',
];
public replyKeyboardMarkup ( array $params ) : string | ||
$params | array | |
return | string |
$params = [
'chat_id' => '',
'audio' => '',
'duration' => '',
'performer' => '',
'title' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
$params = [
'chat_id' => '',
'action' => '',
];
public sendChatAction ( array $params ) : boolean | ||
$params | array | |
return | boolean |
$params = [
'chat_id' => '',
'phone_number' => '',
'first_name' => '',
'last_name' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public sendContact ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'document' => '',
'caption' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public sendDocument ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'latitude' => '',
'longitude' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public sendLocation ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'text' => '',
'parse_mode' => '',
'disable_web_page_preview' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public sendMessage ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'photo' => '',
'caption' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
$params = [
'chat_id' => '',
'sticker' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public sendSticker ( array $params ) : |
||
$params | array | |
return |
$params = [
'chat_id' => '',
'latitude' => '',
'longitude' => '',
'title' => '',
'address' => '',
'foursquare_id' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
$params = [
'chat_id' => '',
'video' => '',
'duration' => '',
'width' => '',
'height' => '',
'caption' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
$params = [
'chat_id' => '',
'voice' => '',
'duration' => '',
'disable_notification' => '',
'reply_to_message_id' => '',
'reply_markup' => '',
];
public setAccessToken ( string $accessToken ) : |
||
$accessToken | string | The bot access token to save. |
return |
public setAsyncRequest ( boolean $isAsyncRequest ) : |
||
$isAsyncRequest | boolean | |
return |
public setConnectTimeOut ( integer $connectTimeOut ) | ||
$connectTimeOut | integer |
public static setContainer ( Illuminate\Contracts\Container\Container $container ) : void | ||
$container | Illuminate\Contracts\Container\Container | Container instance |
return | void |
$params = [
'url' => '',
'certificate' => '',
];
public setWebhook ( array $params ) : |
||
$params | array | |
return |
public triggerCommand ( string $name, |
||
$name | string | Command Name |
$update | Update Object | |
return | mixed |
$params = [
'chat_id' => '',
'user_id' => '',
];
public unbanChatMember ( array $params ) : boolean | ||
$params | array | |
return | boolean |
protected uploadFile ( string $endpoint, array $params = [] ) : |
||
$endpoint | string | |
$params | array | |
return |
protected int $connectTimeOut | ||
return | integer |
protected $isAsyncRequest |
protected $lastResponse |
protected int $timeOut | ||
return | integer |