Available Types#

This page is about Pyrogram Types. All types listed here are available through the pyrogram.types package. Unless required as argument to a client method, most of the types don’t need to be manually instantiated because they are only returned by other methods. You also don’t need to import them, unless you want to type-hint your variables.

from pyrogram.types import User, Message, ...

Note

Optional fields always exist inside the object, but they could be empty and contain the value of None. Empty fields aren’t shown when, for example, using print(message) and this means that hasattr(message, "photo") always returns True.

To tell whether a field is set or not, do a simple boolean check: if message.photo: ....


Messages & Media#

Message

A message.

MessageEntity

One special entity in a text message.

TextQuote

This object contains information about the quoted part of a message that is replied to by the given message.

ExternalReplyInfo

This object contains information about a message that is being replied to, which may come from another chat or forum topic.

ReplyParameters

Describes reply parameters for the message that is being sent.

MessageOrigin

This object describes the origin of a message.

MessageOriginUser

The message was originally sent by a known user.

MessageOriginHiddenUser

The message was originally sent by an unknown user.

MessageOriginChat

The message was originally sent on behalf of a chat to a group chat.

MessageOriginChannel

The message was originally sent to a channel chat.

MessageImportInfo

Contains information about a message created with importMessages.

Photo

A Photo.

Animation

An animation file (GIF or H.264/MPEG-4 AVC video without sound).

Audio

An audio file to be treated as music by the Telegram clients.

Document

A generic file (as opposed to photos, voice messages, audio files, ...).

Story

This object represents a story.

Video

A video file.

VideoNote

A video note.

Voice

A voice note.

PaidMediaInfo

Describes the paid media added to a message.

PaidMedia

This object describes paid media.

PaidMediaPreview

The paid media isn't available before the payment.

PaidMediaPhoto

The paid media is a photo.

PaidMediaVideo

The paid media is a video.

Contact

A phone contact.

Dice

A dice with a random value from 1 to 6 for currently supported base emoji.

PollOption

Contains information about one answer option in a poll.

InputPollOption

This object contains information about one answer option in a poll to send.

Poll

A Poll.

Location

A point on the map.

Venue

A venue.

WebAppData

Contains data sent from a Web App to the bot.

MessageAutoDeleteTimerChanged

This object represents a service message about a change in auto-delete timer settings.

ChatBoostAdded

This object represents a service message about a user boosting a chat.

ChatBackground

Describes a background set for a specific chat.

Game

A game.

GiftCode

Contains gift code data.

GiftedPremium

Telegram Premium was gifted to the user

GiftedStars

Telegram Stars were gifted to a user

Giveaway

This object represents a message about a scheduled giveaway.

GiveawayCreated

This object represents a service message about the creation of a scheduled giveaway.

GiveawayCompleted

This object represents a service message about the completion of a giveaway without public winners.

GiveawayWinners

This object represents a message about the completion of a giveaway with public winners.

MessageEffect

Contains information about an effect added to a message.

MessageReactionCountUpdated

Reactions to a message with anonymous reactions were changed.

MessageReactionUpdated

This object represents a change of a reaction on a message performed by a user.

MessageReactions

Contains information about a message reactions.

Reaction

Contains information about a reaction.

ReactionCount

Represents a reaction added to a message along with the number of times it was added.

ReactionType

This object describes the type of a reaction.

ReactionTypeEmoji

The reaction is based on an emoji.

ReactionTypeCustomEmoji

The reaction is based on a custom emoji.

ReactionTypePaid

The paid reaction in a channel chat.

Thumbnail

One size of a photo or a file/sticker thumbnail.

TranslatedText

A translated text with entities.

StrippedThumbnail

A stripped thumbnail

SponsoredMessage

Describes a sponsored message.

Sticker

A sticker.

WebPage

A webpage preview

ContactRegistered

A service message that a contact has registered with Telegram.

ScreenshotTaken

A service message that a screenshot of a message in the chat has been taken.

DraftMessage

Contains information about a message draft.

Users & Chats#

Birthdate

Parameters:
  • day (int) -- Day of the user's birth; 1-31

User

A Telegram user or bot.

Chat

A chat.

Username

Describes usernames assigned to a user, a supergroup, or a channel.

ChatShared

This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.

UsersShared

This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.

ChatAdminWithInviteLinks

Represents a chat administrator that has created invite links in a chat.

ChatColor

Accent or profile color status.

ChatEvent

A chat event from the recent actions log (also known as admin log).

ChatEventFilter

Set of filters used to obtain a chat event log.

ChatInviteLink

An invite link for a chat.

ChatJoiner

Contains information about a joiner member of a chat.

ChatJoinRequest

Represents a join request sent to a chat.

ChatMember

Contains information about one member of a chat.

ChatMemberUpdated

Represents changes in the status of a chat member.

ChatPermissions

Describes actions that a non-administrator user is allowed to take in a chat.

ChatPhoto

A chat photo.

ChatPrivileges

Describes privileged actions an administrator is able to take in a chat.

ChatReactions

A chat reactions

VideoChatScheduled

A service message about a voice chat scheduled in the chat.

VideoChatStarted

A service message about a voice chat started in the chat.

VideoChatEnded

A service message about a voice chat ended in the chat.

VideoChatParticipantsInvited

A service message about new members invited to a voice chat.

Dialog

A user's dialog.

EmojiStatus

A user emoji status.

GroupCallParticipant

Represents a group call participant

InviteLinkImporter

The date and user of when someone has joined with an invite link.

Restriction

A restriction applied to bots or chats.

RtmpUrl

Represents an RTMP URL and stream key to be used in streaming software.

Bot keyboards#

CallbackGame

Placeholder, currently holds no information.

CallbackQuery

An incoming callback query from a callback button in an inline keyboard.

ForceReply

Object used to force clients to show a reply interface.

GameHighScore

One row of the high scores table for a game.

InlineKeyboardButton

One button of an inline keyboard.

InlineKeyboardMarkup

An inline keyboard that appears right next to the message it belongs to.

KeyboardButton

One button of the reply keyboard.

KeyboardButtonPollType

This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

KeyboardButtonPollTypeRegular

KeyboardButtonPollTypeQuiz

KeyboardButtonRequestChat

This object defines the criteria used to request a suitable chat.

KeyboardButtonRequestUsers

This object defines the criteria used to request suitable users.

ReplyKeyboardMarkup

A custom keyboard with reply options.

ReplyKeyboardRemove

Object used to tell clients to remove a bot keyboard.

LoginUrl

Represents a parameter of the inline keyboard button used to automatically authorize a user.

WebAppInfo

Contains information about a Web App.

MenuButton

Describes the bot's menu button in a private chat.

MenuButtonCommands

A menu button, which opens the bot's list of commands.

MenuButtonWebApp

A menu button, which launches a Web App.

MenuButtonDefault

Describes that no specific value for the menu button was set.

SentWebAppMessage

Contains information about an inline message sent by a Web App on behalf of a user.

SwitchInlineQueryChosenChat

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

Bot commands#

BotCommand

A bot command with the standard slash "/" prefix.

BotCommandScope

Represents the scope to which bot commands are applied.

BotCommandScopeAllChatAdministrators

Represents the scope of bot commands, covering all group and supergroup chat administrators.

BotCommandScopeAllGroupChats

Represents the scope of bot commands, covering all group and supergroup chats.

BotCommandScopeAllPrivateChats

Represents the scope of bot commands, covering all private chats.

BotCommandScopeChat

Represents the scope of bot commands, covering a specific chat.

BotCommandScopeChatAdministrators

Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

BotCommandScopeChatMember

Represents the scope of bot commands, covering a specific member of a group or supergroup chat.

BotCommandScopeDefault

Represents the default scope of bot commands.

Chat Forum Topics#

ForumTopic

This object represents a forum topic.

ForumTopicCreated

This object represents a service message about a new forum topic created in the chat.

ForumTopicClosed

This object represents a service message about a forum topic closed in the chat.

ForumTopicEdited

This object represents a service message about an edited forum topic.

ForumTopicReopened

This object represents a service message about a forum topic reopened in the chat.

GeneralForumTopicHidden

This object represents a service message about General forum topic hidden in the chat.

GeneralForumTopicUnhidden

This object represents a service message about General forum topic unhidden in the chat.

Input Media#

InputMedia

Content of a media message to be sent.

InputMediaPhoto

A photo to be sent inside an album.

InputMediaVideo

A video to be sent inside an album.

InputMediaAudio

An audio to be sent inside an album.

InputMediaAnimation

An animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent inside an album.

InputMediaDocument

A generic file to be sent inside an album.

InputPhoneContact

A Phone Contact to be added in your Telegram address book.

LinkPreviewOptions

Describes the options used for link preview generation.

Input Paid Media#

InputPaidMedia

This object describes the paid media to be sent.

InputPaidMediaPhoto

The paid media to send is a photo.

InputPaidMediaVideo

The paid media to send is a video.

Inline Mode#

ChosenInlineResult

A result of an inline query chosen by the user and sent to their chat partner.

InlineQuery

An incoming inline query.

InlineQueryResult

One result of an inline query.

InlineQueryResultCachedAnimation

A link to an animation file stored on the Telegram servers.

InlineQueryResultCachedAudio

A link to an MP3 audio file stored on the Telegram servers

InlineQueryResultCachedDocument

A link to a file stored on the Telegram servers.

InlineQueryResultCachedPhoto

A link to a photo stored on the Telegram servers.

InlineQueryResultCachedSticker

A link to a sticker stored on the Telegram servers

InlineQueryResultCachedVideo

A link to a video file stored on the Telegram servers.

InlineQueryResultCachedVoice

A link to a voice message stored on the Telegram servers.

InlineQueryResultAnimation

Link to an animated GIF file.

InlineQueryResultAudio

Link to an audio file.

InlineQueryResultDocument

Link to a file.

InlineQueryResultPhoto

Link to a photo.

InlineQueryResultVideo

Link to a page containing an embedded video player or a video file.

InlineQueryResultVoice

Link to a voice recording in an .OGG container encoded with OPUS.

InlineQueryResultArticle

Link to an article or web page.

InlineQueryResultContact

Contact with a phone number

InlineQueryResultLocation

A location on a map.

InlineQueryResultVenue

A venue.

InputMessageContent#

InputMessageContent

Content of a message to be sent as a result of an inline query.

InputTextMessageContent

Content of a text message to be sent as the result of an inline query.

InputLocationMessageContent

Content of a location message to be sent as the result of an inline query.

InputVenueMessageContent

Content of a venue message to be sent as the result of an inline query.

InputContactMessageContent

Content of a contact message to be sent as the result of an inline query.

InputInvoiceMessageContent

Content of an invoice message to be sent as the result of an inline query.

Authorization#

ActiveSession

Contains information about one session in a Telegram application used by the current user.

ActiveSessions

Contains a list of sessions

SentCode

Contains info on a sent confirmation code.

TermsOfService

Telegram's Terms of Service returned by sign_in().

Payments#

BusinessConnection

Describes the connection of the bot with a business account.

BusinessIntro

Parameters:
  • title (str, optional) -- Title text of the business intro

BusinessLocation

Parameters:
  • address (str) -- Address of the business

BusinessOpeningHours

Parameters:
  • time_zone_name (str) -- Unique name of the time zone for which the opening hours are defined

BusinessOpeningHoursInterval

Parameters:
  • opening_minute (int) -- The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60

CollectibleItemInfo

Contains information about a collectible item and its last purchase.

LabeledPrice

This object represents a portion of the price for goods or services.

Invoice

This object contains basic information about an invoice.

ShippingAddress

This object represents a shipping address.

OrderInfo

This object represents information about an order.

ShippingOption

This object represents one shipping option.

PaymentForm

This object contains basic information about an payment form.

SuccessfulPayment

This object contains basic information about a successful payment.

RefundedPayment

This object contains basic information about a refunded payment.

ShippingQuery

This object contains information about an incoming shipping query.

PreCheckoutQuery

This object contains information about an incoming pre-checkout query.