### Bot Links with Start Parameter Source: https://core.telegram.org/api/links Use these links to direct users to a bot with an optional start parameter. This can trigger a 'Start' button with the specified parameter. ```t.me t.me/?start= ``` ```tg: tg://resolve?domain=&start= ``` -------------------------------- ### Install Theme Source: https://core.telegram.org/api/themes Call account.installTheme to signal to the server that a client has applied a theme. ```TL account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; ``` -------------------------------- ### Install Sticker Set Source: https://core.telegram.org/api/stickers Installs a sticker set using `messages.installStickerSet`. Set `archived=false` for normal installation. The result indicates success or if older sets were archived. ```TL messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; ``` -------------------------------- ### Example Passport Authorization URI Source: https://core.telegram.org/api/passport A comprehensive example of a `tg://resolve` URI with all parameters, including `domain`, `bot_id`, `scope`, `public_key`, `nonce`, `callback_url`, and `payload`. ```uri tg://resolve?domain=telegrampassport&bot_id=543260180&scope=%7B%22v%22%3A1%2C%22d%22%3A%5B%7B%22_%22%3A%22pd%22%2C%22n%22%3A1%7D%2C%22ad%22%2C%22pn%22%2C%22em%22%2C%7B%22_%22%3A%5B%7B%22_%22%3A%22pp%22%2C%22s%22%3A1%2C%22t%22%3A1%7D%2C%22ip%22%2C%22dl%22%2C%22ic%22%5D%7D%2C%7B%22_%22%3A%5B%22ub%22%2C%22bs%22%2C%22ra%22%2C%22pr%22%2C%22tr%22%5D%7D%5D%7D&public_key=-----BEGIN%20PUBLIC%20KEY-----%0AMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv6m1zBF8lZOCqcxf8hnj%0AkvHwuWdU8s4rBWaxKXH%2FvDDUklcCS5uhSnmjhxWca9suubaG3lW4HxlCilkeJPVf%0Ajimg5Q8ZqWrR3OoOihEpcG9iJZTOEpsEk7VtEiabgacBG3Quv9JslTrDe95Fn801%0At9d21HXwgMrHeHpWDOn31Dr%2BwoEH%2BkwySUWa6L%2FZbnGwSNP7eeDTE7Amz1RMDk3t%0A8EWGq58u0IQatPcEH09aUQlKzk6MIiALkZ9ILBKCBk6d2WCokKnsdBctovNbxwSx%0AhP1qst1r%2BYc8iPBZozsDC0ZsC5jXCkcODI3OC0tkNtYzN2XKalW5R0DjDRUDmGhT%0AzQIDAQAB%0A-----END%20PUBLIC%20KEY-----%0A&nonce=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e&callback_url=https%3A%2F%2Fcore.telegram.org%2Fpassport%2Fexample%3Fpassport_ssid%3Db8e892dc2e0afe63424d101b964f1256_32858210_db259b427f200751ce&payload=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e ``` -------------------------------- ### accelerometer_started Source: https://core.telegram.org/api/bots/webapps Sent by the client in response to a successful start of accelerometer tracking. ```APIDOC ## `accelerometer_started` ### Description This event is sent by the client in response to a `web_app_start_accelerometer` event if accelerometer tracking is started successfully. Until `web_app_stop_accelerometer` is emitted, the client will also emit `accelerometer_changed` events. ### Parameters `null`. ``` -------------------------------- ### Theme Management Functions Source: https://core.telegram.org/api/themes Provides functions for saving, installing, and retrieving themes. ```TL ---functions--- account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; account.getTheme#3a5869ec format:string theme:InputTheme = Theme; account.getThemes#7206e458 format:string hash:long = account.Themes; ``` -------------------------------- ### Get Multiple Wallpapers Source: https://core.telegram.org/api/wallpapers Use `account.getMultiWallPapers` to retrieve multiple wallpapers by passing a vector of `InputWallPaper` constructors. ```TL account.getMultiWallPapers#65ad71dc wallpapers:Vector = Vector; ``` -------------------------------- ### Get All Stickers Source: https://core.telegram.org/api/stickers Fetches all installed and non-archived sticker sets. ```APIDOC ## POST /messages.getAllStickers ### Description Fetches all installed and non-archived sticker sets. ### Method POST ### Endpoint /messages.getAllStickers ### Parameters #### Request Body - **hash** (long) - Required - Hash of the sticker sets list, used for caching. ### Response #### Success Response (200) - **type** (messages.AllStickers) - Contains the sticker sets. Can be: - messages.allStickersNotModified: If the sticker sets have not changed since the last request. - messages.allStickers: Contains a `hash` and a list of `sets` (StickerSet objects). ``` -------------------------------- ### Sign In Method Source: https://core.telegram.org/api/config Initiates the sign-in process. If a user is signing up for the first time, the `auth.authorizationSignUpRequired` constructor, containing `help.termsOfService`, may be returned. ```TL Schema auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization; ``` -------------------------------- ### Get Mask Stickers Source: https://core.telegram.org/api/stickers Fetches all installed and non-archived mask sticker sets. ```APIDOC ## POST /messages.getMaskStickers ### Description Fetches all installed and non-archived mask sticker sets. ### Method POST ### Endpoint /messages.getMaskStickers ### Parameters #### Request Body - **hash** (long) - Required - Hash of the mask sticker sets list, used for caching. ### Response #### Success Response (200) - **type** (messages.AllStickers) - Contains the mask sticker sets. Can be: - messages.allStickersNotModified: If the mask sticker sets have not changed since the last request. - messages.allStickers: Contains a `hash` and a list of `sets` (StickerSet objects). ``` -------------------------------- ### Get Emoji Stickers Source: https://core.telegram.org/api/stickers Fetches all installed and non-archived custom emoji sticker sets. ```APIDOC ## POST /messages.getEmojiStickers ### Description Fetches all installed and non-archived custom emoji sticker sets. ### Method POST ### Endpoint /messages.getEmojiStickers ### Parameters #### Request Body - **hash** (long) - Required - Hash of the emoji sticker sets list, used for caching. ### Response #### Success Response (200) - **type** (messages.AllStickers) - Contains the emoji sticker sets. Can be: - messages.allStickersNotModified: If the emoji sticker sets have not changed since the last request. - messages.allStickers: Contains a `hash` and a list of `sets` (StickerSet objects). ``` -------------------------------- ### Update Business Introduction Method Source: https://core.telegram.org/api/business Use this method to set a custom business introduction message and sticker. Invoke without the 'intro' flag to remove the custom introduction. ```TL Schema account.updateBusinessIntro#a614d034 flags:# intro:flags.0?InputBusinessIntro = Bool; ``` -------------------------------- ### Get Installed Attachment Menu Bots Source: https://core.telegram.org/api/bots/attach Fetches the list of currently installed attachment and side menu entries for bots. This is useful for refreshing the client's view after changes or on app startup. ```APIDOC ## messages.getAttachMenuBots ### Description Fetches the list of currently installed attachment/side menu entries. This method should be called to refresh the list after changes or on app startup. ### Method POST ### Endpoint /messages.getAttachMenuBots ### Parameters #### Query Parameters - **hash** (long) - Required - Hash for optimistic updates. If the list hasn't changed, the server will return `attachMenuBotsNotModified`. ### Response #### Success Response (200) - **AttachMenuBots** - Contains the list of installed bots and associated users. #### Response Example ```json { "AttachMenuBots": { "hash": 1234567890, "bots": [ { "type": "AttachMenuBot", "inactive": false, "has_settings": true, "request_write_access": false, "show_in_attach_menu": true, "show_in_side_menu": true, "side_menu_disclaimer_needed": false, "bot_id": 123456789, "short_name": "my_mini_app", "peer_types": [], "icons": [] } ], "users": [] } } ``` #### Not Modified Response (304) - **attachMenuBotsNotModified** - Indicates that the list of bots has not changed since the last fetch. ``` -------------------------------- ### Install a Wallpaper Source: https://core.telegram.org/api/wallpapers Call `account.installWallPaper` to signal to the server that a user has set a wallpaper as their default chat background. This method also automatically saves the wallpaper if it's not already in the saved list. ```TL account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; ``` -------------------------------- ### web_app_setup_main_button Source: https://core.telegram.org/api/web-events Configures the main button, located below the webview. Pressing it emits a `main_button_pressed` event. ```APIDOC ## web_app_setup_main_button ### Description Configures the main button, located immediately below the webview. When the user presses it, a `main_button_pressed` event should be emitted by the client. The button's visibility and appearance can be controlled via the payload. ### Method EMIT ### Endpoint N/A ### Parameters #### Request Body - **is_visible** (boolean) - Optional - Whether the main button is visible (false by default). - **is_active** (boolean) - Optional - Whether the main button is active (true by default). - **text** (string) - Optional - Button text. If `trim(text)` is empty, the button must be hidden. - **color** (string) - Optional - Button color in hex RGB format (defaults to the `button_color` theme parameter). - **text_color** (string) - Optional - Button text color in hex RGB format (defaults to the `button_text_color` theme parameter). - **is_progress_visible** (boolean) - Optional - Indicates whether the button should display a loading indicator (false by default). - **has_shine_effect** (boolean) - Optional - Whether the button should have a shine effect (false by default). ### Request Example ```json { "is_visible": true, "text": "Click Me", "color": "#0000FF" } ``` ### Response None ``` -------------------------------- ### Get Attachment Menu Bot Info Source: https://core.telegram.org/api/bots/attach Retrieves information about the attachment or side menu entry of a specific bot. This is useful for checking if a bot has an entry and its properties before installation or interaction. ```APIDOC ## messages.getAttachMenuBot ### Description Retrieves information about the attachment/side menu entry of a given bot. ### Method POST ### Endpoint /messages.getAttachMenuBot ### Parameters #### Path Parameters - **bot** (InputUser) - Required - The bot to get information for. ### Response #### Success Response (200) - **AttachMenuBotsBot** - Contains information about the bot's attachment menu entries. ### Response Example ```json { "AttachMenuBotsBot": { "bot": { "type": "AttachMenuBot", "inactive": false, "has_settings": true, "request_write_access": false, "show_in_attach_menu": true, "show_in_side_menu": true, "side_menu_disclaimer_needed": false, "bot_id": 123456789, "short_name": "my_mini_app", "peer_types": [], "icons": [] }, "users": [] } } ``` ``` -------------------------------- ### Create Theme Source: https://core.telegram.org/api/themes Use account.createTheme to create a new theme. A slug can be provided or autogenerated. ```TL ---functions--- account.createTheme#652e4400 flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?Vector = Theme; ``` -------------------------------- ### Get List of Attachment Menu Bots Source: https://core.telegram.org/api/bots/attach Fetches the list of currently installed attachment and side menu entries. This is typically called after receiving an `updateAttachMenuBots` update or when the user changes the app's language. ```python await client.invoke(messages.getAttachMenuBots(hash=hash_value)) ``` -------------------------------- ### Example File Reference Paths Source: https://core.telegram.org/api/file-reference-generator Illustrates various file reference paths found within the updateNewMessage constructor, showing the nested structure leading to a file reference. ```text updateNewMessage.message -> message.media -> messageMediaDocument.document -> document.file_reference updateNewMessage.message -> message.reply_to -> messageReplyHeader.reply_media -> messageMediaDocument.document -> document.file_reference updateNewMessage.message -> message.media -> messageMediaInvoice.extended_media -> messageExtendedMedia.media -> messageMediaDocument.document -> document.file_reference ... and many others ``` -------------------------------- ### Run File Reference Generator Source: https://core.telegram.org/api/file-reference-generator Clone the repository, install dependencies, and execute the generator script with the required arguments. ```bash git clone https://github.com/danog/MadelineProto.git --recursive cd MadelineProto composer update php tools/gen_filerefmap.php ``` -------------------------------- ### Theme Installation Links Source: https://core.telegram.org/api/links Links used to install custom themes in Telegram. ```text t.me/addtheme/ ``` ```text tg://addtheme?slug= ``` -------------------------------- ### Initialize Takeout Session Source: https://core.telegram.org/api/takeout Use account.initTakeoutSession to start a data export session. Set flags to specify which data types to include in the export. ```TL Schema account.takeout#4dba4501 id:long = account.Takeout; inputTakeoutFileLocation#29be5899 = InputFileLocation; ---functions--- account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout; ``` -------------------------------- ### t.me Link Syntax Examples Source: https://core.telegram.org/api/links Examples of t.me link syntax, which can be used for various Telegram functionalities. ```text t.me/path?query http://t.me/path?query https://t.me/path?query ``` -------------------------------- ### Requesting a WebView with Start Parameter and Compact Mode Source: https://core.telegram.org/api/bots/webapps For attachment menu deep links, use messages.requestWebView, providing the start_param and setting compact/fullscreen flags if the mode is set accordingly. ```python await client.send(messages.requestWebView( peer=peer, url=attachmentMenuEntry.url, start_param=attachmentMenuEntry.start_parameter, compact=True )) ``` -------------------------------- ### tg: Link Syntax Examples Source: https://core.telegram.org/api/links Examples of tg: link syntax, an alternative to t.me links for deep linking into Telegram. ```text tg:path?query tg://path?query ``` -------------------------------- ### Install Sticker Set Source: https://core.telegram.org/api/stickers Installs a sticker set. It can return a success message or indicate that older stickersets were archived to make space. ```APIDOC ## POST /messages.installStickerSet ### Description Installs a specified sticker set. If the user's sticker set limit is reached, older, unused sticker sets may be archived. ### Method POST ### Endpoint /messages.installStickerSet ### Parameters #### Request Body - **stickerset** (InputStickerSet) - Required - The sticker set to install. Can be one of: - inputStickerSetID - inputStickerSetShortName - inputStickerSetAnimatedEmoji - inputStickerSetDice - inputStickerSetAnimatedEmojiAnimations - inputStickerSetPremiumGifts - inputStickerSetEmojiGenericAnimations - inputStickerSetEmojiDefaultStatuses - inputStickerSetEmojiDefaultTopicIcons - inputStickerSetEmojiChannelDefaultStatuses - **archived** (Bool) - Required - Set to `false` to install the sticker set. ### Response #### Success Response (200) - **type** (messages.StickerSetInstallResult) - The result of the installation attempt. Can be: - messages.stickerSetInstallResultSuccess: Indicates successful installation. - messages.stickerSetInstallResultArchive: Indicates successful installation, with older sets archived. Contains a `sets` field with details of archived sets. ``` -------------------------------- ### web_app_start_accelerometer Source: https://core.telegram.org/api/web-events Starts accelerometer tracking in the mini app. Allows specifying a refresh rate. Emits `accelerometer_started` on success or `accelerometer_failed` if unsupported. ```APIDOC ## `web_app_start_accelerometer` ### Description Used by mini apps to start accelerometer tracking. The specified refresh rate may be adjusted based on platform support. Emits an `accelerometer_started` event on success, or an `accelerometer_failed` event with `error=UNSUPPORTED` on platforms without accelerometer tracking. Until `web_app_stop_accelerometer` is called, `accelerometer_changed` events will be emitted. ### Event Payload - `refresh_rate` (integer) - Optional - The refresh rate in milliseconds, ranging from 20 to 1000 (defaults to 1000). ``` -------------------------------- ### web_app_start_device_orientation Source: https://core.telegram.org/api/web-events Starts device orientation tracking. The client will emit device_orientation_changed events at most every `refresh_rate` milliseconds. Emits `device_orientation_started` on success or `device_orientation_failed` on failure. ```APIDOC ## web_app_start_device_orientation ### Description Used by mini apps to start device orientation tracking. The specified refresh rate may be ignored on platforms where it is not supported, or if it doesn't fall within the supported range. Absolute orientation data may also not be supported on some platforms, in which case relative orientation events will be sent, instead. Emits a `device_orientation_started` event on success, or a `device_orientation_failed` event with `error=UNSUPPORTED` on platforms with no device orientation tracking. ### Method Not applicable (event-driven) ### Parameters #### Request Body - **refresh_rate** (integer) - Optional - An integer indicating the refresh rate in milliseconds, ranging from 20 to 1000 (defaults to 1000). - **need_absolute** (boolean) - Optional - Indicates whether the app is requesting to receive absolute orientation data, allowing it to determine the device's attitude relative to magnetic north (defaults to `false`). ### Response Emits `device_orientation_started` on success or `device_orientation_failed` on failure. ``` -------------------------------- ### SVG Path Example Source: https://core.telegram.org/api/files An example of an SVG structure with a path element, where the 'd' attribute can be populated with the generated SVG path from the 'bytes' payload of a photoPathSize. ```XML ``` -------------------------------- ### help.promoData Structure for Custom Suggestions Source: https://core.telegram.org/api/config Defines the structure of help.promoData including custom suggestions. Used when help.getPromoData returns custom suggestions. ```TL Schema help.promoData#8a4d87a flags:# proxy:flags.0?true expires:int peer:flags.3?Peer psa_type:flags.1?string psa_message:flags.2?string pending_suggestions:Vector dismissed_suggestions:Vector custom_pending_suggestion:flags.4?PendingSuggestion chats:Vector users:Vector = help.PromoData; pendingSuggestion#e7e82e12 suggestion:string title:TextWithEntities description:TextWithEntities url:string = PendingSuggestion; ---functions--- help.getPromoData#c0977421 = help.PromoData; help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool; ``` -------------------------------- ### Dice Emoji Success Configuration Example Source: https://core.telegram.org/api/dice Example JSON structure for dice emoji success parameters, specifying maximum value and fireworks frame. ```JSON { "emojies_send_dice_success": { "\ud83c\udfaf": { "value": 6, "frame_start": 62 }, "\ud83c\udfc0": { "value": 5, "frame_start": 110 } } } ``` -------------------------------- ### Get Paid Reaction Privacy Source: https://core.telegram.org/api/reactions Fetches the current default reaction privacy settings. This method should be invoked on startup to get the latest privacy settings. ```TL messages.getPaidReactionPrivacy#472455aa = Updates; ``` -------------------------------- ### account.installTheme Source: https://core.telegram.org/api/themes Signals to the server that a client has applied a theme. This method is called when a client applies a theme. ```APIDOC ## account.installTheme ### Description Signals to the server that a client has applied a theme. This method is called when a client applies a theme. ### Method `POST` ### Endpoint `/account.installTheme` ### Parameters #### Query Parameters - **dark** (boolean) - Optional - If true, installs the dark version of the theme. - **theme** (InputTheme) - Required - The theme to install. Can be `inputTheme` or `inputThemeSlug`. - **format** (string) - Required - Indicates the theme format supported by the client. - **base_theme** (BaseTheme) - Optional - The base theme to use if the provided theme is not fully specified. ### Request Example ```json { "theme": { "_type": "inputThemeSlug", "slug": "my_theme_slug" }, "format": "my_theming_engine_v1", "dark": true } ``` ### Response #### Success Response (200) - **bool** (boolean) - Returns true if the theme was successfully installed. ``` -------------------------------- ### Main Mini App tg: Syntax Source: https://core.telegram.org/api/links Use this syntax to open a bot's Main Mini App via tg: links. This is an alternative to the t.me syntax. ```URL tg://resolve?domain=&startapp&mode= ``` ```URL tg://resolve?domain=&startapp=&mode= ``` -------------------------------- ### Get Stars Transactions Source: https://core.telegram.org/api/subscriptions Fetches transactions related to Stars, either for a specific subscription or general inbound/outbound transactions. Populate `subscription_id` to get transactions for a particular subscription. ```APIDOC ## GET payments.getStarsTransactions ### Description Fetches Stars transactions, optionally filtered by subscription ID. ### Method GET ### Endpoint /payments.getStarsTransactions ### Parameters #### Query Parameters - **subscription_id** (string) - Optional - The ID of the subscription for which to fetch transactions. - **peer** (InputPeer) - Required - The peer associated with the transactions. - **offset** (string) - Optional - Offset for pagination. - **limit** (int) - Optional - Maximum number of transactions to return. - **inbound** (boolean) - Optional - If set, only inbound transactions are returned. - **outbound** (boolean) - Optional - If set, only outbound transactions are returned. - **ascending** (boolean) - Optional - If set, transactions are returned in ascending order. - **ton** (boolean) - Optional - If set, TON-related transactions are included. ``` -------------------------------- ### Requesting a Simple WebView Source: https://core.telegram.org/api/bots/webapps Use this function to open a Keyboard Button Mini App. Pass the button's URL to the `url` parameter. Ensure `from_switch_webview` or `from_side_menu` is set appropriately. ```mtproto messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true fullscreen:flags.8?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; ``` -------------------------------- ### web_app_ready Source: https://core.telegram.org/api/web-events Signals that mini apps are fully loaded. Clients should remove the loading spinner placeholder upon receiving this event. ```APIDOC ## web_app_ready ### Description No event payload. Emitted by mini apps when they are fully loaded, signaling to client apps that the loading spinner placeholder can be removed. Note that there is no guarantee that this event will be emitted when the mini app is fully loaded: clients should remove the loading spinner upon receiving this event or when the page finishes loading (native webview/iframe event), whichever event comes first. ### Method EMIT ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### Get Story Views Info Source: https://core.telegram.org/api/stories Use stories.getStoriesViews to get view count, forward count, reactions, and recent viewers for one or more stories. This method is unpaginated and may return less information than stories.getStoryViewsList. ```TLSchema stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; ``` -------------------------------- ### Get Premium Gift Code Options Source: https://core.telegram.org/api/giveaways Retrieves available options for Telegram Premium gift code giveaways. Use this to get a list of possible giveaway configurations, including the number of subscriptions and their duration. ```python from_id = 0 boost_peer = None # If the giveaway is for a specific chat, specify its InputPeer here # boost_peer = types.InputPeerChat(chat_id=chat_id) # If the giveaway is for a specific user, specify their InputPeer here # boost_peer = types.InputPeerUser(user_id=user_id) # If the giveaway is for a specific channel, specify its InputPeer here # boost_peer = types.InputPeerChannel(channel_id=channel_id) # If boost_peer is not specified, it defaults to the current chat result = client(payments.getPremiumGiftCodeOptionsRequest( boost_peer=boost_peer )) for option in result: print(f"Option ID: {option.id}, Months: {option.months}, Amount: {option.amount} {option.currency}") ``` -------------------------------- ### help.getAppConfig Source: https://core.telegram.org/api/folders Fetches app-specific configuration parameters, which may include settings related to folder tooltips. ```APIDOC ## help.getAppConfig ### Description Fetches app-specific configuration parameters. ### Method GET ### Endpoint /help.getAppConfig ### Parameters #### Query Parameters - **hash** (int) - Required - Hash of the current app configuration. ### Response #### Success Response (200) - **dialog_filters_tooltip** (boolean) - Determines whether a folder tooltip should be presented to the user. ### Response Example ```json { "dialog_filters_tooltip": true } ``` ``` -------------------------------- ### web_app_setup_closing_behavior Source: https://core.telegram.org/api/web-events Configures the client's behavior when the webview is about to be closed. If `need_confirmation` is true, a confirmation popup will be shown. ```APIDOC ## web_app_setup_closing_behavior ### Description Configures the client's behavior when the webview is about to be closed. If `need_confirmation` is true, a confirmation popup will be shown to avoid accidentally aborting a sensitive operation. ### Event Data a JSON object with a boolean `need_confirmation`. ``` -------------------------------- ### Setting Video Start Timestamp Source: https://core.telegram.org/api/files The starting playback timestamp for videos can be set using the `video_timestamp` field across multiple methods. This allows videos to begin playing from a specific point. The set timestamp will be reflected in the `messageMediaDocument.video_timestamp` field. ```APIDOC ## Setting Video Start Timestamp ### Description This section details how to specify a starting timestamp for video playback using various input methods and how this is reflected in the message media. ### Methods - **inputMediaUploadedDocument** - `video_timestamp` (flags.7?int) - Optional - The timestamp (in seconds) from which the video should start playing. - **inputMediaDocumentExternal** - `video_timestamp` (flags.3?int) - Optional - The timestamp (in seconds) from which the video should start playing. - **inputMediaDocument** - `video_timestamp` (flags.4?int) - Optional - The timestamp (in seconds) from which the video should start playing. - **messages.forwardMessages** - `video_timestamp` (flags.20?int) - Optional - The timestamp (in seconds) from which the video should start playing when forwarded. ### Response #### Success Response (MessageMedia) - **messageMediaDocument** - `video_timestamp` (int) - The timestamp (in seconds) from which the video will start playing, if specified. ``` -------------------------------- ### account.installWallPaper Source: https://core.telegram.org/api/wallpapers Signals to the server that a wallpaper has been installed as the default chat background. This method also automatically saves the wallpaper if it's not already in the saved list. ```APIDOC ## account.installWallPaper ### Description Signals to the server that a wallpaper has been installed as the default chat background. This method also automatically saves the wallpaper if it's not already in the saved list. ### Method account.installWallPaper ### Parameters #### Path Parameters - **wallpaper** (InputWallPaper) - Required - The constructor specifying which wallpaper to install. - **settings** (WallPaperSettings) - Required - Settings for the wallpaper, such as blur or motion effects. ``` -------------------------------- ### bots.getAdminedBots Source: https://core.telegram.org/api/layers Get a list of bots owned by the current user. ```APIDOC ## bots.getAdminedBots ### Description Get a list of bots owned by the current user. ### Method (Not specified, assumed to be GET or POST based on context) ### Endpoint (Not specified) ### Parameters (No parameters specified) ### Response (Response structure not specified) ``` -------------------------------- ### InputWebFileLocation Constructors Source: https://core.telegram.org/api/files Different ways to specify the location of a web file for download. ```TL Schema inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; inputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document:flags.0?InputDocument title:flags.1?string performer:flags.1?string = InputWebFileLocation; ``` -------------------------------- ### Get Application Configuration Method Source: https://core.telegram.org/api/config Retrieves client-specific configuration parameters. Use a hash of 0 for the initial call and the returned hash for subsequent calls to check for updates. ```TL ---functions--- help.getAppConfig#61e3f854 hash:int = help.AppConfig; ``` -------------------------------- ### StickerSetInstallResult Types Source: https://core.telegram.org/api/stickers Defines the possible results when installing a sticker set. ```TL messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; messages.stickerSetInstallResultArchive#35e410a8 sets:Vector = messages.StickerSetInstallResult; ``` -------------------------------- ### messages.getSavedDialogs (with parent_peer) Source: https://core.telegram.org/api/layers Get saved dialogs, with the addition of the parent_peer parameter. ```APIDOC ## messages.getSavedDialogs ### Description Get saved dialogs, with the addition of the parent_peer parameter. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **parent_peer** (Not specified) - Required/Optional - Description for parent_peer parameter ### Request Example (None specified) ### Response #### Success Response (200) (None specified) #### Response Example (None specified) ``` -------------------------------- ### web_app_setup_settings_button Source: https://core.telegram.org/api/web-events Determines whether to show or hide the settings button. Pressing it emits a `settings_button_pressed` event. ```APIDOC ## web_app_setup_settings_button ### Description Determines whether to show or hide the settings button. When the user presses it, a `settings_button_pressed` event should be emitted by the client. ### Method EMIT ### Endpoint N/A ### Parameters #### Request Body - **is_visible** (boolean) - Required - Determines whether to show or hide the settings button. ### Request Example ```json { "is_visible": true } ``` ### Response None ``` -------------------------------- ### messages.getUnreadReactions (with saved_peer_id) Source: https://core.telegram.org/api/layers Get unread reactions, with the addition of the saved_peer_id parameter. ```APIDOC ## messages.getUnreadReactions ### Description Get unread reactions, with the addition of the saved_peer_id parameter. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **saved_peer_id** (Not specified) - Required/Optional - Description for saved_peer_id parameter ### Request Example (None specified) ### Response #### Success Response (200) (None specified) #### Response Example (None specified) ``` -------------------------------- ### bots.getPreviewMedias Source: https://core.telegram.org/api/bots/webapps Fetches and downloads localized preview media for a bot's mini app. Clients should invoke this method when a user opens the bot's profile page to display app examples. ```APIDOC ## bots.getPreviewMedias ### Description Fetches and downloads localized preview media for a bot's mini app. Clients should invoke this method when a user opens the bot's profile page to display app examples. ### Method GET ### Endpoint /bots.getPreviewMedias ### Parameters #### Query Parameters - **bot** (InputUser) - Required - The bot for which to fetch preview media. ### Response #### Success Response (200) - **Vector** - A list of preview media objects. ### Response Example { "example": "[Array of BotPreviewMedia objects]" } ``` -------------------------------- ### Image and Pattern Wallpaper Constructor Source: https://core.telegram.org/api/wallpapers Defines the structure for image and pattern wallpapers, including ID, flags, creator, access hash, document, and settings. ```TL Schema wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; ``` -------------------------------- ### Get Pinned Saved Dialogs Source: https://core.telegram.org/api/saved-messages Retrieves only the pinned saved dialogs. ```python pinned_dialogs = client.invoke(messages.GetPinnedSavedDialogsRequest()) ``` -------------------------------- ### Get Preview Medias Function Source: https://core.telegram.org/api/bots/webapps Fetches the preview medias for a given bot. Clients should use this to display localized previews. ```TL Schema bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; ``` -------------------------------- ### accelerometer_changed Source: https://core.telegram.org/api/bots/webapps Sent periodically by the client with accelerometer readings after tracking has started and before it stops. ```APIDOC ## `accelerometer_changed` ### Description This event is sent periodically by the client at most every `refresh_rate` milliseconds after `web_app_start_accelerometer` is invoked and until `web_app_stop_accelerometer` is invoked. It provides the current acceleration readings. ### Parameters A JSON object with `x`, `y`, and `z` fields of type `float`, containing the current acceleration in the X, Y, and Z-axis, measured in m/s². ``` -------------------------------- ### Get Suggested Star Ref Bots Source: https://core.telegram.org/api/bots/referrals Retrieves a list of suggested mini apps with available affiliate programs. Use this to discover potential partners for your affiliate strategy. ```TL Schema payments.getSuggestedStarRefBots#0d6b48f7 flags:# order_by_revenue:flags.0?true order_by_date:flags.1?true peer:InputPeer offset:string limit:int = payments.SuggestedStarRefBots; ``` -------------------------------- ### Fetch List of Themes Source: https://core.telegram.org/api/themes Use account.getThemes to fetch the list of themes available to the user. ```TL account.getThemes#7206e458 format:string hash:long = account.Themes; ``` -------------------------------- ### Get My Stickers Source: https://core.telegram.org/api/stickers Fetches a list of sticker sets created by the current account. ```APIDOC ## messages.getMyStickers ### Description Fetches a list of sticker sets created by the current account (user or bot). ### Method POST ### Endpoint /messages.getMyStickers ### Parameters #### Path Parameters None #### Query Parameters - **offset_id** (long) - Optional: Offset ID for pagination. If not specified, the first stickersets are returned. - **limit** (int) - Optional: Maximum number of sticker sets to return. Defaults to 20. ### Request Example ```json { "offset_id": 0, "limit": 20 } ``` ### Response #### Success Response (200) - **count** (int) - Total number of sticker sets created by the account. - **sets** (Vector) - A list of sticker sets created by the account. #### Response Example ```json { "count": 5, "sets": [ { "id": 12345, "access_hash": "...", "title": "My Awesome Stickers", "short_name": "myawesomestickers", "thumbnail": {"type": "document", "file_id": "..."}, "thumbnail_version": 1, "stickers_count": 10, "emojis_count": 10, "is_masks": false, "animated": false, "videos": false } ] } ``` ``` -------------------------------- ### Main Mini App t.me Syntax Source: https://core.telegram.org/api/links Use this syntax to open a bot's Main Mini App via t.me links. Fallback behavior is applied if the bot does not have a configured Main Mini App. ```URL t.me/?startapp&mode= ``` ```URL t.me/?startapp=&mode= ``` -------------------------------- ### Get My Stickers Source: https://core.telegram.org/api/stickers Fetches a list of stickersets created by the current user or bot. ```TLSchema messages.getMyStickers#d0b5e1fc offset_id:long limit:int = messages.MyStickers; ``` -------------------------------- ### accelerometer_failed Source: https://core.telegram.org/api/bots/webapps Sent by the client if accelerometer tracking cannot be started due to unsupported platform or device. ```APIDOC ## `accelerometer_failed` ### Description This event is sent by the client in response to a `web_app_start_accelerometer` event if accelerometer tracking cannot be started. It indicates the reason for the failure. ### Parameters A JSON object with the following field: * `error` - String, one of: * `UNSUPPORTED` - Accelerometer tracking is not supported on this device or platform. ``` -------------------------------- ### InputMediaPaidMedia Constructor Source: https://core.telegram.org/api/paid-media Represents paid media content to be sent, specifying the price in Stars and the media files. ```TL inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector payload:flags.0?string = InputMedia; ``` -------------------------------- ### Image Wallpaper Links Source: https://core.telegram.org/api/links Links for sharing and installing image-based chat backgrounds (wallpapers). ```text t.me/bg/?mode= ``` ```text tg://bg?slug=&mode= ``` -------------------------------- ### Get Configuration Method Source: https://core.telegram.org/api/datacenter RPC method to retrieve the current configuration, including Data Center options. ```plaintext help.getConfig#c4f9186b = Config; ``` -------------------------------- ### Preformatted Code Block Source: https://core.telegram.org/api/entities Example of a preformatted code block with a specified language (C++). ```plaintext
code
``` ```c++ code ``` -------------------------------- ### channels.getSendAs Source: https://core.telegram.org/api/layers Gets available send-as options for a channel. Supports `flags` and `for_paid_reactions` parameters. ```APIDOC ## channels.getSendAs ### Description Gets available send-as options for a channel. Supports `flags` and `for_paid_reactions` parameters. ### Method GET ### Endpoint /channels.getSendAs ### Parameters #### Query Parameters - **channel** (InputChannel) - Required - The channel to get send-as options for. - **flags** (int) - Optional - Flags for filtering send-as options. - **for_paid_reactions** (bool) - Optional - Whether to get send-as options for paid reactions. ``` -------------------------------- ### App Settings Link Source: https://core.telegram.org/api/links Opens the main application settings page. ```url tg://settings ``` -------------------------------- ### messages.getSavedHistory (with flags, parent_peer) Source: https://core.telegram.org/api/layers Get saved history, including flags and parent_peer parameters. ```APIDOC ## messages.getSavedHistory ### Description Get saved history, including flags and parent_peer parameters. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **flags** (Not specified) - Required/Optional - Description for flags parameter - **parent_peer** (Not specified) - Required/Optional - Description for parent_peer parameter ### Request Example (None specified) ### Response #### Success Response (200) (None specified) #### Response Example (None specified) ``` -------------------------------- ### Wallpaper Settings Constructor Source: https://core.telegram.org/api/wallpapers Defines various settings for wallpapers, such as blur, motion, background colors, intensity, rotation, and emoticons. ```TL Schema wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; ``` -------------------------------- ### Offset-based Pagination Example Source: https://core.telegram.org/api/offsets Demonstrates how to load messages using `offset_id` and `add_offset` for different scenarios like fetching older, newer, or messages around a specific ID. ```javascript messages.getHistory({offset_id: MSGID, add_offset: 0, limit: 20}) ``` ```javascript messages.getHistory({offset_id: MSGID, add_offset: -20, limit: 20}) ``` ```javascript messages.getHistory({offset_id: MSGID, add_offset: -10, limit: 20}) ``` -------------------------------- ### Get Global Privacy Settings Source: https://core.telegram.org/api/privacy Fetches the current global privacy settings for the account. ```tl account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings; ``` -------------------------------- ### web_app_add_to_home_screen Source: https://core.telegram.org/api/web-events Asks the user to add a shortcut to the mini app on the homescreen. Emits `home_screen_added` on success or `home_screen_failed` on failure. ```APIDOC ## web_app_add_to_home_screen ### Description Used by mini apps to ask the user to add a shortcut to the mini app (using the bot's logo) on the homescreen. Ignore incoming events of this type if another event of the same type is still being handled, or if the last click of the user within the app occurred more than 10 seconds ago. Emits a `home_screen_added` event if the shortcut was (already) added successfully, and a `home_screen_failed` event with `error="UNSUPPORTED"` on unsupported platforms. ### Method Not applicable (event-driven) ### Parameters #### Request Body - **null** ### Response Emits `home_screen_added` on success or `home_screen_failed` on failure. ```