RawAPI class

Raw API class for making direct calls to the Telegram Bot API.

This class provides low-level access to the Telegram Bot API endpoints. It handles HTTP requests, response parsing, error handling, and file uploads.

The RawAPI class is designed to be used internally by higher-level bot implementations but can also be used directly for advanced use cases.

Constructors

RawAPI(String token, {HttpClient? httpClient, String? baseUrl, bool isTest = false})
Creates a new RawAPI instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
isTest bool
Whether we are running in test environment.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
token String
The bot token used for authentication.
final
transformers List<Transformer>
Gets a read-only list of all installed transformers.
no setter

Methods

addStickerToSet(int userId, String name, InputSticker sticker) Future<bool>
Adds a new sticker to a set created by the bot.
answerCallbackQuery(String callbackQueryId, {String? text, bool showAlert = false, String? url, int cacheTime = 0}) Future<bool>
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
answerChatJoinRequestQuery(String chatJoinRequestQueryId, String result) Future<bool>
Use this method to process a received chat join request query. Returns True on success.
answerGuestQuery(String guestQueryId, InlineQueryResult result) Future<SentGuestMessage>
Use this method to reply to a received guest message.
answerInlineQuery(String inlineQueryId, List<InlineQueryResult> results, {int? cacheTime, bool? isPersonal, String? nextOffset, InlineQueryResultsButton? button}) Future<bool>
Sends answers to an inline query.
answerPreCheckoutQuery(String preCheckoutQueryId, bool ok, {String? errorMessage}) Future<bool>
Responds to pre-checkout queries.
answerShippingQuery(String shippingQueryId, bool ok, {List<ShippingOption>? shippingOptions, String? errorMessage}) Future<bool>
Responds to shipping queries.
answerWebAppQuery(String webAppQueryId, InlineQueryResult result) Future<SentWebAppMessage>
Sets the result of an interaction with a Web App and sends a corresponding message.
approveChatJoinRequest(ID chatId, int userId) Future<bool>
Use this method to approve a chat join request.
approveSuggestedPost(ID chatId, int messageId, {int? sendDate}) Future<bool>
Approves a suggested post in a direct messages chat.
banChatMember(ID chatId, int userId, {DateTime? untilDate, bool? revokeMessages}) Future<bool>
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. Returns True on success.
banChatSenderChat(ID chatId, int senderChatId) Future<bool>
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. Returns True on success.
call<T>(String method, Payload payload) Future<T>
Makes a generic API call to any Telegram Bot API method.
clearTransformers() → void
Clears all transformers.
close() Future<bool>
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 True on success. Requires no parameters.
closeClient() Future<void>
Closes the RawAPI instance and releases resources.
closeForumTopic(ID chatId, int messageThreadId) Future<bool>
Use this method to close an open topic in a forum supergroup chat.
closeGeneralForumTopic(ID chatId) Future<bool>
Use this method to close an open 'General' topic in a forum supergroup chat.
convertGiftToStars(String businessConnectionId, String ownedGiftId) Future<bool>
Converts a given regular gift to Telegram Stars.
copyMessage(ID chatId, ID fromChatId, int messageId, {int? messageThreadId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, bool? showCaptionAboveMedia, bool? allowPaidBroadcast, int? videoStartTimestamp, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters, String? messageEffectId}) Future<MessageId>
Use this method to copy messages of any kind. Service 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. Returns the MessageId of the sent message on success.
copyMessages(ID chatId, ID fromChatId, List<int> messageIds, {int? messageThreadId, bool? disableNotification, bool? protectContent, bool? removeCaption, int? directMessagesTopicId}) Future<List<MessageId>>
Copies messages of any kind.
Use this method to create an additional invite link for a chat.
Creates a subscription invite link for a channel chat.
createForumTopic(ID chatId, String name, {int? iconColor, String? iconCustomEmojiId}) Future<ForumTopic>
Use this method to create a topic in a forum supergroup chat.
Creates a link for an invoice.
createNewStickerSet(int userId, String name, String title, List<InputSticker> stickers, {StickerType? stickerType, bool? needsRepainting}) Future<bool>
Creates a new sticker set owned by a user.
declineChatJoinRequest(ID chatId, int userId) Future<bool>
Use this method to decline a chat join request.
declineSuggestedPost(ID chatId, int messageId, {String? comment}) Future<bool>
Declines a suggested post in a direct messages chat.
deleteAllMessageReactions(ID chatId, {int? userId, int? actorChatId}) Future<bool>
Use this method to remove up to 10000 recent reactions in a group or a supergroup chat added by a given user or chat. The bot must have the 'can_delete_messages' administrator right in the chat. Returns True on success.
deleteBusinessMessages(String businessConnectionId, List<int> messageIds) Future<bool>
Delete messages on behalf of a business account.
deleteChatPhoto(ID chatId) Future<bool>
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. Returns True on success.
deleteChatStickerSet(ID chatId) Future<bool>
Use this method to delete a group sticker set from a supergroup.
deleteForumTopic(ID chatId, int messageThreadId) Future<bool>
Use this method to delete a forum topic along with all its messages.
deleteMessage(ID chatId, int messageId) Future<bool>
Deletes a message, including service messages.
deleteMessageReaction(ID chatId, int messageId, {int? userId, int? actorChatId}) Future<bool>
Use this method to remove a reaction from a message in a group or a supergroup chat. The bot must have the 'can_delete_messages' administrator right in the chat. Returns True on success.
deleteMessages(ID chatId, List<int> messageIds) Future<bool>
Deletes multiple messages simultaneously.
deleteMyCommands({BotCommandScope? scope, String? languageCode}) Future<bool>
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 True on success.
deleteMyProfilePhoto() Future<bool>
Removes the profile photo of the bot. Requires no parameters. Returns True on success.
deleteStickerFromSet(String sticker) Future<bool>
Deletes a sticker from a set created by the bot.
deleteStickerSet(String name) Future<bool>
Deletes a sticker set that was created by the bot.
deleteStory(String businessConnectionId, int storyId) Future<bool>
Deletes a story previously posted by the bot on behalf of a managed business account.
deleteWebhook({bool? dropPendingUpdates}) Future<bool>
Removes webhook integration if you decide to switch back to getUpdates. Returns True on success.
Use this method to edit a non-primary invite link created by the bot.
Edits a subscription invite link created by the bot.
editForumTopic(ID chatId, int messageThreadId, {String? name, String? iconCustomEmojiId}) Future<bool>
Use this method to edit name and icon of a topic in a forum supergroup chat.
editGeneralForumTopic(ID chatId, String name) Future<bool>
Use this method to edit the name of the 'General' topic in a forum supergroup chat.
editInlineMessageCaption(String inlineMessageId, {String? businessConnectionId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? showCaptionAboveMedia, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Edits caption of an inline message.
editInlineMessageLiveLocation(String inlineMessageId, double latitude, double longitude, {String? businessConnectionId, int? livePeriod, double? horizontalAccuracy, int? heading, int? proximityAlertRadius, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Edits live location of an inline message.
editInlineMessageMedia(String inlineMessageId, InputMedia media, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Edits media of an inline message.
editInlineMessageReplyMarkup(String inlineMessageId, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Edits reply markup of an inline message.
editInlineMessageText(String inlineMessageId, String? text, {InputRichMessage? richMessage, String? businessConnectionId, ParseMode? parseMode, List<MessageEntity>? entities, LinkPreviewOptions? linkPreviewOptions, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Edits text of an inline message.
editMessageCaption(ID chatId, int messageId, {String? businessConnectionId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? showCaptionAboveMedia, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits caption of a message.
editMessageChecklist(String businessConnectionId, ID chatId, int messageId, InputChecklist checklist, {InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits a checklist on behalf of a connected business account.
editMessageLiveLocation(ID chatId, int messageId, double latitude, double longitude, {String? businessConnectionId, int? livePeriod, double? horizontalAccuracy, int? heading, int? proximityAlertRadius, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits live location of a message.
editMessageMedia(ID chatId, int messageId, InputMedia media, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits media of a message.
editMessageReplyMarkup(ID chatId, int messageId, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits reply markup of a message.
editMessageText(ID chatId, int messageId, String? text, {InputRichMessage? richMessage, String? businessConnectionId, ParseMode? parseMode, List<MessageEntity>? entities, LinkPreviewOptions? linkPreviewOptions, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Edits text of a message.
editStory(String businessConnectionId, int storyId, InputStoryContent content, {String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, List<StoryArea>? areas}) Future<Story>
Edits a story previously posted by the bot on behalf of a managed business account.
editUserStarSubscription(int userId, String telegramPaymentChargeId, bool isCanceled) Future<bool>
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.
Use this method to generate a new primary invite link for a chat.
forwardMessage(ID chatId, ID fromChatId, int messageId, {bool? disableNotification, int? messageThreadId, bool? protectContent, int? videoStartTimestamp, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters, String? messageEffectId}) Future<Message>
Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned.
forwardMessages(ID chatId, ID fromChatId, List<int> messageIds, {int? messageThreadId, bool? disableNotification, bool? protectContent, int? directMessagesTopicId}) Future<List<MessageId>>
Forwards multiple messages of any kind.
getAvailableGifts() Future<Gifts>
Returns the list of gifts that can be sent by the bot to users and channel chats.
getBusinessAccountGifts(String businessConnectionId, {bool? excludeUnsaved, bool? excludeSaved, bool? excludeUnlimited, bool? excludeLimitedUpgradable, bool? excludeLimitedNonUpgradable, bool? excludeUnique, bool? excludeFromBlockchain, bool? sortByPrice, String? offset, int? limit}) Future<OwnedGifts>
Returns the gifts received and owned by a managed business account.
getBusinessAccountStarBalance(String businessConnectionId) Future<StarAmount>
Returns the amount of Telegram Stars owned by a managed business account.
getBusinessConnection(String businessConnectionId) Future<BusinessConnection>
Gets information about the connection of the bot with a business account.
getChat(ID chatId) Future<ChatFullInfo>
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
getChatAdministrators(ID chatId, {bool? returnBots}) Future<List<ChatMember>>
Use this method to get a list of administrators in a chat. Returns an Array of ChatMember objects.
getChatGifts(ID chatId, {bool? excludeUnsaved, bool? excludeSaved, bool? excludeUnlimited, bool? excludeLimitedUpgradable, bool? excludeLimitedNonUpgradable, bool? excludeFromBlockchain, bool? excludeUnique, bool? sortByPrice, String? offset, int? limit}) Future<OwnedGifts>
Returns the gifts owned by a chat. Returns OwnedGifts on success.
getChatMember(ID chatId, int userId) Future<ChatMember>
Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success.
getChatMemberCount(ID chatId) Future<int>
Use this method to get the number of members in a chat. Returns Int on success.
getChatMenuButton(ID chatId) Future<MenuButton>
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
getCustomEmojiStickers(List<String> customEmojiIds) Future<List<Sticker>>
Gets information about custom emoji stickers by their identifiers.
getFile(String fileId) Future<File>
Use this method to get basic information about a file and prepare it for downloading.
getForumTopicIconStickers() Future<List<Sticker>>
Use this method to get custom emoji stickers, which can be used as a forum topic icon.
getGameHighScores(int userId, {ID? chatId, int? messageId, String? inlineMessageId}) Future<List<GameHighScore>>
Gets data for high score tables.
getManagedBotAccessSettings(int userId) Future<BotAccessSettings>
Use this method to get the access settings of a managed bot.
getManagedBotToken(int userId) Future<String>
Use this method to get the token of a managed bot. Returns the token as String on success.
getMe() Future<User>
Gets basic information about the bot.
getMyCommands({BotCommandScope? scope, String? languageCode}) Future<List<BotCommand>>
Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.
getMyDefaultAdministratorRights({bool? forChannels}) Future<ChatAdministratorRights>
Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
getMyDescription({String? languageCode}) Future<BotDescription>
Use this method to get the current bot description for the given user language. Returns BotDescription on success.
getMyName({String? languageCode}) Future<BotName>
Use this method to get the current bot name for the given user language. Returns BotName on success.
getMyShortDescription({String? languageCode}) Future<BotShortDescription>
Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.
getMyStarBalance() Future<StarAmount>
Gets the current Telegram Stars balance of the bot.
getStarTransactions({int? offset, int? limit}) Future<StarTransactions>
Returns the bot's Telegram Star transactions in chronological order.
getStickerSet(String name) Future<StickerSet>
Gets a sticker set.
getUpdates({int? offset, int? limit, int? timeout, List<UpdateType>? allowedUpdates}) Future<List<Update>>
Gets updates for the bot.
getUserChatBoosts(ID chatId, int userId) Future<UserChatBoosts>
Gets the list of boosts added to a chat by a user.
getUserGifts(int userId, {bool? excludeUnlimited, bool? excludeLimitedUpgradable, bool? excludeLimitedNonUpgradable, bool? excludeFromBlockchain, bool? excludeUnique, bool? sortByPrice, String? offset, int? limit}) Future<OwnedGifts>
Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.
getUserPersonalChatMessages(int userId, int limit) Future<List<Message>>
Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user.
getUserProfileAudios(int userId) Future<UserProfileAudios>
Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
getUserProfilePhotos(int userId, {int? offset, int? limit}) Future<UserProfilePhotos>
Use this method to get a list of profile pictures for a user.
getWebhookInfo() Future<WebhookInfo>
Gets current webhook status. Returns current webhook status.
giftPremiumSubscription(int userId, int monthCount, int starCount, {String? text, ParseMode? textParseMode, List<MessageEntity>? textEntities}) Future<bool>
Gifts a Telegram Premium subscription to the given user.
hideGeneralForumTopic(ID chatId) Future<bool>
Use this method to hide the 'General' topic in a forum supergroup chat.
leaveChat(ID chatId) Future<bool>
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
logOut() Future<bool>
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 True on success. Requires no parameters. Note: This will affect all running bots.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pinChatMessage(ID chatId, int messageId, {bool? disableNotification, String? businessConnectionId}) Future<bool>
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. Returns True on success.
postStory(String businessConnectionId, InputStoryContent content, int activePeriod, {String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, List<StoryArea>? areas, bool? postToChatPage, bool? protectContent}) Future<Story>
Posts a story on behalf of a managed business account.
promoteChatMember(ID chatId, int userId, {bool? isAnonymous, bool? canManageChat, bool? canPostMessages, bool? canEditMessages, bool? canDeleteMessages, bool? canManageVideoChats, bool? canRestrictMembers, bool? canPromoteMembers, bool? canChangeInfo, bool? canInviteUsers, bool? canPinMessages, bool? canManageTopics, bool? canPostStories, bool? canEditStories, bool? canDeleteStories, bool? canManageDirectMessages, bool? canManageTags}) Future<bool>
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. Returns True on success.
readBusinessMessage(String businessConnectionId, ID chatId, int messageId) Future<bool>
Marks incoming message as read on behalf of a business account.
refundStarPayment(int userId, String telegramPaymentChargeId) Future<bool>
Refunds a successful payment in Telegram Stars.
removeBusinessAccountProfilePhoto(String businessConnectionId, {bool? isPublic}) Future<bool>
Removes the current profile photo of a managed business account.
removeChatVerification(ID chatId) Future<bool>
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
removeTransformer(Transformer transformer) bool
Removes a specific transformer from the chain.
removeTransformersOfType<T extends Transformer>() int
Removes all transformers of the specified type.
removeUserVerification(int userId) Future<bool>
Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
reopenForumTopic(ID chatId, int messageThreadId) Future<bool>
Use this method to reopen a closed topic in a forum supergroup chat.
reopenGeneralForumTopic(ID chatId) Future<bool>
Use this method to reopen a closed 'General' topic in a forum supergroup chat.
replaceManagedBotToken(int userId) Future<String>
Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success.
replaceStickerInSet(int userId, String name, String oldSticker, InputSticker sticker) Future<bool>
Replaces an existing sticker in a sticker set with a new one.
repostStory(String businessConnectionId, ID fromChatId, int fromStoryId, int activePeriod, {bool? postToChatPage, bool? protectContent}) Future<Story>
Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.
restrictChatMember(ID chatId, int userId, ChatPermissions permissions, {DateTime? untilDate, bool? useIndependentChatPermissions}) Future<bool>
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. Returns True on success.
Use this method to revoke an invite link created by the bot.
savePreparedInlineMessage(int userId, InlineQueryResult result, {bool? allowUserChats, bool? allowBotChats, bool? allowGroupChats, bool? allowChannelChats}) Future<PreparedInlineMessage>
Stores a message that can be sent by a user of a Mini App.
savePreparedKeyboardButton(int userId, KeyboardButton button) Future<PreparedKeyboardButton>
Stores a keyboard button that can be used by a user within a Mini App.
sendAnimation(ID chatId, InputFile animation, {int? messageThreadId, int? duration, int? width, int? height, InputFile? thumbnail, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? hasSpoiler, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends animation files (GIF or H.264/MPEG-4 AVC video without sound).
sendAudio(ID chatId, InputFile audio, {int? messageThreadId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, int? duration, String? performer, String? title, InputFile? thumbnail, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
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. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
sendChatAction(ID chatId, ChatAction action, {int? messageThreadId, String? businessConnectionId}) Future<bool>
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). Returns True on success.
sendChatJoinRequestWebApp(String chatJoinRequestQueryId, String webAppUrl) Future<bool>
Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome. Returns True on success.
sendChecklist(String businessConnectionId, ID chatId, InputChecklist checklist, {bool? disableNotification, bool? protectContent, String? messageEffectId, ReplyParameters? replyParameters, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Sends a checklist on behalf of a connected business account.
sendContact(ID chatId, String phoneNumber, String firstName, {int? messageThreadId, String? lastName, String? vcard, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send phone contacts. On success, the sent Message is returned.
sendDice(ID chatId, {DiceEmoji emoji = DiceEmoji.dice, int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
sendDocument(ID chatId, InputFile document, {int? messageThreadId, InputFile? thumbnail, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? disableContentTypeDetection, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send general files. On success, the sent Message is returned.
sendGame(ID chatId, String gameShortName, {String? businessConnectionId, int? messageThreadId, bool? disableNotification, bool? protectContent, bool? allowPaidBroadcast, String? messageEffectId, ReplyParameters? replyParameters, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Sends a game.
sendGift(String giftId, {int? userId, ID? chatId, bool? payForUpgrade, String? text, ParseMode? textParseMode, List<MessageEntity>? textEntities}) Future<bool>
Sends a gift to the given user or channel chat.
sendInvoice(ID chatId, String title, String description, String payload, String currency, List<LabeledPrice> prices, {int? messageThreadId, String? providerToken, int? maxTipAmount, List<int>? suggestedTipAmounts, String? startParameter, String? providerData, String? photoUrl, int? photoSize, int? photoWidth, int? photoHeight, bool? needName, bool? needPhoneNumber, bool? needEmail, bool? needShippingAddress, bool? sendPhoneNumberToProvider, bool? sendEmailToProvider, bool? isFlexible, bool? disableNotification, bool? protectContent, bool? allowPaidBroadcast, String? messageEffectId, ReplyParameters? replyParameters, InlineKeyboardMarkup? replyMarkup, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends an invoice.
sendLivePhoto(ID chatId, InputFile livePhoto, InputFile photo, {int? messageThreadId, int? directMessagesTopicId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? showCaptionAboveMedia, bool? hasSpoiler, bool? disableNotification, bool? protectContent, bool? allowPaidBroadcast, String? messageEffectId, SuggestedPostParameters? suggestedPostParameters, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, String? businessConnectionId}) Future<Message>
Use this method to send live photos. On success, the sent Message is returned.
sendLocation(ID chatId, double latitude, double longitude, {int? messageThreadId, double? horizontalAccuracy, int? livePeriod, int? heading, int? proximityAlertRadius, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send point on the map.
sendMediaGroup(ID chatId, List<InputMedia> media, {int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId}) Future<List<Message>>
Sends a group of photos, videos, documents or audios as an album.
sendMessage(ID chatId, String text, {int? messageThreadId, ParseMode? parseMode, List<MessageEntity>? entities, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, LinkPreviewOptions? linkPreviewOptions, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends a text message.
sendMessageDraft(ID chatId, int draftId, {String? text, int? messageThreadId, ParseMode? parseMode, List<MessageEntity>? entities}) Future<bool>
Streams a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success.
sendPaidMedia(ID chatId, int starCount, List<InputPaidMedia> media, {String? businessConnectionId, String? payload, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? showCaptionAboveMedia, bool? disableNotification, bool? protectContent, bool? allowPaidBroadcast, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends paid media.
sendPhoto(ID chatId, InputFile photo, {int? messageThreadId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, bool? hasSpoiler, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends a photo.
sendPoll(ID chatId, String question, List<InputPollOption> options, {int? messageThreadId, bool? isAnonymous, PollType type = PollType.regular, bool? allowsMultipleAnswers, int? correctOptionId, String? explanation, ParseMode? explanationParseMode, List<MessageEntity>? explanationEntities, int? openPeriod, DateTime? closeDate, bool? isClosed, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, ParseMode? questionParseMode, List<MessageEntity>? questionEntities, String? messageEffectId, bool? allowPaidBroadcast, InputPollMedia? media, InputPollMedia? explanationMedia, bool? membersOnly, List<String>? countryCodes}) Future<Message>
Use this method to send a native poll. On success, the sent Message is returned.
sendRichMessage(ID chatId, InputRichMessage richMessage, {int? messageThreadId, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send rich messages. If the message contains a block with a media element, then the bot must have the right to send the media to the chat. On success, the sent Message is returned.
sendRichMessageDraft(ID chatId, int draftId, InputRichMessage richMessage, {int? messageThreadId}) Future<bool>
Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you must call sendRichMessage with the complete message to persist it in the user's chat. Returns True on success.
sendSticker(ID chatId, InputFile sticker, {String? businessConnectionId, int? messageThreadId, String? emoji, bool? disableNotification, bool? protectContent, bool? allowPaidBroadcast, String? messageEffectId, ReplyParameters? replyParameters, ReplyMarkup? replyMarkup, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends static .WEBP, animated .TGS, or video .WEBM stickers.
sendVenue(ID chatId, double latitude, double longitude, String title, String address, {int? messageThreadId, String? foursquareId, String? foursquareType, String? googlePlaceId, String? googlePlaceType, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send information about a venue.
sendVideo(ID chatId, InputFile video, {int? messageThreadId, int? duration, int? width, int? height, InputFile? thumbnail, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, bool? hasSpoiler, bool? supportsStreaming, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? showCaptionAboveMedia, bool? allowPaidBroadcast, InputFile? cover, int? startTimestamp, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned.
sendVideoNote(ID chatId, InputFile videoNote, {int? messageThreadId, int? duration, int? length, InputFile? thumbnail, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends rounded square MPEG4 video messages.
sendVoice(ID chatId, InputFile voice, {int? messageThreadId, String? caption, ParseMode? parseMode, List<MessageEntity>? captionEntities, int? duration, bool? disableNotification, bool? protectContent, ReplyMarkup? replyMarkup, ReplyParameters? replyParameters, String? businessConnectionId, String? messageEffectId, bool? allowPaidBroadcast, int? directMessagesTopicId, SuggestedPostParameters? suggestedPostParameters}) Future<Message>
Sends audio files as playable voice messages. On success, the sent Message is returned.
setBusinessAccountBio(String businessConnectionId, {String? bio}) Future<bool>
Changes the bio of a managed business account.
setBusinessAccountGiftSettings(String businessConnectionId, bool showGiftButton, AcceptedGiftTypes acceptedGiftTypes) Future<bool>
Changes the privacy settings pertaining to incoming gifts in a managed business account.
setBusinessAccountName(String businessConnectionId, String firstName, {String? lastName}) Future<bool>
Changes the first and last name of a managed business account.
setBusinessAccountProfilePhoto(String businessConnectionId, InputProfilePhoto photo, {bool? isPublic}) Future<bool>
Changes the profile photo of a managed business account.
setBusinessAccountUsername(String businessConnectionId, {String? username}) Future<bool>
Changes the username of a managed business account.
setChatAdministratorCustomTitle(ID chatId, int userId, String customTitle) Future<bool>
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
setChatDescription(ID chatId, String? description) Future<bool>
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. Returns True on success.
setChatMemberTag(ID chatId, int userId, String tag) Future<bool>
Use this method to set a tag for a regular member in a group or a supergroup.
setChatMenuButton(MenuButton menuButton, {ID? chatId}) Future<bool>
Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
setChatPermissions(ID chatId, ChatPermissions permissions, {bool? useIndependentChatPermissions}) Future<bool>
Use this method to set default chat permissions for all members.
setChatPhoto(ID chatId, InputFile photo) Future<bool>
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. Returns True on success.
setChatStickerSet(ID chatId, String stickerSetName) Future<bool>
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 in getChat requests to check if the bot can use this method. Returns True on success.
setChatTitle(ID chatId, String title) Future<bool>
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. Returns True on success.
setCustomEmojiStickerSetThumbnail(String name, {String? customEmojiId}) Future<bool>
Sets the thumbnail of a custom emoji sticker set.
setGameScore(int userId, int score, {bool? force, bool? disableEditMessage, ID? chatId, int? messageId, String? inlineMessageId}) Future
Sets the score of the specified user in a game message.
setManagedBotAccessSettings(int userId, bool isAccessRestricted, {List<int>? addedUserIds}) Future<bool>
Use this method to change the access settings of a managed bot.
setMessageReaction(ID chatId, int messageId, {List<ReactionType>? reaction, bool? isBig}) Future<bool>
Sets reactions on a message.
setMyCommands(List<BotCommand> commands, {BotCommandScope? scope, String? languageCode}) Future<bool>
Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.
setMyDefaultAdministratorRights({ChatAdministratorRights? rights, bool? forChannels}) Future<bool>
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 True on success.
setMyDescription({String? description, String? languageCode}) Future<bool>
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
setMyName({String? name, String? languageCode}) Future<bool>
Use this method to change the bot's name. Returns True on success.
setMyProfilePhoto(InputProfilePhoto photo) Future<bool>
Changes the profile photo of the bot. Returns True on success.
setMyShortDescription({String? shortDescription, String? languageCode}) Future<bool>
Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success.
setPassportDataErrors(int userId, List<PassportElementError> errors) Future<bool>
Informs a user that some Telegram Passport elements contain errors.
setStickerEmojiList(String sticker, List<String> emojiList) Future<bool>
Changes the list of emoji assigned to a regular or custom emoji sticker.
setStickerKeywords(String sticker, {List<String>? keywords}) Future<bool>
Changes search keywords assigned to a regular or custom emoji sticker.
setStickerMaskPosition(String sticker, {MaskPosition? maskPosition}) Future<bool>
Changes the mask position of a mask sticker.
setStickerPositionInSet(String sticker, int position) Future<bool>
Moves a sticker in a set created by the bot to a specific position.
setStickerSetThumbnail(String name, int userId, String format, {InputFile? thumbnail}) Future<bool>
Sets the thumbnail of a regular or mask sticker set.
setStickerSetTitle(String name, String title) Future<bool>
Sets the title of a created sticker set.
setUserEmojiStatus(int userId, {String? emojiStatusCustomEmojiId, int? emojiStatusExpirationDate}) Future<bool>
Changes the emoji status for a given user.
setWebhook(String url, {InputFile? certificate, String? ipAddress, int? maxConnections, List<UpdateType>? allowedUpdates, bool? dropPendingUpdates, String? secretToken}) Future<bool>
Sets a webhook to receive incoming updates via an outgoing webhook.
stopInlineMessageLiveLocation(String inlineMessageId, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<bool>
Stops updating a live location inline message.
stopMessageLiveLocation(ID chatId, int messageId, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<Message>
Stops updating a live location message.
stopPoll(ID chatId, int messageId, {String? businessConnectionId, InlineKeyboardMarkup? replyMarkup}) Future<Poll>
Stops a poll which was sent by the bot.
toString() String
A string representation of this object.
inherited
transferBusinessAccountStars(String businessConnectionId, int starCount) Future<bool>
Transfers Telegram Stars from the business account balance to the bot's balance.
transferGift(String businessConnectionId, String ownedGiftId, int newOwnerChatId, {int? starCount}) Future<bool>
Transfers an owned unique gift to another user.
unbanChatMember(ID chatId, int userId, {bool? onlyIfBanned}) Future<bool>
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. Returns True on success.
unbanChatSenderChat(ID chatId, int senderChatId) Future<bool>
Use this method to unban a previously banned channel chat in a supergroup or a channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
unhideGeneralForumTopic(ID chatId) Future<bool>
Use this method to unhide the 'General' topic in a forum supergroup chat.
unpinAllChatMessages(ID chatId) Future<bool>
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. Returns True on success.
unpinAllForumTopicMessages(ID chatId, int messageThreadId) Future<bool>
Use this method to clear the list of pinned messages in a forum topic.
unpinAllGeneralForumTopicMessages(ID chatId) Future<bool>
Clears the list of pinned messages in a General forum topic.
unpinChatMessage(ID chatId, int messageId, {String? businessConnectionId}) Future<bool>
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. Returns True on success.
upgradeGift(String businessConnectionId, String ownedGiftId, {bool? keepOriginalDetails, int? starCount}) Future<bool>
Upgrades a given regular gift to a unique gift.
uploadStickerFile(int userId, InputFile sticker, String stickerFormat) Future<File>
Uploads a file with a sticker for later use in sticker set methods.
use(Transformer transformer) → void
Adds a transformer to the request chain.
verifyChat(ID chatId, {String? customDescription}) Future<bool>
Verifies a chat on behalf of the organization which is represented by the bot.
verifyUser(int userId, {String? customDescription}) Future<bool>
Verifies a user on behalf of the organization which is represented by the bot.

Operators

operator ==(Object other) bool
The equality operator.
inherited