Class BotContext
java.lang.Object
io.github.natanimn.telebof.BotContext
This class implemented all classes defined in io.github.natanimn.telebof.requests as directly usable methods.
- Since:
- March 3, 2025
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddStickerToSet
(long user_id, String name, InputSticker sticker) Use this method to add a new sticker to a set created by the bot.answerCallbackQuery
(String callback_query_id) Use this method to send answers to callback queries sent from inline keyboards.answerCallbackQuery
(String callback_query_id, String text) answerCallbackQuery(java.lang.String)
with text parameteranswerInlineQuery
(String inline_query_id, InlineQueryResult[] results) Use this method to send answers to an inline query.answerPreCheckoutQuery
(String pre_checkout_query_id, boolean ok) Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query.answerShippingQuery
(String shipping_query_id, boolean ok) If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot.answerWebAppQuery
(String web_app_query_id, InlineQueryResult result) Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.approveChatJoinRequest
(Object chat_id, long user_id) Use this method to approve a chat join request.banChatMember
(Object chat_id, long user_id) Use this method to ban a user in a group, a supergroup or a channel.banChatSenderChat
(Object chat_id, long sender_chat_id) Use this method to ban a channel chat in a supergroup or a channel.void
clearState
(long user_id) Use this method to clear an existing state when it is no longer needed in a private chat for a user.void
clearState
(long chat_id, long user_id) Use this method to clear an existing state when it is no longer needed in a group/supergroup chat for a user.close()
Use this method to close the bot instance before moving it from one local server to another.closeForumTopic
(Object chat_id, int message_thread_id) Use this method to close an open topic in a forum supergroup chat.closeGeneralForumTopic
(Object chat_id) Use this method to close an open 'General' topic in a forum supergroup chat.convertGiftToStars
(String business_connection_id, String owned_gift_id) Converts a given regular gift to Telegram Stars.Use this method to copy messages of any kind.createChatInviteLink
(Object chat_id) Use this method to create an additional invite link for a chat.createChatSubscriptionInviteLink
(Object chat_id, int subscription_period, int subscription_price) Use this method to create a subscription invite link for a channel chat.createForumTopic
(Object chat_id, String name) Use this method to create a topic in a forum supergroup chat.createInvoiceLink
(String title, String description, String payload, String currency, LabeledPrice[] prices) Use this method to create a link for an invoice.createNewStickerSet
(long user_id, String name, String title, InputSticker[] stickers) Use this method to create a new sticker set owned by a user.declineChatJoinRequest
(Object chat_id, long user_id) Use this method to decline a chat join request.deleteBusinessMessages
(String business_connection_id, Integer[] message_ids) Delete messages on behalf of a business account.deleteChatPhoto
(Object chat_id) Use this method to delete a chat photo.deleteChatStickerSet
(Object chat_id) Use this method to delete a group sticker set from a supergroup.deleteForumTopic
(Object chat_id, int message_thread_id) Use this method to delete a forum topic along with all its messages in a forum supergroup chat.deleteMessage
(Object chat_id, int message_id) Use this method to delete a message, including service messages, with the following limitations:deleteMessages
(Object chat_id, Integer[] message_ids) Use this method to delete multiple messages simultaneously.Use this method to delete the list of the bot's commands for the given scope and user language.deleteStickerFromSet
(String sticker) Use this method to delete a sticker from a set created by the bot.deleteStickerSet
(String name) Use this method to delete a sticker set that was created by the bot.deleteStory
(String business_connection_id, Integer story_id) Deletes a story previously posted by the bot on behalf of a managed business account.void
Use this method to remove webhook integration if you decide to back getUpdates.byte[]
downloadFile
(String file_path) Use this method to download files up to 20MB in size.editChatInviteLink
(Object chat_id, String invite_link) Use this method to edit a non-primary invite link created by the bot.editChatSubscriptionInviteLink
(Object chat_id, String invite_link) Use this method to edit a subscription invite link created by the bot.editForumTopic
(Object chat_id, int message_thread_id) Use this method to edit name and icon of a topic in a forum supergroup chat.editGeneralForumTopic
(Object chat_id, String name) Use this method to edit the name of the 'General' topic in a forum supergroup chat.editMessageCaption
(Object chat_id, int message_id) Use this method to edit captions of messages.editMessageCaption
(String inline_message_id) Use this method to edit captions of messages.editMessageChecklist
(String business_connection_id, Object chat_id, Integer message_id, InputChecklist checklist) Use this method to edit a checklist on behalf of a connected business account.editMessageLiveLocation
(Object chat_id, double latitude, double longitude, int message_id) Use this method to edit live location messages.editMessageLiveLocation
(String inline_message_id, double latitude, double longitude) Use this method to edit live location messages.editMessageMedia
(Object chat_id, InputMedia media, int message_id) Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages.editMessageMedia
(String inline_message_id, InputMedia media) Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages.editMessageReplyMarkup
(Object chat_id, int message_id) Use this method to edit only the reply markup of messages.editMessageReplyMarkup
(String inline_message_id) Use this method to edit only the reply markup of messages.editMessageText
(String text, Object chat_id, int message_id) Use this method to edit text and game messages.editMessageText
(String text, String inline_message_id) Use this method to edit text and game messages.editStory
(String business_connection_id, Integer story_id, InputStoryContent content) Edits a story previously posted by the bot on behalf of a managed business account.editUserStarSubscription
(long user_id, String telegram_charge_id, boolean is_cancelled) This a method that allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.exportChatInviteLink
(Object chat_id) Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked.Use this method to forward messages of any kind.forwardMessages
(Object chat_id, Object from_chat_id, Integer[] message_id) Use this method to forward multiple messages of any kind.Returns the list of gifts that can be sent by the bot to users and channel chats.getBusinessAccountGifts
(String business_connection_id) Returns the gifts received and owned by a managed business account.getBusinessAccountStarBalance
(String business_connection_id) Returns the amount of Telegram Stars owned by a managed business account.getBusinessConnection
(String business_connection_id) Use this method to get information about the connection of the bot with a business account.Use this method to get up-to-date information about the chat.getChatAdministrators
(Object chat_id) Use this method to get a list of administrators in a chat, which aren't bots.getChatMember
(Object chat_id, long user_id) Use this method to get information about a member of a chat.getChatMemberCount
(Object chat_id) Use this method to get the number of members in a chat.Use this method to get the current value of the bot's menu button in a private chat, or the default menu button.getCustomEmojiStickers
(String[] custom_emoji_ids) Use this method to get information about custom emoji stickers by their identifiers.Use this method to get basic information about a file and prepare it for downloading.Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.getGameHighScores
(long chat_id, long user_id, int message_id) Use this method to get data for high score tables.getGameHighScores
(String inline_message_id, long user_id) Use this method to get data for high score tables.getMe()
A simple method for testing your bot's authentication token.Use this method to get the current list of the bot's commands for the given scope and user language.Use this method to get the current default administrator rights of the bot.Use this method to get the current bot description for the given user language.Use this method to get the current bot name for the given user languageA method to get the current Telegram Stars balance of the bot.Returns the bot's Telegram Star transactions in chronological order.getStateData
(long user_id) Use this method to retrieve saved state data in a private chat for a usergetStateData
(long chat_id, long user_id) Use this method to retrieve saved state data in a group/supergroup chat for a usergetStickerSet
(String name) Use this method to get a sticker set.Use this method to receive incoming updates using long pollinggetUserChatBoosts
(Object chat_id, long user_id) Use this method to get the list of boosts added to a chat by a user.getUserProfilePhotos
(long user_id) Use this method to get a list of profile pictures for a user.giftPremiumSubscription
(long user_id, Integer month_count, Integer star_count) Gifts a Telegram Premium subscription to the given user.hideGeneralForumTopic
(Object chat_id) Use this method to hide the 'General' topic in a forum supergroup chat.Use this method for your bot to leave a group, supergroup or channel.logOut()
Use this method to log out from the cloud Bot API server before launching the bot locally.pinChatMessage
(Object chat_id, int message_id) Use this method to add a message to the list of pinned messages in a chat.postStory
(String business_connection_id, InputStoryContent content, Integer active_period) Posts a story on behalf of a managed business account.promoteChatMember
(Object chat_id, long user_id) Use this method to promote or demote a user in a supergroup or a channel.readBusinessMessage
(long chat_id, String business_connection_id, int message_id) Marks incoming message as read on behalf of a business account.refundStarPayment
(long user_id, String telegram_payment_change_id) Refunds a successful payment in Telegram Stars.removeBusinessAccountProfilePhoto
(String business_connection_id) Removes the current profile photo of a managed business account.removeChatVerification
(Object chat_id) Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.removeUserVerification
(long user_id) Removes verification from a user who is currently verified on behalf of the organization represented by the bot.reopenForumTopic
(Object chat_id, int message_thread_id) Use this method to reopen a closed topic in a forum supergroup chat.reopenGeneralForumTopic
(Object chat_id) Use this method to reopen a closed 'General' topic in a forum supergroup chat.replaceStickerInSet
(long user_id, String name, String old_sticker, InputSticker sticker) Use this method to replace an existing sticker in a sticker set with a new one.restrictChatMember
(Object chat_id, long user_id, ChatPermissions permissions) Use this method to restrict a user in a supergroup.revokeChatInviteLink
(Object chat_id, String invite_link) Use this method to revoke an invite link created by the bot.savePreparedInlineMessage
(long user_id, InlineQueryResult result) Stores a message that can be sent by a user of a Mini App.sendAnimation
(Object chat_id, File animation) Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).sendAnimation
(Object chat_id, String animation) Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).Use this method to send audio files, if you want Telegram clients to display them in the music player.Use this method to send audio files, if you want Telegram clients to display them in the music player.sendChatAction
(Object chat_id, ChatAction action) Use this method when you need to tell the user that something is happening on the bot's side.sendChecklist
(String business_connection_id, Object chat_id, InputChecklist checklist) Use this method to send a checklist on behalf of a connected business account.sendContact
(Object chat_id, String phone_number, String first_name) Use this method to send phone contacts.Use this method to send an animated emoji that will display a random value.sendDocument
(Object chat_id, File document) Use this method to send general files.sendDocument
(Object chat_id, String document) Use this method to send general files.Use this method to send a gameSends a gift to the given user or channel chat.Sends a gift to the given user or channel chat.sendInvoice
(Object chat_id, String title, String description, String payload, String currency, LabeledPrice[] prices) Use this method to send invoices.sendLocation
(Object chat_id, double latitude, double longitude) Use this method to send point on the map.sendMediaGroup
(Object chat_id, InputMedia[] media) Use this method to send a group of photos, videos, documents or audios as an album.sendMessage
(Object chat_id, String text) Use this method to send text messages.sendPaidMedia
(Object chat_id, short star_count, InputPaidMedia[] media) Use this method to send paid media.Use this method to send photos.Use this method to send photos.sendPoll
(Object chat_id, String question, InputPollOption[] options) Use this method to send a native poll.sendSticker
(Object chat_id, File sticker) sendSticker
(Object chat_id, String sticker) Use this method to send information about a venue.Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).sendVideoNote
(Object chat_id, File video_note) As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.sendVideoNote
(Object chat_id, String video_note) As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.setBusinessAccountBio
(String business_connection_id) Changes the bio of a managed business account.setBusinessAccountGiftSettings
(String business_connection_id, boolean show_gift_button, AcceptedGiftTypes accepted_gift_types) Changes the privacy settings pertaining to incoming gifts in a managed business account.setBusinessAccountName
(String business_connection_id, String first_name) Changes the first and last name of a managed business account.setBusinessAccountProfilePhoto
(String business_connection_id, InputProfilePhoto photo) Changes the profile photo of a managed business account.setBusinessAccountUsername
(String business_connection_id) Changes the username of a managed business account.setChatAdministratorCustomTitle
(Object chat_id, long user_id, String custom_title) Use this method to set a custom title for an administrator in a supergroup promoted by the bot.setChatDescription
(Object chat_id, String description) Use this method to change the description of a group, a supergroup or a channel.Use this method to change the bot's menu button in a private chat, or the default menu button.setChatPermissions
(Object chat_id, ChatPermissions permissions) Use this method to set default chat permissions for all members.setChatPhoto
(Object chat_id, File photo) Use this method to set a new profile photo for the chat.setChatStickerSet
(Object chat_id, String sticker_set_name) Use this method to set a new group sticker set for a supergroup.setChatTitle
(Object chat_id, String title) Use this method to change the title of a chat.Use this method to set the thumbnail of a custom emoji sticker set.setGameScore
(long chat_id, long user_id, int score, int message_id) Use this method to set the score of the specified user in a game message.setGameScore
(String inline_message_id, long user_id, int score) Use this method to set the score of the specified user in a game message.setMessageReaction
(Object chat_id, int message_id) Use this method to change the chosen reactions on a message.setMyCommands
(BotCommand[] commands) Use this method to change the list of the bot's commands.Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels.Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.Use this method to change the bot's name.setPassportDataErrors
(long user_id, PassportElementError[] errors) Informs a user that some of the Telegram Passport elements they provided contains errors.void
Use this method to set new state in group/supergroup chat for a uservoid
Use this method to set new state in private chat for a usersetStickerEmojiList
(String sticker, String[] emoji_list) Use this method to change the list of emoji assigned to a regular or custom emoji sticker.setStickerKeywords
(String sticker, String[] keywords) Use this method to change search keywords assigned to a regular or custom emoji sticker.setStickerMaskPosition
(String sticker) Use this method to change the mask position of a mask sticker.setStickerPositionInSet
(String sticker, int position) Use this method to move a sticker in a set created by the bot to a specific position.setStickerSetThumbnail
(String name, long user_id, File thumbnail, StickerFormat format) Use this method to set the thumbnail of a regular or mask sticker set.setStickerSetThumbnail
(String name, long user_id, String thumbnail, StickerFormat format) Use this method to set the thumbnail of a regular or mask sticker set.setStickerSetTitle
(String name, String title) Use this method to set the title of a created sticker set.setUserEmojiStatus
(long user_id) This method Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess.setWebhook
(String url) Use this method to specify a URL and receive incoming updates via an outgoing webhook.stopMessageLiveLocation
(Object chat_id, int message_id) Use this method to stop updating a live location message before live_period expires.stopMessageLiveLocation
(String inline_message_id) Use this method to stop updating a live location message before live_period expires.Use this method to stop a poll which was sent by the bot.transferBusinessAccountStars
(String business_connection_id, short star_count) Transfers Telegram Stars from the business account balance to the bot's balance.transferGift
(String business_connection_id, String owned_gift_id, long new_owner_chat_id) Transfers an owned unique gift to another user.unbanChatMember
(Object chat_id, long user_id) Use this method to unban a previously banned user in a supergroup or channel.unbanChatSenderChat
(Object chat_id, long sender_chat_id) Use this method to unban a previously banned channel chat in a supergroup or channel.unHideGeneralForumTopic
(Object chat_id) Use this method to unhide the 'General' topic in a forum supergroup chat.unpinAllChatMessages
(Object chat_id) Use this method to clear the list of pinned messages in a chat.unpinAllForumTopicMessages
(Object chat_id, int message_thread_id) Use this method to clear the list of pinned messages in a forum topic.unpinAllGeneralForumTopicMessages
(Object chat_id) Use this method to clear the list of pinned messages in a General forum topic.unpinChatMessage
(Object chat_id) Use this method to remove a message from the list of pinned messages in a chat.upgradeGift
(String business_connection_id, String owned_gift_id) Upgrades a given regular gift to a unique gift.uploadStickerFile
(long user_id, File sticker, StickerFormat sticker_format) Use this method to upload a file with a sticker for later use in thecreateNewStickerSet(long, java.lang.String, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker[])
,addStickerToSet(long, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker)
, orreplaceStickerInSet(long, java.lang.String, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker)
methods (the file can be used multiple times).verifyUChat
(Object chat_id) Verifies a c chat on behalf of the organization which is represented by the bot.verifyUser
(long user_id) Verifies a user on behalf of the organization which is represented by the bot.
-
Constructor Details
-
BotContext
-
-
Method Details
-
setWebhook
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
If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secretToken. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
- Parameters:
url
- holds parameters for webhook.- See Also:
-
getWebhookInfo
-
deleteWebhook
public void deleteWebhook()Use this method to remove webhook integration if you decide to back getUpdates.- See Also:
-
getMe
-
logOut
Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes.- Returns:
LogOut
-
close
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched.- Returns:
Close
-
sendMessage
Use this method to send text messages.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)text
- Text of the message to be sent, 1-4096 characters after entities parsing- Returns:
SendMessage
-
downloadFile
Use this method to download files up to 20MB in size. On success, aFile
object is returned.- Parameters:
file_path
- taken fromGetFile
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 callinggetFile(String)
again- Returns:
- array of byte
-
forward
Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)from_chat_id
- Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)message_id
- Message identifier in the chat specified in from_chat_id- Returns:
ForwardMessage
-
copy
Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)from_chat_id
- Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)message_id
- Message identifier in the chat specified in from_chat_id- Returns:
CopyMessage
-
forwardMessages
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)from_chat_id
- Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)message_id
- A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.- Returns:
ForwardMessages
-
sendPhoto
Use this method to send photos.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- 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- Returns:
SendPhoto
-
sendPhoto
Use this method to send photos.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- Photo to send. Upload new photo usingFile
. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20- Returns:
SendPhoto
-
sendAudio
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 or .M4A format. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)audio
- Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get an audio file from the Internet.- Returns:
SendAudio
-
sendAudio
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 or .M4A format. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future -
sendDocument
Use this method to send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)document
- File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a file from the Internet.- Returns:
SendDocument
-
sendDocument
Use this method to send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)document
- File to send. Upload usingFile
- Returns:
SendDocument
-
sendVideo
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video
- Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a video from the Internet- Returns:
SendVideo
-
sendVideo
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. -
sendAnimation
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)animation
- Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get an animation from the Internet.- Returns:
SendAnimation
-
sendAnimation
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)animation
- Animation to send. Upload usingFile
.- Returns:
SendAnimation
-
sendVoice
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, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)voice
- Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a file from the Internet.- Returns:
SendVoice
-
sendVoice
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, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. -
sendVideoNote
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video_note
- Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended)- Returns:
SendVideoNote
-
sendVideoNote
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video_note
- Video note to send. Upload usingFile
- Returns:
SendVideoNote
-
sendMediaGroup
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)media
- An array ofInputMediaVideo
,InputMediaAudio
,InputMediaPhoto
, orInputMediaDocument
describing messages to be sent, must include 2-10 items.- Returns:
SendMediaGroup
-
sendPaidMedia
Use this method to send paid media.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.star_count
- The number of Telegram Stars that must be paid to buy access to the media; 1-10000media
- A JSON-serialized array describing the media to be sent; up to 10 items- Returns:
SendPaidMedia
-
sendLocation
Use this method to send point on the map.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of the locationlongitude
- Longitude of the location- Returns:
SendLocation
-
editMessageLiveLocation
public EditMessageLiveLocation editMessageLiveLocation(Object chat_id, double latitude, double longitude, int message_id) Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, the edited Message is returned.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of new locationlongitude
- Longitude of new locationmessage_id
- Required if inline_message_id is not specified. Identifier of the message to edit- Returns:
EditMessageLiveLocation
-
editMessageLiveLocation
public EditMessageLiveLocation editMessageLiveLocation(String inline_message_id, double latitude, double longitude) Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, True is returned.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagelatitude
- Latitude of new locationlongitude
- Longitude of new location- Returns:
EditMessageLiveLocation
-
editUserStarSubscription
public EditUserStarSubscription editUserStarSubscription(long user_id, String telegram_charge_id, boolean is_cancelled) This a method that allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.- Parameters:
user_id
- Identifier of the user whose subscription will be editedtelegram_charge_id
- Telegram payment identifier for the subscriptionis_cancelled
- Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.- Returns:
EditUserStarSubscription
-
stopMessageLiveLocation
Use this method to stop updating a live location message before live_period expires. On success, the edited Message is returned.- Parameters:
chat_id
- 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
- Required if inline_message_id is not specified. Identifier of the message with live location to stop- Returns:
StopMessageLiveLocation
-
stopMessageLiveLocation
Use this method to stop updating a live location message before live_period expires. On success, True is returned.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified.
Identifier of the inline message- Returns:
StopMessageLiveLocation
-
editMessageChecklist
public EditMessageChecklist editMessageChecklist(String business_connection_id, Object chat_id, Integer message_id, InputChecklist checklist) Use this method to edit a checklist on behalf of a connected business account.- Parameters:
business_connection_id
- Unique identifier of the business connection on behalf of which the message will be sentchat_id
- Unique identifier for the target chatmessage_id
- Unique identifier for the target messagechecklist
- A JSON-serialized object for the new checklist- Returns:
EditMessageChecklist
-
sendVenue
public SendVenue sendVenue(Object chat_id, double latitude, double longitude, String title, String address) Use this method to send information about a venue.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of the venuelongitude
- Longitude of the venuetitle
- Name of the venueaddress
- Address of the venue- Returns:
SendVenue
-
sendContact
Use this method to send phone contacts.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)phone_number
- Contact's phone numberfirst_name
- Contact's first name- Returns:
SendContact
-
sendPoll
Use this method to send a native poll.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)question
- Poll question, 1-300 charactersoptions
- A JSON-serialized list of 2-12 answer options- Returns:
SendPoll
-
sendChecklist
public SendChecklist sendChecklist(String business_connection_id, Object chat_id, InputChecklist checklist) Use this method to send a checklist on behalf of a connected business account.- Parameters:
business_connection_id
- Unique identifier of the business connection on behalf of which the message will be sentchat_id
- Unique identifier for the target chatchecklist
- A JSON-serialized object for the checklist to send- Returns:
SendChecklist
-
sendDice
-
sendChatAction
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).- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)action
- Type of action to broadcast. Choose one, depending on what the user is about to receive:ChatAction.TYPING
for text messages,ChatAction.UPLOAD_PHOTO
for photos,ChatAction.RECORD_VIDEO
orChatAction.UPLOAD_VIDEO
for videos,ChatAction.RECORD_VOICE
orChatAction.UPLOAD_VOICE
for voice notes,ChatAction.UPLOAD_DOCUMENT
for general files,ChatAction.CHOSE_STICKER
for stickers,ChatAction.FIND_LOCATION
for location data,ChatAction.RECORD_VIDEO_NOTE
orChatAction.UPLOAD_VIDEO_NOTE
for video notes.- Returns:
SendChatAction
-
sendGift
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver- Parameters:
user_id
- Unique identifier of the target user who will receive the gift.gift_id
- Identifier of the gift- Returns:
SendGift
-
sendGift
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver- Parameters:
chat_id
- Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.gift_id
- Identifier of the gift- Returns:
SendGift
-
giftPremiumSubscription
public GiftPremiumSubscription giftPremiumSubscription(long user_id, Integer month_count, Integer star_count) Gifts a Telegram Premium subscription to the given user.- Parameters:
user_id
- Unique identifier of the target user who will receive a Telegram Premium subscriptionmonth_count
- Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12star_count
- Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months- Returns:
GiftPremiumSubscription
-
getUserProfilePhotos
Use this method to get a list of profile pictures for a user.- Parameters:
user_id
- Unique identifier of the target user- Returns:
GetUserProfilePhotos
-
refundStarPayment
Refunds a successful payment in Telegram Stars.- Parameters:
user_id
- Identifier of the user whose payment will be refundedtelegram_payment_change_id
- Telegram payment identifier- Returns:
RefundStarPayment
-
verifyUser
Verifies a user on behalf of the organization which is represented by the bot.- Parameters:
user_id
- Unique identifier of the target user- Returns:
VerifyUser
-
verifyUChat
Verifies a c chat on behalf of the organization which is represented by the bot.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
VerifyUser
-
removeUserVerification
Removes verification from a user who is currently verified on behalf of the organization represented by the bot.- Parameters:
user_id
- Unique identifier of the target user- Returns:
RemoveUserVerification
-
removeChatVerification
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
RemoveUserVerification
-
readBusinessMessage
public ReadBusinessMessage readBusinessMessage(long chat_id, String business_connection_id, int message_id) Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right.- Parameters:
chat_id
- Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.business_connection_id
- Unique identifier of the business connection on behalf of which to read the messagemessage_id
- Unique identifier of the message to mark as read- Returns:
ReadBusinessMessage
-
deleteBusinessMessages
public DeleteBusinessMessages deleteBusinessMessages(String business_connection_id, Integer[] message_ids) Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message.- Parameters:
business_connection_id
- Unique identifier of the business connection on behalf of which to delete the messagesmessage_ids
- A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat
SeedeleteMessage(java.lang.Object, int)
for limitations on which messages can be deleted- Returns:
DeleteBusinessMessages
-
setBusinessAccountName
public SetBusinessAccountName setBusinessAccountName(String business_connection_id, String first_name) Changes the first and last name of a managed business account. Requires the can_change_name business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionfirst_name
- The new value of the first name for the business account; 1-64 characters- Returns:
SetBusinessAccountName
-
setBusinessAccountUsername
Changes the username of a managed business account. Requires the can_change_username business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
SetBusinessAccountUsername
-
setBusinessAccountBio
Changes the bio of a managed business account. Requires the can_change_bio business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
SetBusinessAccountBio
-
setBusinessAccountProfilePhoto
public SetBusinessAccountProfilePhoto setBusinessAccountProfilePhoto(String business_connection_id, InputProfilePhoto photo) Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionphoto
- The new profile photo to set- Returns:
SetBusinessAccountProfilePhoto
-
removeBusinessAccountProfilePhoto
public RemoveBusinessAccountProfilePhoto removeBusinessAccountProfilePhoto(String business_connection_id) Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
RemoveBusinessAccountProfilePhoto
-
setBusinessAccountGiftSettings
public SetBusinessAccountGiftSettings setBusinessAccountGiftSettings(String business_connection_id, boolean show_gift_button, AcceptedGiftTypes accepted_gift_types) Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionshow_gift_button
- Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input fieldaccepted_gift_types
- Types of gifts accepted by the business account- Returns:
SetBusinessAccountGiftSettings
-
getBusinessAccountStarBalance
Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
GetBusinessAccountStarBalance
-
transferBusinessAccountStars
public TransferBusinessAccountStars transferBusinessAccountStars(String business_connection_id, short star_count) Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionstar_count
- Number of Telegram Stars to transfer; 1-10000- Returns:
TransferBusinessAccountStars
-
getBusinessAccountGifts
Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
GetBusinessAccountGifts
-
convertGiftToStars
Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionowned_gift_id
- Unique identifier of the regular gift that should be converted to Telegram Stars- Returns:
ConvertGiftToStars
-
upgradeGift
Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally, requires the can_transfer_stars business bot right if the upgrade is paid.- Parameters:
business_connection_id
- Unique identifier of the business connectionowned_gift_id
- Unique identifier of the regular gift that should be upgraded to a unique one- Returns:
UpgradeGift
-
transferGift
public TransferGift transferGift(String business_connection_id, String owned_gift_id, long new_owner_chat_id) Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid.- Parameters:
business_connection_id
- Unique identifier of the business connectionowned_gift_id
- Unique identifier of the regular gift that should be transferrednew_owner_chat_id
- Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.- Returns:
TransferGift
-
postStory
public PostStory postStory(String business_connection_id, InputStoryContent content, Integer active_period) Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectioncontent
- Content of the storyactive_period
- Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400- Returns:
PostStory
-
editStory
public EditStory editStory(String business_connection_id, Integer story_id, InputStoryContent content) Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionstory_id
- Unique identifier of the story to editcontent
- Content of the story- Returns:
EditStory
-
deleteStory
Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right.- Parameters:
business_connection_id
- Unique identifier of the business connectionstory_id
- Unique identifier of the story to delete- Returns:
DeleteStory
-
getFile
Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. The file can then be downloaded viadownloadFile(String)
where field file_path 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.- Parameters:
file_id
- File identifier to get information about- Returns:
GetFile
-
banChatMember
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
BanChatMember
-
unbanChatMember
Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned.- Parameters:
chat_id
- Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
UnbanChatMember
-
unbanChatSenderChat
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sender_chat_id
- Unique identifier of the target sender chat- Returns:
UnbanChatSenderChat
-
restrictChatMember
public RestrictChatMember restrictChatMember(Object chat_id, long user_id, ChatPermissions permissions) Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target userpermissions
- A JSON-serialized object for new user permissions- Returns:
RestrictChatMember
-
promoteChatMember
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
PromoteChatMember
-
setChatAdministratorCustomTitle
public SetChatAdministratorCustomTitle setChatAdministratorCustomTitle(Object chat_id, long user_id, String custom_title) Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target usercustom_title
- New custom title for the administrator; 0-16 characters, emoji are not allowed- Returns:
SetChatAdministratorCustomTitle
-
setUserEmojiStatus
This method Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Return True on success- Parameters:
user_id
- Unique identifier of the target user- Returns:
SetUserEmojiStatus
-
banChatSenderChat
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sender_chat_id
- Unique identifier of the target sender chat- Returns:
BanChatSenderChat
-
setChatPermissions
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)permissions
- A JSON-serialized object for new default chat permissions- Returns:
SetChatPermissions
-
exportChatInviteLink
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
ExportChatInviteLink
-
createChatInviteLink
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the methodrevokeChatInviteLink(java.lang.Object, java.lang.String)
.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
CreateChatInviteLink
-
createChatSubscriptionInviteLink
public CreateChatSubscriptionInviteLink createChatSubscriptionInviteLink(Object chat_id, int subscription_period, int subscription_price) Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the methodeditChatSubscriptionInviteLink(java.lang.Object, java.lang.String)
or revoked using the methodrevokeChatInviteLink(java.lang.Object, java.lang.String)
.- Parameters:
chat_id
- Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)subscription_period
- The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).subscription_price
- The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000- Returns:
CreateChatSubscriptionInviteLink
-
editChatInviteLink
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)invite_link
- The invite link to edit- Returns:
EditChatInviteLink
-
editChatSubscriptionInviteLink
public EditChatSubscriptionInviteLink editChatSubscriptionInviteLink(Object chat_id, String invite_link) Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)invite_link
- The invite link to edit- Returns:
EditChatSubscriptionInviteLink
-
revokeChatInviteLink
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier of the target chat or username of the target channel (in the format @channelusername)invite_link
- The invite link to revoke- Returns:
RevokeChatInviteLink
-
approveChatJoinRequest
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
ApproveChatJoinRequest
-
declineChatJoinRequest
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
DeclineChatJoinRequest
-
setChatPhoto
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- New chat photo, uploaded usingFile
- Returns:
SetChatPhoto
-
deleteChatPhoto
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
DeleteChatPhoto
-
setChatTitle
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)title
- New chat title, 1-128 characters- Returns:
SetChatTitle
-
setChatDescription
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)description
- New chat description, 0-255 characters- Returns:
SetChatDescription
-
pinChatMessage
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of a message to pin- Returns:
PinChatMessage
-
unpinChatMessage
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
UnpinChatMessage
-
unpinAllChatMessages
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
UnpinAllChatMessages
-
getMyStarBalance
A method to get the current Telegram Stars balance of the bot. Requires no parameters.- Returns:
GetMyStarBalance
-
getStarTransactions
Returns the bot's Telegram Star transactions in chronological order.- Returns:
GetStarTransactions
-
leaveChat
-
getChat
-
getUserChatBoosts
Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat.- Parameters:
chat_id
- Unique identifier for the chat or username of the channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
GetUserChatBoosts
-
getChatAdministrators
Use this method to get a list of administrators in a chat, which aren't bots.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
GetChatAdministrators
-
getChatMemberCount
Use this method to get the number of members in a chat.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
GetChatMemberCount
-
getChatMember
Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
GetChatMember
-
setMessageReaction
Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.- Returns:
SetMessageReaction
-
setChatStickerSet
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned ingetChat(java.lang.Object)
requests to check if the bot can use this method.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)sticker_set_name
- Name of the sticker set to be set as the group sticker set- Returns:
SetChatStickerSet
-
deleteChatStickerSet
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned ingetChat(java.lang.Object)
requests to check if the bot can use this method.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
DeleteChatStickerSet
-
getForumTopicIconStickers
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters.- Returns:
GetForumTopicIconStickers
-
createForumTopic
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)name
- Topic name, 1-128 characters- Returns:
CreateForumTopic
-
editForumTopic
Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)message_thread_id
- Unique identifier for the target message thread of the forum topic- Returns:
EditForumTopic
-
closeForumTopic
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)message_thread_id
- Unique identifier for the target message thread of the forum topic- Returns:
CloseForumTopic
-
reopenForumTopic
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)message_thread_id
- Unique identifier for the target message thread of the forum topic- Returns:
ReopenForumTopic
-
deleteForumTopic
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)message_thread_id
- Unique identifier for the target message thread of the forum topic- Returns:
DeleteForumTopic
-
unpinAllForumTopicMessages
Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)message_thread_id
- Unique identifier for the target message thread of the forum topic- Returns:
UnpinAllForumTopicMessages
-
editGeneralForumTopic
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)name
- New topic name, 1-128 characters- Returns:
EditGeneralForumTopic
-
closeGeneralForumTopic
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
CloseForumTopic
-
reopenGeneralForumTopic
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
ReopenGeneralForumTopic
-
hideGeneralForumTopic
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
HideGeneralForumTopic
-
unHideGeneralForumTopic
Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
UnHideGeneralForumTopic
-
unpinAllGeneralForumTopicMessages
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)- Returns:
UnpinAllGeneralForumTopicMessages
-
answerCallbackQuery
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.- Parameters:
callback_query_id
- Unique identifier for the query to be answered- Returns:
AnswerCallbackQuery
-
answerCallbackQuery
answerCallbackQuery(java.lang.String)
with text parameter- Parameters:
callback_query_id
- Unique identifier for the query to be answeredtext
- text Text of the notification.- Returns:
AnswerCallbackQuery
-
setMyCommands
Use this method to change the list of the bot's commands.- Parameters:
commands
- A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.- Returns:
SetMyCommands
- See Also:
-
deleteMyCommands
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users.- Returns:
DeleteMyCommands
-
getMyCommands
Use this method to get the current list of the bot's commands for the given scope and user language.- Returns:
GetMyCommands
-
setChatMenuButton
Use this method to change the bot's menu button in a private chat, or the default menu button.- Returns:
SetChatMenuButton
-
getChatMenuButton
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button.- Returns:
GetChatMenuButton
-
setMyDefaultAdministratorRights
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot.- Returns:
SetMyDefaultAdministratorRights
-
getMyDefaultAdministratorRights
Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.- Returns:
GetMyDefaultAdministratorRights
-
editMessageText
Use this method to edit text and game messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
text
- New text of the message, 1-4096 characters after entities parsingchat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the message to edit- Returns:
EditMessageText
-
editMessageText
Use this method to edit text and game messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
text
- ew text of the message, 1-4096 characters after entities parsinginline_message_id
- Identifier of the inline message- Returns:
EditMessageText
-
editMessageCaption
Use this method to edit captions of messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the message to edit- Returns:
EditMessageCaption
-
editMessageCaption
Use this method to edit captions of messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
inline_message_id
- Identifier of the inline message- Returns:
EditMessageCaption
-
editMessageMedia
Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)media
- A JSON-serialized object for a new media content of the messagemessage_id
- Required if inline_message_id is not specified. Identifier of the message to edit- Returns:
EditMessageMedia
-
editMessageMedia
Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, True is returned.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagemedia
- A JSON-serialized object for a new media content of the message- Returns:
EditMessageMedia
-
editMessageReplyMarkup
Use this method to edit only the reply markup of messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
chat_id
- 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
- Required if inline_message_id is not specified. Identifier of the message to edit- Returns:
EditMessageReplyMarkup
-
editMessageReplyMarkup
Use this method to edit only the reply markup of messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline message- Returns:
EditMessageReplyMarkup
-
stopPoll
Use this method to stop a poll which was sent by the bot.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the original message with the poll- Returns:
StopPoll
-
deleteMessage
Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago. - Service messages about a supergroup, channel, or forum topic creation can't be deleted. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the message to delete- Returns:
DeleteMessage
-
deleteMessages
Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_ids
- A JSON-serialized list of 1-100 identifiers of messages to delete.- Returns:
-
sendSticker
- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sticker
- Sticker to send. Pass .WEBM file- Returns:
SendSticker
-
sendSticker
- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sticker
- Sticker 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 .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, Video and animated stickers can't be sent via an HTTP URL.- Returns:
SendSticker
-
getStickerSet
Use this method to get a sticker set.- Parameters:
name
- Name of the sticker set- Returns:
GetStickerSet
-
getCustomEmojiStickers
Use this method to get information about custom emoji stickers by their identifiers.- Parameters:
custom_emoji_ids
- A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.- Returns:
GetCustomEmojiStickers
-
uploadStickerFile
public UploadStickerFile uploadStickerFile(long user_id, File sticker, StickerFormat sticker_format) Use this method to upload a file with a sticker for later use in thecreateNewStickerSet(long, java.lang.String, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker[])
,addStickerToSet(long, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker)
, orreplaceStickerInSet(long, java.lang.String, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker)
methods (the file can be used multiple times).- Parameters:
user_id
- User identifier of sticker file ownersticker
- A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format.sticker_format
- Format of the sticker- Returns:
UploadStickerFile
-
createNewStickerSet
public CreateNewStickerSet createNewStickerSet(long user_id, String name, String title, InputSticker[] stickers) Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created.- Parameters:
user_id
- User identifier of created sticker set ownername
- 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_". is case-insensitive. 1-64 characters. title
- Sticker set title, 1-64 charactersstickers
- A JSON-serialized list of 1-50 initial stickers to be added to the sticker set- Returns:
CreateNewStickerSet
-
addStickerToSet
Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers.- Parameters:
user_id
- User identifier of sticker set ownername
- Sticker set namesticker
- A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.- Returns:
AddStickerToSet
-
setStickerPositionInSet
Use this method to move a sticker in a set created by the bot to a specific position.- Parameters:
sticker
- File identifier of the stickerposition
- New sticker position in the set, zero-based- Returns:
SetStickerPositionInSet
-
deleteStickerFromSet
Use this method to delete a sticker from a set created by the bot.- Parameters:
sticker
- File identifier of the sticker- Returns:
DeleteStickerFromSet
-
setStickerEmojiList
Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot.- Parameters:
sticker
- File identifier of the stickeremoji_list
- A JSON-serialized list of 1-20 emoji associated with the sticker- Returns:
SetStickerEmojiList
-
setStickerKeywords
Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot- Parameters:
sticker
- File identifier of the stickerkeywords
- A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters- Returns:
SetStickerKeywords
-
setStickerMaskPosition
Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot.- Parameters:
sticker
- File identifier of the sticker- Returns:
SetStickerMaskPosition
-
setStickerSetTitle
Use this method to set the title of a created sticker set.- Parameters:
name
- Sticker set nametitle
- Sticker set title, 1-64 characters- Returns:
SetStickerSetTitle
-
replaceStickerInSet
public ReplaceStickerInSet replaceStickerInSet(long user_id, String name, String old_sticker, InputSticker sticker) Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to callingdeleteStickerFromSet(java.lang.String)
, thenaddStickerToSet(long, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker)
, thensetStickerPositionInSet(java.lang.String, int)
.- Parameters:
user_id
- User identifier of the sticker set ownername
- Sticker set nameold_sticker
- File identifier of the replaced stickersticker
- A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.- Returns:
ReplaceStickerInSet
-
setStickerSetThumbnail
public SetStickerSetThumbnail setStickerSetThumbnail(String name, long user_id, File thumbnail, StickerFormat format) Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set.- Parameters:
name
- Sticker set nameuser_id
- User identifier of the sticker set ownerthumbnail
- A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size. animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, or pass an HTTP URL as a String for Telegram to get a file from the Internetformat
- Format of the thumbnail, must be one ofStickerFormat.STATIC
for a .WEBP or .PNG image,StickerFormat.ANIMATED
for a .TGS animation, orStickerFormat.VIDEO
for a .WEBM video- Returns:
SetStickerSetThumbnail
-
setStickerSetThumbnail
public SetStickerSetThumbnail setStickerSetThumbnail(String name, long user_id, String thumbnail, StickerFormat format) Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set.- Parameters:
name
- Sticker set nameuser_id
- User identifier of the sticker set ownerthumbnail
- A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size. animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see for video sticker technical requirements. Upload usingFile
format
- Format of the thumbnail, must be one ofStickerFormat.STATIC
for a .WEBP or .PNG image,StickerFormat.ANIMATED
for a .TGS animation, orStickerFormat.VIDEO
for a .WEBM video- Returns:
SetStickerSetThumbnail
-
setCustomEmojiStickerSetThumbnail
Use this method to set the thumbnail of a custom emoji sticker set.- Parameters:
name
- Sticker set name- Returns:
SetCustomEmojiStickerSetThumbnail
-
deleteStickerSet
Use this method to delete a sticker set that was created by the bot.- Parameters:
name
- Sticker set name- Returns:
DeleteStickerSet
-
getBusinessConnection
Use this method to get information about the connection of the bot with a business account.- Parameters:
business_connection_id
- Unique identifier of the business connection- Returns:
GetBusinessConnection
-
answerInlineQuery
Use this method to send answers to an inline query. No more than 50 results per query are allowed.- Parameters:
inline_query_id
- Unique identifier for the answered queryresults
- A JSON-serialized array of results for the inline query- Returns:
AnswerInlineQuery
-
savePreparedInlineMessage
Stores a message that can be sent by a user of a Mini App. Returns aPreparedInlineMessage
object.- Parameters:
user_id
- Unique identifier of the target user that can use the prepared messageresult
-InlineQueryResult
object describing the message to be sent- Returns:
SavePreparedInlineMessage
-
answerWebAppQuery
Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.- Parameters:
web_app_query_id
- Unique identifier for the query to be answeredresult
- A JSON-serialized object describing the message to be sent- Returns:
AnswerWebAppQuery
-
sendInvoice
public SendInvoice sendInvoice(Object chat_id, String title, String description, String payload, String currency, LabeledPrice[] prices) Use this method to send invoices.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)title
- Product name, 1-32 charactersdescription
- Product description, 1-255 characterspayload
- Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.currency
- Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.prices
- Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.- Returns:
SendInvoice
-
createInvoiceLink
public CreateInvoiceLink createInvoiceLink(String title, String description, String payload, String currency, LabeledPrice[] prices) Use this method to create a link for an invoice.- Parameters:
title
- Product name, 1-32 charactersdescription
- Product description, 1-255 characterspayload
- Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.currency
- Three-letter ISO 4217 currency code. Pass “XTR” for payments in Telegram Stars.prices
- Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.- Returns:
CreateInvoiceLink
-
answerShippingQuery
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.- Parameters:
shipping_query_id
- Unique identifier for the query to be answeredok
- Pass 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)- Returns:
AnswerShippingQuery
-
answerPreCheckoutQuery
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.- Parameters:
pre_checkout_query_id
- Unique identifier for the query to be answeredok
- 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.- Returns:
AnswerPreCheckoutQuery
-
setPassportDataErrors
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.- Parameters:
user_id
- User identifiererrors
- A JSON-serialized array describing the errors- Returns:
SetPassportDataErrors
-
sendGame
-
setGameScore
Use this method to set the score of the specified user in a game message. On success, the Message is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chatuser_id
- User identifierscore
- New score, must be non-negativemessage_id
- Required if inline_message_id is not specified. Identifier of the sent message- Returns:
SetGameScore
-
setGameScore
Use this method to set the score of the specified user in a game message. On success, True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messageuser_id
- User identifierscore
- New score, must be non-negative- Returns:
SetGameScore
-
getAvailableGifts
Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns aGifts
object.- Returns:
GetAvailableGifts
-
getMyName
-
setMyName
-
getMyDescription
Use this method to get the current bot description for the given user language.- Returns:
GetMyDescription
-
setMyDescription
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.- Returns:
SetMyDescription
-
getGameHighScores
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game.
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chatuser_id
- Target user idmessage_id
- Required if inline_message_id is not specified. Identifier of the sent message- Returns:
GetGameHighScores
-
getGameHighScores
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game.
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.- Parameters:
inline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messageuser_id
- Target user id- Returns:
GetGameHighScores
-
setState
Use this method to set new state in group/supergroup chat for a user- Parameters:
chat_id
- Unique identifier for the target chatuser_id
- Target user idname
- state name
-
setState
Use this method to set new state in private chat for a user- Parameters:
user_id
- Target user idname
- state name
-
clearState
public void clearState(long chat_id, long user_id) Use this method to clear an existing state when it is no longer needed in a group/supergroup chat for a user.- Parameters:
chat_id
- Unique identifier for the target chatuser_id
- Target user id
-
clearState
public void clearState(long user_id) Use this method to clear an existing state when it is no longer needed in a private chat for a user.- Parameters:
user_id
- Target user id
-
getStateData
-
getStateData
-
getUpdates
Use this method to receive incoming updates using long polling- Returns:
GetUpdates
-