Méthode |
Description |
|
Callback_ChatID ( ) |
\return the String callback_query |
|
Callback_Data ( ) |
\return the String callback_data |
|
Callback_ID ( ) |
\return the String callback_query id |
|
Callback_Message ( ) |
\return the Message |
|
Callback_Query ( ) |
\return the String callback_query |
|
ChatID ( ) |
\return the String users's chat_id |
|
Date ( ) |
\return the String message's date |
|
FirstName ( ) |
Get the first name of the user |
|
LastName ( ) |
Get the last name of the user |
|
Location ( ) |
Get the location in the message |
|
Text ( ) |
\return the String users's text |
|
UpdateCount ( ) |
Get the number of updates |
|
UpdateID ( ) |
Get the update_id of the message |
|
Username ( ) |
Get the username of the user |
|
__construct ( $bot_id ) |
Create a Telegram instance from the bot token
\param bot_id the bot token
\return an instance of the class |
|
answerCallbackQuery ( array $content ) |
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
callback_query_id |
String |
Yes |
Unique identifier for the query to be answered |
text |
String |
Optional |
Text of the notification. If not specified, nothing will be shown to the user |
show_alert |
Boolean |
Optional |
If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
answerInlineQuery ( array $content ) |
Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed. Values inside $content:
Parameters |
Type |
Required |
Description |
inline_query_id |
String |
Yes |
Unique identifier for the answered query |
results |
Array of InlineQueryResult |
Yes |
A JSON-serialized array of results for the inline query |
cache_time |
Integer |
Optional |
The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. |
is_personal |
Boolean |
Optional |
Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query |
next_offset |
String |
Optional |
Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. |
switch_pm_text |
String |
Optional |
If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter |
switch_pm_parameter |
String |
Optional |
Parameter for the start message sent to the bot when user presses the switch button
Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a ‘Connect your YouTube account’ button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
buildForceReply ( $selective = true ) |
* Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. |
|
buildInlineKeyBoard ( array $options ) |
This object represents an inline keyboard that appears right next to the message it belongs to. |
|
buildInlineKeyboardButton ( $text, $url = "", $callback_data = "", $switch_inline_query = "" ) |
This object represents one button of an inline keyboard. You must use exactly one of the optional fields. |
|
buildKeyBoard ( array $options, $onetime = false, $resize = false, $selective = true ) |
This object represents a custom keyboard with reply options
\param $options Array of Array of String; Array of button rows, each represented by an Array of Strings
\param $onetime Boolean Requests clients to hide the keyboard as soon as it's been used. Defaults to false. |
|
buildKeyBoardHide ( $selective = true ) |
Upon receiving a message with this object, Telegram clients will hide the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button. |
|
buildKeyboardButton ( $text, $request_contact = false, $request_location = false ) |
This object represents one button of an inline keyboard. You must use exactly one of the optional fields. |
|
downloadFile ( $telegram_file_path, $local_file_path ) |
Use this method to to download a file from the Telegram servers. |
|
editMessageCaption ( array $content ) |
Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
No |
Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
message_id |
Integer |
No |
Required if inline_message_id is not specified. Unique identifier of the sent message |
inline_message_id |
String |
No |
Required if chat_id and message_id are not specified. Identifier of the inline message |
caption |
String |
Optional |
New caption of the message |
reply_markup |
InlineKeyboardMarkup |
Optional |
A JSON-serialized object for an inline keyboard. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
editMessageReplyMarkup ( array $content ) |
Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
No |
Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
message_id |
Integer |
No |
Required if inline_message_id is not specified. Unique identifier of the sent message |
inline_message_id |
String |
No |
Required if chat_id and message_id are not specified. Identifier of the inline message |
reply_markup |
InlineKeyboardMarkup |
Optional |
A JSON-serialized object for an inline keyboard. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
editMessageText ( array $content ) |
Use this method to edit text messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
No |
Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
message_id |
Integer |
No |
Required if inline_message_id is not specified. Unique identifier of the sent message |
inline_message_id |
String |
No |
Required if chat_id and message_id are not specified. Identifier of the inline message |
text |
String |
Yes |
New text of the message |
parse_mode |
String |
Optional |
Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
disable_web_page_preview |
Boolean |
Optional |
Disables link previews for links in this message |
reply_markup |
InlineKeyboardMarkup |
Optional |
A JSON-serialized object for an inline keyboard. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
endpoint ( $api, array $content, $post = true ) |
Contacts the various API's endpoints
\param api the API endpoint
\param $content the request parameters as array
\param $post boolean tells if $content needs to be sends
\return the JSON Telegram's reply |
|
forwardMessage ( array $content ) |
Use this method to forward messages of any kind. On success, the sent Message is returned Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
from_chat_id |
Integer |
Yes |
Unique identifier for the chat where the original message was sent — User or GroupChat id |
message_id |
Integer |
Yes |
Unique message identifier |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
getChat ( array $content ) |
Use this method to 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, etc.). Returns a Chat object on success. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
getChatAdministrators ( array $content ) |
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
getChatMember ( array $content ) |
Use this method to get information about a member of a chat. Returns a ChatMember object on success. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
user_id |
Integer |
Yes |
Unique identifier of the target user |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
getChatMembersCount ( array $content ) |
Use this method to get the number of members in a chat. Returns Int on success. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
getData ( ) |
Get the POST request of a user in a Webhook or the message actually processed in a getUpdates() enviroment. |
|
getFile ( $file_id ) |
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. |
|
getMe ( ) |
A simple method for testing your bot's auth token. Requires no parameters. |
|
getUpdates ( $offset, $limit = 100, $timeout, $update = true ) |
Use this method to receive incoming updates using long polling. |
|
getUserProfilePhotos ( array $content ) |
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. Values inside $content:
Parameters |
Type |
Required |
Description |
user_id |
Integer |
Yes |
Unique identifier of the target user |
offset |
Integer |
Optional |
Sequential number of the first photo to be returned. By default, all photos are returned. |
limit |
Integer |
Optional |
Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
kickChatMember ( array $content ) |
Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.
Note: This will method only work if the ‘All Members Are Admins’ setting is off in the target group. Otherwise members may only be removed by the group's creator or by the member that added them. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername ) |
user_id |
Integer |
Yes |
Unique identifier of the target user |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
leaveChat ( array $content ) |
Use this method for your bot to leave a group, supergroup or channel. Returns True on success. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername ) |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
messageFromGroup ( ) |
\return BOOLEAN true if the message is from a Group chat, false otherwise |
|
messageFromGroupTitle ( ) |
|
|
sendAudio ( array $content ) |
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. |
|
sendChatAction ( array $content ) |
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). |
|
sendContact ( array $content ) |
Use this method to send phone contacts. On success, the sent Message is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
phone_number |
String |
Yes |
Contact's phone number |
first_name |
String |
Yes |
Contact's first name |
last_name |
String |
Optional |
Contact's last name |
disable_notification |
Boolean |
Optional |
Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendDocument ( array $content ) |
Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
document |
InputFile or String |
Yes |
File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data. |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendLocation ( array $content ) |
Use this method to send point on the map. On success, the sent Message is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
latitude |
Float number |
Yes |
Latitude of location |
longitude |
Float number |
Yes |
Longitude of location |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendMessage ( array $content ) |
Contacts the various API's endpoints Values inside $content:
*
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
text |
String |
Yes |
Text of the message to be sent |
parse_mode |
String |
Optional |
Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message. For the moment, only Telegram for Android supports this. |
disable_web_page_preview |
Boolean |
Optional |
Disables link previews for links in this message |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendPhoto ( array $content ) |
Use this method to send photos. On success, the sent Message is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
photo |
InputFile or String |
Yes |
Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data. |
caption |
String |
Optional |
Photo caption (may also be used when resending photos by file_id). |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or >ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendSticker ( array $content ) |
Use this method to send .webp stickers. On success, the sent Message is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
sticker |
InputFile or String |
Yes |
Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data. |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendVenue ( array $content ) |
Use this method to send information about a venue. On success, the sent Message is returned. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
latitude |
Float number |
Yes |
Latitude of the venue |
longitude |
Float number |
Yes |
Longitude of the venue |
title |
String |
Yes |
Name of the venue |
address |
String |
Yes |
Address of the venue |
foursquare_id |
String |
Optional |
Foursquare identifier of the venue |
disable_notification |
Boolean |
Optional |
Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendVideo ( array $content ) |
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
video |
InputFile or String |
Yes |
Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data. |
duration |
Integer |
Optional |
Duration of sent video in seconds |
caption |
String |
Optional |
Video caption (may also be used when resending videos by file_id). |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
sendVoice ( array $content ) |
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer |
Yes |
Unique identifier for the message recipient — User or GroupChat id |
voice |
InputFile or String |
Yes |
Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data. |
duration |
Integer |
Optional |
Duration of sent audio in seconds |
reply_to_message_id |
Integer |
Optional |
If the message is a reply, ID of the original message |
reply_markup |
ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReply |
Optional |
Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|
serveUpdate ( $update ) |
Use this method to use the bultin function like Text() or Username() on a specific update. |
|
setData ( array $data ) |
Set the data currently used |
|
setWebhook ( $url, $certificate = "" ) |
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. |
|
unbanChatMember ( array $content ) |
Use this method to unban a previously kicked user in a supergroup. The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work. Returns True on success. Values inside $content:
Parameters |
Type |
Required |
Description |
chat_id |
Integer or String |
Yes |
Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername ) |
user_id |
Integer |
Yes |
Unique identifier of the target user |
\param $content the request parameters as array
\return the JSON Telegram's reply |
|