Available Types

This page is about Electrogram 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: ....


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().

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.

Bots

BotAllowed

Contains information about a allowed bot.

BotApp

Contains information about a bot app.

BotBusinessConnection

A bot business connection Information.

BotInfo

A bot Information.

Bot keyboards

CallbackGame

Placeholder, currently holds no information.

CallbackQuery

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

CollectibleItemInfo

Contains information about a collectible item and its last purchase.

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.

InlineKeyboardButtonBuy

One button of the inline keyboard.

InlineKeyboardMarkup

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

KeyboardButton

One button of the reply keyboard.

KeyboardButtonStyle

Button style.

LoginUrl

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

MenuButton

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

MenuButtonCommands

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

MenuButtonDefault

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

MenuButtonWebApp

A menu button, which launches a Web App.

ReplyKeyboardMarkup

A custom keyboard with reply options.

ReplyKeyboardRemove

Object used to tell clients to remove a bot keyboard.

RequestPeerTypeChannel

Object used to request clients to send a channel identifier.

RequestPeerTypeChat

Object used to request clients to send a chat identifier.

RequestPeerTypeUser

Object used to request clients to send a user identifier.

RequestedChat

Contains information about a requested chat.

RequestedChats

Contains information about a requested chats.

RequestedUser

Contains information about a requested user.

SentWebAppMessage

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

WebAppInfo

Contains information about a Web App.

Telegram Business

ExtendedMediaPreview

A ExtendedMediaPreview.

InputStarsTransaction

Content of a stars transaction.

Invoice

This object contains basic information about an invoice.

PaidMedia

A PaidMedia.

PaidMediaPreview

The paid media isn't available before the payment.

PaymentInfo

Contains information about a payment.

PaymentRefunded

Contains information about a refunded payment.

PreCheckoutQuery

An incoming pre-checkout query from a buy button in an inline keyboard.

ShippingAddress

Contains information about a shipping address.

ShippingOption

This object represents one shipping option.

ShippingQuery

This object contains information about an incoming shipping query.

StarsAmount

A stars amount.

StarsStatus

Contains information about stars status.

StarsTransaction

Contains information about stars transaction.

SuccessfulPayment

Contains information about a successful payment.

SuggestedPost

A suggested post.

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.

InlineQueryResultAnimation

Link to an animated GIF file.

InlineQueryResultArticle

Link to an article or web page.

InlineQueryResultAudio

Link to an audio file.

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.

InlineQueryResultContact

Contact with a phone number

InlineQueryResultDocument

Link to a file.

InlineQueryResultLocation

A location on a map.

InlineQueryResultPhoto

Link to a photo.

InlineQueryResultVenue

A venue.

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.

Input Media

InputMedia

Content of a media message to be sent.

InputMediaAnimation

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

InputMediaAudio

An audio to be sent inside an album.

InputMediaDocument

A generic file to be sent inside an album.

InputMediaPhoto

A photo to be sent inside an album.

InputMediaVideo

A video to be sent inside an album.

InputPhoneContact

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

Input Message Content

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.

InputLocationMessageContent

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

InputMessageContent

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

InputReplyToMessage

Contains information about a target replied message.

InputReplyToStory

Contains information about a target replied story.

InputTextMessageContent

Content of a text 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.

Input Privacy Rule

InputPrivacyRule

Content of a privacy rule.

InputPrivacyRuleAllowAll

Allow all users.

InputPrivacyRuleAllowChats

Allow only participants of certain chats.

InputPrivacyRuleAllowContacts

Allow contacts only.

InputPrivacyRuleAllowPremium

Allow only users with a Premium subscription, currently only usable for CHAT_INVITE.

InputPrivacyRuleAllowUsers

Allow only participants of certain users.

InputPrivacyRuleDisallowAll

Disallow all users.

InputPrivacyRuleDisallowChats

Disallow only participants of certain chats.

InputPrivacyRuleDisallowContacts

Disallow contacts only.

InputPrivacyRuleDisallowUsers

Disallow only participants of certain users.

Messages & Media

AlternativeVideo

Describes an alternative reencoded quality of a video file.

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.

AvailableEffect

Contains information about available effect.

Contact

A phone contact.

ContactRegistered

A service message that a contact has registered with Telegram.

Dice

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

Document

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

DraftMessage

Contains information about a message draft.

ExportedStoryLink

Contains information about a story viewers.

FactCheck

A fact-check.

Game

A game.

GiftedPremium

Telegram Premium was gifted to the user

Giveaway

A giveaway.

GiveawayLaunched

A service message about a giveaway started in the channel.

GiveawayResult

A giveaway result.

LabeledPrice

This object represents a price for goods or services.

Location

A point on the map.

Message

A message.

MessageEntity

One special entity in a text 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.

MessageReactor

Contains information about a message reactor.

MessageStory

Contains information about a forwarded story.

PaymentForm

This object contains basic information about an payment form.

Photo

A Photo.

Poll

A Poll.

PollOption

Contains information about one answer option in a poll.

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.

ReactionTypeCustomEmoji

The reaction is based on a custom emoji.

ReactionTypeEmoji

The reaction is based on an emoji.

ReactionTypePaid

The paid reaction in a channel chat.

ScreenshotTaken

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

Sticker

A sticker.

StickerSet

A stickerset.

Str

StrippedThumbnail

A stripped thumbnail

Thumbnail

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

TranslatedText

A translated text with entities.

Venue

A venue.

Video

A video file.

VideoNote

A video note.

Voice

A voice note.

WebAppData

Contains data sent from a Web App to the bot.

WebPage

A webpage preview

WebPageEmpty

A webpage preview

WebPagePreview

A web page preview.

Payments

Gift

Describes a gift that can be sent to another user.

UserGift

Represents a gift received by a user.

Stories

InputMediaArea

Content of a media area to be included in story.

InputMediaAreaChannelPost

A channel post media area.

MediaArea

Content of a media areas in story.

MediaAreaChannelPost

A channel post media area.

MediaAreaCoordinates

A coordinates of media area.

StoriesPrivacyRules

A story privacy.

Story

A story.

StoryDeleted

A deleted story.

StoryForwardHeader

Contains information about origin of forwarded story.

StorySkipped

A skipped story.

StoryViews

Contains information about a story viewers.

Users & Chats

Birthday

User Date of birth.

BusinessInfo

Business information of a user.

BusinessMessage

Business working hours.

BusinessRecipients

Business recipients.

BusinessWeeklyOpen

Business weekly open hours.

BusinessWorkingHours

Business working hours.

Chat

A chat.

ChatAdminWithInviteLinks

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

ChatColor

Reply 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.

ChatJoinRequest

Represents a join request sent to a chat.

ChatJoinedByRequest

A service message about a user join request approved in the chat.

ChatJoiner

Contains information about a joiner member of 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.

ChatPreview

A chat preview.

ChatPrivileges

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

ChatReactions

A chat reactions

Dialog

A user's dialog.

EmojiStatus

A user emoji status.

Folder

A user's folder.

ForumTopic

A forum topic.

ForumTopicClosed

A service message about a forum topic closed in the chat.

ForumTopicCreated

A service message about a new forum topic created in the chat.

ForumTopicEdited

A service message about a forum topic renamed in the chat.

ForumTopicReopened

A service message about a forum topic reopened in the chat.

FoundContacts

Chats found by name substring and auxiliary data.

GeneralTopicHidden

A service message about a general topic hidden in the chat.

GeneralTopicUnhidden

A service message about a general topic unhidden in the chat.

InviteLinkImporter

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

Link

PeerChannel

A PeerChannel.

PeerUser

A PeerUser.

PrivacyRule

A privacy rule.

Restriction

A restriction applied to bots or chats.

User

A Telegram user or bot.

Username

A Username.

VideoChatEnded

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

VideoChatMembersInvited

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

VideoChatScheduled

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

VideoChatStarted

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