*/
class Telegram
{
/**
* Constant for type Inline Query.
*/
const INLINE_QUERY = 'inline_query';
/**
* Constant for type Callback Query.
*/
const CALLBACK_QUERY = 'callback_query';
/**
* Constant for type Edited Message.
*/
const EDITED_MESSAGE = 'edited_message';
/**
* Constant for type Reply.
*/
const REPLY = 'reply';
/**
* Constant for type Message.
*/
const MESSAGE = 'message';
/**
* Constant for type Photo.
*/
const PHOTO = 'photo';
/**
* Constant for type Video.
*/
const VIDEO = 'video';
/**
* Constant for type Audio.
*/
const AUDIO = 'audio';
/**
* Constant for type Voice.
*/
const VOICE = 'voice';
/**
* Constant for type Document.
*/
const DOCUMENT = 'document';
/**
* Constant for type Location.
*/
const LOCATION = 'location';
/**
* Constant for type Contact.
*/
const CONTACT = 'contact';
/**
* Constant for type Channel Post.
*/
const CHANNEL_POST = 'channel_post';
private $bot_token = '';
private $data = [];
private $updates = [];
private $log_errors;
private $proxy;
/// Class constructor
/**
* Create a Telegram instance from the bot token
* \param $bot_token the bot token
* \param $log_errors enable or disable the logging
* \param $proxy array with the proxy configuration (url, port, type, auth)
* \return an instance of the class.
*/
public function __construct($bot_token, $log_errors = true, array $proxy=array())
{
$this->bot_token = $bot_token;
$this->data = $this->getData();
$this->log_errors = $log_errors;
$this->proxy = $proxy;
}
/// Do requests to Telegram Bot API
/**
* 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.
*/
public function endpoint($api, array $content, $post = true)
{
$url = 'https://api.telegram.org/bot'.$this->bot_token.'/'.$api;
if ($post) {
$reply = $this->sendAPIRequest($url, $content);
} else {
$reply = $this->sendAPIRequest($url, [], false);
}
return json_decode($reply, true);
}
/// A method for testing your bot.
/**
* A simple method for testing your bot's auth token. Requires no parameters.
* Returns basic information about the bot in form of a User object.
* \return the JSON Telegram's reply.
*/
public function getMe()
{
return $this->endpoint('getMe', [], false);
}
/// A method for responding http to Telegram.
/**
* \return the HTTP 200 to Telegram.
*/
public function respondSuccess()
{
http_response_code(200);
return json_encode(['status' => 'success']);
}
/// Send a message
/**
* Use this method to send text messages.
Values inside $content:
*
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | * *
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 | *InlineKeyboardMarkup or 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
from_chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
disable_notification | *Boolean | *Optional | *Sends the message silently. Users will receive a notification with no sound. | *
message_id | *Integer | *Yes | *Unique message identifier | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
photo | *InputFile or String | *Yes | *Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, 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 | *
disable_notification | *Boolean | *Optional | *Sends the message silently. Users will receive a notification with no sound. | *
reply_markup | *InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
audio | *InputFile or String | *Yes | *Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. | *
duration | *Integer | *Optional | *Duration of the audio in seconds | *
performer | *String | *Optional | *Performer | *
title | *String | *Optional | *Track name | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
document | *InputFile or String | *Yes | *File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | *
caption | *String | *Optional | *Document caption (may also be used when resending documents by file_id), 0-200 characters. | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove 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. | *
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. | *
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. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. | *
duration | *Integer | *Optional | *Duration of sent video in seconds | *
width | *Integer | *Optional | *Video width | *
height | *Integer | *Optional | *Video height | *
caption | *String | *Optional | *Video caption (may also be used when resending videos by file_id). | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
voice | *InputFile or String | *Yes | *Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | *
caption | *String | *Optional | *Voice message caption, 0-200 characters | *
duration | *Integer | *Optional | *Duration of sent audio in seconds | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
latitude | *Float number | *Yes | *Latitude of location | *
longitude | *Float number | *Yes | *Longitude of location | *
live_period | *Integer | *Optional | *Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400. | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove 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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer or String | *Optional | *Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
message_id | *Integer | *Optional | *Required if inline_message_id is not specified. Identifier of the sent message | *
inline_message_id | *String | *Optional | *Required if chat_id and message_id are not specified. Identifier of the inline message | *
latitude | *Float number | *Yes | *Latitude of new location | *
longitude | *Float number | *Yes | *Longitude of new location | *
reply_markup | *InlineKeyboardMarkup | *Optional | *A JSON-serialized object for a new inline keyboard. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer or String | *Optional | *Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *
message_id | *Integer | *Optional | *Required if inline_message_id is not specified. Identifier of the sent message | *
inline_message_id | *String | *Optional | *Required if chat_id and message_id are not specified. Identifier of the inline message | *
reply_markup | *InlineKeyboardMarkup | *Optional | *A JSON-serialized object for a new inline keyboard. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer or String | *Yes | *Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
*
Parameters | *Type | *Required | *Description | *
chat_id | *Integer or String | *Yes | *Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername ) |
*
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 \c \@channelusername) | *
media | *Array of InputMedia | *Yes | *A JSON-serialized array describing photos and videos to be sent, must include 2–10 items | *
disable_notification | *Boolean | *Optional | *Sends the messages silently. Users will receive a notification with no sound. | *
reply_to_message_id | *Integer | *Optional | *If the messages are a reply, ID of the original message | *
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 \c \@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. | *
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 \c \@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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the message recipient — User or GroupChat id | *
action | *String | *Yes | *Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data. | *
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. | *
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 \c \@supergroupusername) | *
user_id | *Integer | *Yes | *Unique identifier of the target user | *
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 \c \@channelusername) | *
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 | *
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 \c \@channelusername) | *
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 \c \@channelusername) | *
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 \c \@channelusername) | *
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 \c \@channelusername) | *
user_id | *Integer | *Yes | *Unique identifier of the target user | *
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. |
*
Parameters | *Type | *Required | *Description | *
user_id | *Integer | *Yes | *User identifier | *
score | *Integer | *Yes | *New score, must be non-negative | *
force | *Boolean | *Optional | *Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters | *
disable_edit_message | *Boolean | *Optional | *Pass True, if the game message should not be automatically edited to include the current scoreboard | *
chat_id | *Integer | *Optional | *Required if inline_message_id is not specified. Unique identifier for the target chat | *
message_id | *Integer | *Optional | *Required if inline_message_id is not specified. Identifier of the sent message | *
inline_message_id | *String | *Optional | *Required if chat_id and message_id are not specified. Identifier of the inline message | *
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. | *
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 \c \@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. | *
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 \c \@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. | *
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 \c \@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. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Integer | *Yes | *Unique identifier for the target private chat | *
title | *String | *Yes | *Product name | *
description | *String | *Yes | *Product description | *
payload | *String | *Yes | *Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. | *
provider_token | *String | *Yes | *Payments provider token, obtained via Botfather | *
start_parameter | *String | *Yes | *Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter | *
currency | *String | *Yes | *Three-letter ISO 4217 currency code, see more on currencies | *
prices | *Array of LabeledPrice | *Yes | *Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) | *
provider_data | *String | *Optional | *JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. | *
photo_url | *String | *Optional | *URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. | *
photo_size | *Integer | *Optional | *Photo size | *
photo_width | *Integer | *Optional | *Photo width | *
photo_height | *Integer | *Optional | *Photo height | *
need_name | *Bool | *Optional | *Pass True, if you require the user's full name to complete the order | *
need_phone_number | *Boolean | *Optional | *Pass True, if you require the user's phone number to complete the order | *
need_email | *Bool | *Optional | *Pass True, if you require the user's email to complete the order | *
need_shipping_address | *Boolean | *Optional | *Pass True, if you require the user's shipping address to complete the order | *
is_flexible | *Boolean | *Optional | *Pass True, if the final price depends on the shipping method | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 | *Optional | *A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price ' button will be shown. If not empty, the first button must be a Pay button. |
*
Parameters | *Type | *Required | *Description | *
shipping_query_id | *String | *Yes | *Unique identifier for the query to be answered | *
ok | *Boolean | *Yes | *Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) | *
shipping_options | *Array of ShippingOption | *Optional | *Required if ok is True. A JSON-serialized array of available shipping options. | *
error_message | *String | *Optional | *Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. | *
Parameters | *Type | *Required | *Description | *
pre_checkout_query_id | *String | *Yes | *Unique identifier for the query to be answered | *
ok | *Boolean | *Yes | *Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. | *
error_message | *String | *Optional | *Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. | *
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 \c \@channelusername) | *
video_note | *InputFile or String | *Yes | *Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported | *
duration | *Integer | *Optional | *Duration of sent video in seconds | *
length | *Integer | *Optional | *Video width and height | *
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 ReplyKeyboardRemove or ForceReply | *Optional | *Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | *
Parameters | *Type | *Required | *Description | *
chat_id | *Yes | *Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername) | *|
photo | *InputFile or String | *Yes | *Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. More info on Sending Files » | *
caption | *String | *Optional | *Photo caption (may also be used when resending photos by file_id), 0-200 characters | *
disable_notification | *Boolean | *Optional | *Sends the message silently. 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 ReplyKeyboardRemove or ForceReply | *Optional | *Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | *
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 \c \@channelusername) | *
user_id | *Integer | *Yes | *Unique identifier of the target user | *
can_change_info | *Boolean | *No | *Pass True, if the administrator can change chat title, photo and other settings | *
can_post_messages | *Boolean | *No | *Pass True, if the administrator can create channel posts, channels only | *
can_edit_messages | *Boolean | *No | *Pass True, if the administrator can edit messages of other users, channels only | *
can_delete_messages | *Boolean | *No | *Pass True, if the administrator can delete messages of other users | *
can_invite_users | *Boolean | *No | *Pass True, if the administrator can invite new users to the chat | *
can_restrict_members | *Boolean | *No | *Pass True, if the administrator can restrict, ban or unban chat members | *
can_pin_messages | *Boolean | *No | *Pass True, if the administrator can pin messages, supergroups only | *
can_promote_members | *Boolean | *No | *Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) | *
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 \c \@channelusername) | *
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 \c \@channelusername) | *
photo | *InputFile | *Yes | *New chat photo, uploaded using multipart/form-data | *
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 \c \@channelusername) | *
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 \c \@channelusername) | *
title | *String | *Yes | *New chat title, 1-255 characters | *
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 \c \@channelusername) | *
description | *String | *No | *New chat description, 0-255 characters | *
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 \c \@channelusername) | *
message_id | *Integer | *Yes | *Identifier of a message to pin | *
disable_notification | *Boolean | *No | *Pass True, if it is not necessary to send a notification to all group members about the new pinned message | *
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 \c \@channelusername) | *
Parameters | *Type | *Required | *Description | *
name | *String | *Yes | *Short name of the sticker set that is used in t.me/addstickers/ URLs (e.g., animals) |
*
Parameters | *Type | *Required | *Description | *
user_id | *Integer | *Yes | *User identifier of sticker file owner | *
png_sticker | *InputFile | *Yes | *Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. More info on Sending Files » | *
Parameters | *Type | *Required | *Description | *
user_id | *Integer | *Yes | *User identifier of created sticker set owner | *
name | *String | *Yes | *Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters. |
*
title | *String | *Yes | *Sticker set title, 1-64 characters | *
png_sticker | *InputFile or String | *Yes | *Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | *
emojis | *String | *Yes | *One or more emoji corresponding to the sticker | *
is_masks | *Boolean | *Optional | *Pass True, if a set of mask stickers should be created | *
mask_position | *MaskPosition | *Optional | *Position where the mask should be placed on faces | *
Parameters | *Type | *Required | *Description | *
user_id | *Integer | *Yes | *User identifier of sticker set owner | *
name | *String | *Yes | *Sticker set name | *
png_sticker | *InputFile or String | *Yes | *Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files » | *
emojis | *String | *Yes | *One or more emoji corresponding to the sticker | *
mask_position | *MaskPosition | *Optional | *Position where the mask should be placed on faces | *
Parameters | *Type | *Required | *Description | *
sticker | *String | *Yes | *File identifier of the sticker | *
position | *Integer | *Yes | *New sticker position in the set, zero-based | *
Parameters | *Type | *Required | *Description | *
sticker | *String | *Yes | *File identifier of the sticker | *
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 \c \@channelusername) | *
message_id | *Integer | *Yes | *Identifier of the message to delete | *