telegram api接口细节介绍

Methods


接受服务条款

NameDescription
help.getTermsOfServiceUpdateLook for updates of telegram's terms of service
help.acceptTermsOfServiceAccept the new terms of service

处理垃圾邮件和服务条款违规

NameDescription
account.reportPeerReport a peer for violation of telegram's Terms of Service
account.reportProfilePhotoReport a profile photo of a dialog
channels.reportSpamReports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup
messages.reportReport a message in a chat for violation of telegram's Terms of Service
messages.reportSpamReport a new incoming chat for spam, if the peer settings of the chat allow us to do that
messages.reportEncryptedSpamReport a secret chat for spam

获取配置

NameDescription
help.getAppConfigGet app-specific configuration, see client configuration for more info on the result.
help.getAppUpdateReturns information on update availability for the current application.
help.getConfigReturns current configuration, including data center configuration.
help.getInviteTextReturns localized text of a text message with an invitation.
help.getNearestDcReturns info on data center nearest to the user.
help.getSupportReturns the support user for the "ask a question" feature.
help.getSupportNameGet localized name of the telegram support user
help.getCountriesListGet name, ISO code, localized name and phone codes/patterns of all available countries
help.dismissSuggestionDismiss a suggestion, see here for more info ».

通过二维码登录

NameDescription
auth.exportLoginTokenGenerate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code.

For more info, see login via QR code.
auth.acceptLoginTokenAccept QR code login token, logging in the app that generated it.

Returns info about the new session.

For more info, see login via QR code.
auth.importLoginTokenLogin using a redirected login token, generated in case of DC mismatch during QR code login.

For more info, see login via QR code.

Miscellaneous各种各样的

NameDescription
help.saveAppLogSaves logs of application on the server.
initConnectionInitialize connection
invokeAfterMsgInvokes a query after successful completion of one of the previous queries.
invokeAfterMsgsInvokes a query after a successful completion of previous queries
invokeWithLayerInvoke the specified query using the specified API layer
invokeWithoutUpdatesInvoke a request without subscribing the used connection for updates (this is enabled by default for file queries).

Registration/Authorization 注册/授权

NameDescription
auth.bindTempAuthKeyBinds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.

For more information, see Perfect Forward Secrecy.
auth.cancelCodeCancel the login verification code
account.sendVerifyEmailCodeSend an email verification code.
account.verifyEmailVerify an email address.
auth.resetLoginEmailReset the login email ».
auth.checkPasswordTry logging to an account protected by a 2FA password.
account.resetPasswordInitiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info »
auth.checkRecoveryPasswordCheck if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword.
auth.dropTempAuthKeysDelete all temporary authorization keys except for the ones specified
auth.exportAuthorizationReturns data for copying authorization to another data-center.
auth.importAuthorizationLogs in a user using a key transmitted from his native data-center.
auth.importBotAuthorizationLogin as a bot
account.changeAuthorizationSettingsChange settings related to a session.
account.setAuthorizationTTLSet time-to-live of current session
auth.logOutLogs out the user.
auth.recoverPasswordReset the 2FA password using the recovery code sent using auth.requestPasswordRecovery.
auth.requestPasswordRecoveryRequest recovery code of a 2FA password, only for accounts with a recovery email configured.
auth.resendCodeResend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info.
auth.resetAuthorizationsTerminates all user's authorized sessions except for the current one.

After calling this method it is necessary to reregister the current device using the method account.registerDevice
auth.sendCodeSend the verification code for login
auth.signInSigns in a user with a validated phone number.
auth.signUpRegisters a validated phone number in the system.
auth.requestFirebaseSmsRequest an SMS code via Firebase.
auth.importWebTokenAuthorizationLogin by importing an authorization token
account.invalidateSignInCodesInvalidate the specified login codes, see here » for more info.

使用 GIF(实际上是 MPEG4 GIF)

NameDescription
messages.getSavedGifsGet saved GIFs
messages.saveGifAdd GIF to saved gifs list

使用公共服务公告和 MTProxy 频道

NameDescription
help.hidePromoDataHide MTProxy/Public Service Announcement information
help.getPromoDataGet MTProxy/Public Service Announcement information

使用 TSF(仅供内部使用)

NameDescription
help.editUserInfoInternal use
help.getUserInfoCan only be used by TSF members to obtain internal information.


使用 Telegram Premiu

NameDescription
payments.canPurchasePremiumChecks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only.
help.getPremiumPromoGet Telegram Premium promotion information
payments.assignAppStoreTransactionInforms server about a purchase made through the App Store: for official applications only.
payments.assignPlayMarketTransactionInforms server about a purchase made through the Play Store: for official applications only.

使用2FA 登录

NameDescription
account.confirmPasswordEmailVerify an email to use as 2FA recovery method.
account.resendPasswordEmailResend the code to verify an email to use as 2FA recovery method.
account.cancelPasswordEmailCancel the code that was sent to verify an email to use as 2FA recovery method.
account.getPasswordObtain configuration for two-factor authorization with password
account.getPasswordSettingsGet private info associated to the password info (recovery email, telegram passport info & so on)
account.updatePasswordSettingsSet a new 2FA password
account.declinePasswordResetAbort a pending 2FA password reset, see here for more info »

使用无缝电报登录

NameDescription
messages.requestUrlAuthGet more info about a Seamless Telegram Login authorization request, for more info click here »
messages.acceptUrlAuthUse this to accept a Seamless Telegram Login authorization request, for more info click here »
account.getWebAuthorizationsGet web login widget authorizations
account.resetWebAuthorizationLog out an active web telegram login session
account.resetWebAuthorizationsReset all active web telegram login sessions

使用VoIP 呼叫

NameDescription
phone.acceptCallAccept incoming call
phone.confirmCallComplete phone call E2E encryption key exchange »
phone.discardCallRefuse or end running call
phone.getCallConfigGet phone call configuration to be passed to libtgvoip's shared config
phone.receivedCallOptional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended.
phone.requestCallStart a telegram phone call
phone.saveCallDebugSend phone call debug data to server
phone.sendSignalingDataSend VoIP signaling data
phone.setCallRatingRate a call, returns info about the rating message sent to the official VoIP bot.
phone.saveCallLogSave phone call debug information
messages.deletePhoneCallHistoryDelete the entire phone call history.

使用强调色 »

NameDescription
help.getPeerColorsGet the set of accent color palettes » that can be used for message accents.
help.getPeerProfileColorsGet the set of accent color palettes » that can be used in profile page backgrounds.
account.updateColorUpdate the accent color and background custom emoji » of the current account.
channels.updateColorUpdate the accent color and background custom emoji » of a channel.
account.getDefaultBackgroundEmojisGet a set of suggested custom emoji stickers that can be used in an accent color pattern.


使用boosts »

NameDescription
premium.getBoostsListObtains info about the boosts that were applied to a certain channel (admins only)
premium.getMyBoostsObtain which peers are we currently boosting, and how many boost slots we have left.
premium.applyBoostApply one or more boosts » to a peer.
premium.getBoostsStatusGets the current number of boosts of a channel.
premium.getUserBoostsReturns the lists of boost that were applied to a channel by a specific user (admins only)

使用频道推荐 »

NameDescription
channels.getChannelRecommendationsObtain a list of similarly themed public channels, selected based on similarities in their subscriber bases.

使用频道/超级群组/地理群组

NameDescription
channels.createChannelCreate a supergroup/channel.
channels.getInactiveChannelsGet inactive channels and supergroups
channels.deleteChannelDelete a channel/supergroup
channels.deleteHistoryDelete the history of a supergroup
channels.deleteMessagesDelete messages in a channel/supergroup
channels.deleteParticipantHistoryDelete all messages sent by a specific participant of a given supergroup
channels.editAdminModify the admin rights of a user in a supergroup/channel.
channels.editBannedBan/unban/kick a user in a supergroup/channel.
channels.editCreatorTransfer channel ownership
channels.editLocationEdit location of geogroup, see here » for more info on geogroups.
channels.editPhotoChange the photo of a channel/supergroup
channels.editTitleEdit the name of a channel/supergroup
channels.exportMessageLinkGet link and embed info of a message in a channel/supergroup
channels.getAdminLogGet the admin log of a channel/supergroup
channels.getAdminedPublicChannelsGet channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups.
channels.getChannelsGet info about channels/supergroups
channels.getFullChannelGet full info about a supergroupgigagroup or channel
channels.getGroupsForDiscussionGet all groups that can be used as discussion groups.

Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group.
To set a returned supergroup as a discussion group, access to its old messages must be enabled using channels.togglePreHistoryHidden, first.
channels.getMessagesGet channel/supergroup messages
channels.getParticipantGet info about a channel/supergroup participant
channels.getParticipantsGet the participants of a supergroup/channel
channels.inviteToChannelInvite users to a channel/supergroup

May also return 0-N updates of type updateGroupInvitePrivacyForbidden: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead.
channels.joinChannelJoin a channel/supergroup
channels.leaveChannelLeave a channel/supergroup
channels.readHistoryMark channel/supergroup history as read
channels.readMessageContentsMark channel/supergroup message contents as read
channels.setDiscussionGroupAssociate a group to a channel as discussion group for that channel
channels.setStickersAssociate a stickerset to the supergroup
channels.togglePreHistoryHiddenHide/unhide message history for new channel/supergroup users
channels.toggleSignaturesEnable/disable message signatures in channels
channels.toggleSlowModeToggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds
channels.toggleParticipantsHiddenHide or display the participants list in a supergroup.

The supergroup must have at least hidden_members_group_size_min participants in order to use this method, as specified by the client configuration parameters ».

处理聊天邀请和加入请求

NameDescription
messages.exportChatInviteExport an invite link for a chat
messages.getExportedChatInviteGet info about a chat invite
messages.getExportedChatInvitesGet info about the chat invites of a specific chat
messages.editExportedChatInviteEdit an exported chat invite
messages.deleteRevokedExportedChatInvitesDelete all revoked chat invites
messages.deleteExportedChatInviteDelete a chat invite
messages.getAdminsWithInvitesGet info about chat invites generated by admins.
messages.getChatInviteImportersGet info about the users that joined the chat using a specific chat invite
messages.checkChatInviteCheck the validity of a chat invite link and get basic info about it
messages.importChatInviteImport a chat invite and join a private chat/supergroup/channel
messages.hideChatJoinRequestDismiss or approve a chat join request related to a specific chat or channel.
messages.hideAllChatJoinRequestsDismiss or approve all join requests related to a specific chat or channel.
channels.toggleJoinToSendSet whether all users should join a discussion group in order to comment on a post »
channels.toggleJoinRequestSet whether all users should request admin approval to join the group ».

使用聊天/超级群组/频道

NameDescription
messages.getMessageReadParticipantsGet which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ».
messages.addChatUserAdds a user to a chat and sends a service message on it.

May also return 0-N updates of type updateGroupInvitePrivacyForbidden: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead.
messages.createChatCreates a new chat.

May also return 0-N updates of type updateGroupInvitePrivacyForbidden: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead.
messages.deleteChatUserDeletes a user from a chat and sends a service message on it.
messages.editChatAboutEdit the description of a group/supergroup/channel.
messages.editChatAdminMake a user admin in a basic group.
messages.editChatDefaultBannedRightsEdit the default banned rights of a channel/supergroup/group.
messages.editChatPhotoChanges chat photo and sends a service message on it
messages.editChatTitleChanges chat name and sends a service message on it.
messages.getChatsReturns chat basic info on their IDs.
messages.deleteChatDelete a chat
messages.getCommonChatsGet chats in common with a user
messages.getFullChatGet full info about a basic group.
messages.migrateChatTurn a basic group into a supergroup
channels.convertToGigagroupConvert a supergroup to a gigagroup, when requested by channel suggestions.


使用云主题

NameDescription
account.updateThemeUpdate theme
account.uploadThemeUpload theme
account.getThemesGet installed themes
account.createThemeCreate a theme
account.installThemeInstall a theme
account.saveThemeSave a theme
account.getThemeGet theme information
account.getChatThemesGet all available chat themes ».
messages.setChatThemeChange the chat theme of a certain chat

使用自定义动画表情符号

NameDescription
messages.getCustomEmojiDocumentsFetch custom emoji stickers ».

Returns a list of documents with the animated custom emoji in TGS format, and a documentAttributeCustomEmoji attribute with the original emoji and info about the emoji stickerset this custom emoji belongs to.
messages.getEmojiStickersGets the list of currently installed custom emoji stickersets.
messages.getFeaturedEmojiStickersGets featured custom emoji stickersets.
messages.getEmojiGroupsRepresents a list of emoji categories, to be used when selecting custom emojis.
messages.getEmojiStatusGroupsRepresents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status.
messages.getEmojiProfilePhotoGroupsRepresents a list of emoji categories, to be used when selecting custom emojis to set as profile picture.
messages.searchCustomEmojiLook for custom emojis associated to a UTF8 emoji
account.getDefaultProfilePhotoEmojisGet a set of suggested custom emoji stickers that can be used as profile picture
account.getDefaultGroupPhotoEmojisGet a set of suggested custom emoji stickers that can be used as group picture

使用深层链接

NameDescription
messages.startBotStart a conversation with a bot using a deep linking parameter
help.getDeepLinkInfoGet info about an unsupported deep link, see here for more info ».
help.getRecentMeUrlsGet recently used t.me links.

When installing official applications from "Download Telegram" buttons present in t.me pages, a referral parameter is passed to applications after installation.
If, after downloading the application, the user creates a new account (instead of logging into an existing one), the referral parameter should be imported using this method, which returns the t.me pages the user recently opened, before installing Telegram.


使用表情符号关键字

NameDescription
messages.getEmojiKeywordsGet localized emoji keywords ».
messages.getEmojiKeywordsDifferenceGet changed emoji keywords ».
messages.getEmojiKeywordsLanguagesObtain a list of related languages that must be used when fetching emoji keyword lists ».

Usually the method will return the passed language codes (if localized) + en + some language codes for similar languages (if applicable).
messages.getEmojiURLReturns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji keywords ». The URL will be valid for 30 seconds after generation.

使用表情符号状态

NameDescription
account.updateEmojiStatusSet an emoji status
channels.updateEmojiStatusSet an emoji status for a channel.
account.getDefaultEmojiStatusesGet a list of default suggested emoji statuses
account.getChannelDefaultEmojiStatusesGet a list of default suggested channel emoji statuses.
account.getChannelRestrictedStatusEmojisReturns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ».
account.getRecentEmojiStatusesGet recently used emoji statuses
account.clearRecentEmojiStatusesClears list of recently used emoji statuses

处理文件

NameDescription
help.getCdnConfigGet configuration for CDN file downloads.
upload.getCdnFileDownload a CDN file.
upload.getCdnFileHashesGet SHA256 hashes for verifying downloaded CDN files
upload.reuploadCdnFileRequest a reupload of a certain file to a CDN DC.
upload.getFileReturns content of a whole file or its part.
upload.getFileHashesGet SHA256 hashes for verifying downloaded files
upload.getWebFileReturns content of a web file, by proxying the request through telegram, see the webfile docs for more info.

Note: the query must be sent to the DC specified in the webfile_dc_id MTProto configuration field.
upload.saveBigFilePartSaves a part of a large file (over 10 MB in size) to be later passed to one of the methods.
upload.saveFilePartSaves a part of file for further sending to one of the methods.
messages.uploadEncryptedFileUpload encrypted file and associate it to a secret chat
messages.uploadMediaUpload a file and associate it to a chat (without actually sending it to the chat)
messages.getExtendedMediaGet information about extended media
messages.getDocumentByHashGet a document by its SHA256 hash, mainly used for gifs


使用论坛

NameDescription
channels.toggleForumEnable or disable forum functionality in a supergroup.
channels.createForumTopicCreate a forum topic; requires manage_topics rights.
channels.getForumTopicsGet topics of a forum
channels.getForumTopicsByIDGet forum topics by their ID
channels.editForumTopicEdit forum topic; requires manage_topics rights.
channels.updatePinnedForumTopicPin or unpin forum topics
channels.reorderPinnedForumTopicsReorder pinned forum topics
channels.deleteTopicHistoryDelete message history of a forum topic
channels.toggleViewForumAsMessagesUsers may also choose to display messages from all topics of a forum as if they were sent to a normal group, using a "View as messages" setting in the local client: this setting only affects the current account, and is synced to other logged in sessions using this method.

Invoking this method will update the value of the view_forum_as_messages flag of channelFull or dialog and emit an updateChannelViewForumAsMessages.

使用fragment.com 用户名

NameDescription
account.reorderUsernamesReorder usernames associated with the currently logged-in user.
account.toggleUsernameActivate or deactivate a purchased fragment.com username associated to the currently logged-in user.
bots.reorderUsernamesReorder usernames associated to a bot we own.
bots.toggleUsernameActivate or deactivate a purchased fragment.com username associated to a bot we own.
channels.reorderUsernamesReorder active usernames
channels.toggleUsernameActivate or deactivate a purchased fragment.com username associated to a supergroup or channel we own.
channels.deactivateAllUsernamesDisable all purchased usernames of a supergroup or channel

使用礼品代码

NameDescription
payments.checkGiftCodeObtain information about a Telegram Premium giftcode »
payments.applyGiftCodeApply a Telegram Premium giftcode »

赠品和礼物

NameDescription
payments.getPremiumGiftCodeOptionsObtain a list of Telegram Premium giveaway/gift code » options.
payments.getGiveawayInfoObtain information about a Telegram Premium giveaway ».
payments.launchPrepaidGiveawayLaunch a prepaid giveaway ».

使用即时查看页面

NameDescription
messages.getWebPageGet instant view page
messages.getWebPagePreviewGet preview of webpage

处理消息反应

NameDescription
messages.setDefaultReactionChange default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getConfig, reactions_default field.
messages.getMessagesReactionsGet message reactions »
messages.sendReactionReact to message.

Starting from layer 159, the reaction will be sent from the peer specified using messages.saveDefaultSendAs.
messages.getAvailableReactionsObtain available message reactions »
messages.getUnreadReactionsGet unread reactions to messages you sent
messages.readReactionsMark message reactions » as read
messages.setChatAvailableReactionsChange the set of message reactions » that can be used in a certain group, supergroup or channel
messages.getMessageReactionsListGet message reaction list, along with the sender of each reaction.
messages.reportReactionReport a message reaction
messages.getTopReactionsGot popular message reactions
messages.getRecentReactionsGet recently used message reactions
messages.clearRecentReactionsClear recently used message reactions


处理消息翻译

NameDescription
messages.translateTextTranslate a given text.

Styled text entities will only be preserved for Telegram Premium users.
messages.togglePeerTranslationsShow or hide the real-time chat translation popup for a certain chat


使用迷你机器人应用程序 »

NameDescription
messages.requestWebViewOpen a bot mini app, sending over user information after user confirmation.

After calling this method, until the user closes the webview, messages.prolongWebView must be called every 60 seconds.
messages.prolongWebViewIndicate to the server (from the user side) that the user is still using a web app.

If the method returns a QUERY_ID_INVALID error, the webview must be closed.
messages.requestSimpleWebViewOpen a bot mini app.
messages.sendWebViewResultMessageTerminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user.
messages.sendWebViewDataUsed by the user to relay data from an opened reply keyboard bot mini app to the bot that owns it.
messages.requestAppWebViewOpen a bot mini app from a direct Mini App deep link, sending over user information after user confirmation.

After calling this method, until the user closes the webview, messages.prolongWebView must be called every 60 seconds.
messages.getBotAppObtain information about a direct link Mini App
bots.canSendMessageCheck whether the specified bot can send us messages
bots.allowSendMessageAllow the specified bot to send us messages
bots.invokeWebViewCustomMethodSend a custom request from a mini bot app, triggered by a web_app_invoke_custom_method event ».

The response should be sent using a custom_method_invoked event, see here » for more info on the flow.

使用已保存的消息对话框 »

NameDescription
messages.getSavedDialogsReturns the current saved dialog list, see here » for more info.
messages.getSavedHistoryReturns saved messages » forwarded from a specific peer
messages.deleteSavedHistoryDeletes messages forwarded from a specific peer to saved messages ».
messages.getPinnedSavedDialogsGet pinned saved dialogs, see here » for more info.
messages.toggleSavedDialogPinPin or unpin a saved message dialog ».
messages.reorderPinnedSavedDialogsReorder pinned saved message dialogs ».

使用秘密聊天

NameDescription
messages.setEncryptedTypingSend typing event by the current user to a secret chat.
messages.readEncryptedHistoryMarks message history within a secret chat as read.
messages.acceptEncryptionConfirms creation of a secret chat
messages.discardEncryptionCancels a request for creation and/or delete info on secret chat.
messages.requestEncryptionSends a request to start a secret chat to the user.
messages.sendEncryptedSends a text message to a secret chat.
messages.sendEncryptedFileSends a message with a file attachment to a secret chat
messages.sendEncryptedServiceSends a service message to a secret chat.
messages.getDhConfigReturns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length.
messages.receivedQueueConfirms receipt of messages in a secret chat by client, cancels push notifications.
The method returns a list of random_ids of messages for which push notifications were cancelled.

处理统计数据

NameDescription
stats.loadAsyncGraphLoad channel statistics graph asynchronously
stats.getBroadcastStatsGet channel statistics
stats.getMessagePublicForwardsObtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of messages with peer_id equal to the public channel to which this message was forwarded.
stats.getMegagroupStatsGet supergroup statistics
stats.getMessageStatsGet message statistics
stats.getStoryStatsGet statistics for a certain story.
stats.getStoryPublicForwardsObtain forwards of a story as a message to public chats and reposts by public channels.


使用贴纸 »

NameDescription
messages.getOldFeaturedStickersMethod for fetching previously featured stickers
messages.toggleStickerSetsApply changes to multiple stickersets
stickers.suggestShortNameSuggests a short name for a given stickerpack name
stickers.checkShortNameCheck whether the given short name is available
stickers.setStickerSetThumbSet stickerset thumbnail
stickers.addStickerToSetAdd a sticker to a stickerset, bots only. The sticker set must have been created by the bot.
stickers.changeStickerPositionChanges the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot
stickers.createStickerSetCreate a stickerset, bots only.
stickers.changeStickerUpdate the keywords, emojis or mask coordinates of a sticker, bots only.
stickers.renameStickerSetRenames a stickerset, bots only.
stickers.deleteStickerSetDeletes a stickerset we created, bots only.
stickers.removeStickerFromSetRemove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot.
messages.clearRecentStickersClear recent stickers
messages.faveStickerMark or unmark a sticker as favorite
messages.getAllStickersGet all installed stickers
messages.getArchivedStickersGet all archived stickers
messages.getAttachedStickersGet stickers attached to a photo or video
messages.getFavedStickersGet faved stickers
messages.getFeaturedStickersGet featured stickers
messages.getMaskStickersGet installed mask stickers
messages.getRecentStickersGet recent stickers
messages.getStickerSetGet info about a stickerset
messages.getStickersGet stickers by emoji
messages.saveRecentStickerAdd/remove sticker from recent stickers list
messages.installStickerSetInstall a stickerset
messages.readFeaturedStickersMark new featured stickers as read
messages.reorderStickerSetsReorder installed stickersets
messages.searchStickerSetsSearch for stickersets
messages.searchEmojiStickerSetsSearch for custom emoji stickersets »
messages.uninstallStickerSetUninstall a stickerset

处理故事

NameDescription
stories.canSendStoryCheck whether we can post stories as the specified peer.
stories.sendStoryUploads a Telegram Story.
stories.editStoryEdit an uploaded story
stories.deleteStoriesDeletes some posted stories.
stories.togglePinnedPin or unpin one or more stories
stories.getAllStoriesFetch the List of active (or active and hidden) stories, see here » for more info on watching stories.
stories.getPinnedStoriesFetch the stories pinned on a peer's profile.
stories.getStoriesArchiveFetch the story archive » of a peer we control.
stories.getStoriesByIDObtain full info about a set of stories by their IDs.
stories.toggleAllStoriesHiddenHide the active stories of a specific peer, preventing them from being displayed on the action bar on the homescreen.
stories.readStoriesMark all stories up to a certain ID as read, for a given peer; will emit an updateReadStories update to all logged-in sessions.
stories.incrementStoryViewsIncrement the view counter of one or more stories.
stories.getStoryViewsListObtain the list of users that have viewed a specific story we posted
stories.getStoryReactionsListGet the reaction and interaction list of a story posted to a channel, along with the sender of each reaction.

Can only be used by channel admins.
stories.getStoriesViewsObtain info about the view count, forward count, reactions and recent viewers of one or more stories.
stories.exportStoryLinkGenerate a story deep link for a specific story
stories.reportReport a story.
stories.activateStealthModeActivates stories stealth mode, see here » for more info.

Will return an updateStoriesStealthMode.
stories.getPeerStoriesFetch the full active story list of a specific peer.
stories.getAllReadPeerStoriesObtain the latest read story ID for all peers when first logging in, returned as a list of updateReadStories updates, see here » for more info.
stories.getPeerMaxIDsGet the IDs of the maximum read stories for a set of peers.
stories.getChatsToSendObtain a list of channels where the user can post stories
stories.togglePeerStoriesHiddenHide the active stories of a user, preventing them from being displayed on the action bar on the homescreen, see here » for more info.
stories.sendReactionReact to a story.

使用电报护照

NameDescription
account.sendVerifyPhoneCodeSend the verification phone code for telegram passport.
account.verifyPhoneVerify a phone number for telegram passport.
account.acceptAuthorizationSends a Telegram Passport authorization form, effectively sharing data with the service
account.getAuthorizationFormReturns a Telegram Passport authorization form for sharing data with a service
account.getAuthorizationsGet logged-in sessions
account.deleteSecureValueDelete stored Telegram Passport documents, for more info see the passport docs »
account.getAllSecureValuesGet all saved Telegram Passport documents, for more info see the passport docs »
account.getSecureValueGet saved Telegram Passport document, for more info see the passport docs »
account.saveSecureValueSecurely save Telegram Passport document, for more info see the passport docs »
help.getPassportConfigGet passport configuration
users.setSecureValueErrorsNotify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change).

Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.


使用临时个人资料链接

NameDescription
contacts.exportContactTokenGenerates a temporary profile link for the currently logged-in user.
contacts.importContactTokenObtain user info from a temporary profile link.

使用更新

NameDescription
updates.getChannelDifferenceReturns the difference between the current state of updates of a certain channel and transmitted.
updates.getDifferenceGet new updates.
updates.getStateReturns a current state of updates.

处理语音消息转录

NameDescription
messages.transcribeAudioTranscribe voice message
messages.rateTranscribedAudioRate transcribed voice message

使用墙纸 »

NameDescription
account.getMultiWallPapersGet info about multiple wallpapers
account.getWallPaperGet info about a certain wallpaper
account.getWallPapersReturns a list of available wallpapers.
account.installWallPaperInstall wallpaper
account.resetWallPapersDelete all installed wallpapers, reverting to the default wallpaper set.
account.saveWallPaperInstall/uninstall wallpaper
account.uploadWallPaperCreate and upload a new wallpaper
messages.setChatWallPaperSet a custom wallpaper » in a specific private chat with another user.


使用机器人管理员正确建议

NameDescription
bots.setBotBroadcastDefaultAdminRightsSet the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ».
bots.setBotGroupDefaultAdminRightsSet the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ».

使用机器人内联查询和回调按钮

NameDescription
messages.getInlineBotResultsQuery an inline bot
messages.setInlineBotResultsAnswer an inline query, for bots only
messages.sendInlineBotResultSend a result obtained using messages.getInlineBotResults.
messages.getBotCallbackAnswerPress an inline callback button and get a callback answer from the bot
messages.setBotCallbackAnswerSet the callback answer to a user button press (bots only)
messages.editInlineBotMessageEdit an inline bot message
messages.sendBotRequestedPeerSend one or more chosen peers, as requested by a keyboardButtonRequestPeer button.


使用机器人

NameDescription
bots.resetBotCommandsClear bot commands for the specified bot scope and language code
bots.getBotCommandsObtain a list of bot commands for the specified bot scope and language code
bots.setBotCommandsSet bot command list
bots.setBotInfoSet localized name, about text and description of a bot (or of the current account, if called by a bot).
bots.getBotInfoGet localized name, about text and description of a bot (or of the current account, if called by a bot).


使用机器人(内部机器人 API 使用)

NameDescription
bots.answerWebhookJSONQueryAnswers a custom query; for bots only
bots.sendCustomRequestSends a custom request; for bots only
help.setBotUpdatesStatusInforms the server about the number of pending bot updates if they haven't been processed for a long time; for bots only

与联系人和顶级同事合作

NameDescription
account.getContactSignUpNotificationWhether the user will receive notifications when contacts sign up
account.setContactSignUpNotificationToggle contact sign up notifications
contacts.acceptContactIf the add contact action bar is active, add that user as contact
contacts.addContactAdd an existing telegram user as contact.

Use contacts.importContacts to add contacts by phone number, without knowing their Telegram ID.
contacts.blockAdds a peer to a blocklist, see here » for more info.
contacts.deleteByPhonesDelete contacts by phone number
contacts.deleteContactsDeletes several contacts from the list.
contacts.getBlockedReturns the list of blocked users.
contacts.getContactIDsGet the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings).
contacts.getContactsReturns the current user's contact list.
contacts.getLocatedGet users and geochats near you, see here » for more info.
contacts.getSavedGet all contacts, requires a takeout session, see here » for more info.
contacts.getStatusesUse this method to obtain the online statuses of all contacts with an accessible Telegram account.
contacts.getTopPeersGet most used peers
contacts.importContactsImports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.

Use contacts.addContact to add Telegram contacts without actually using their phone number.
contacts.resetSavedRemoves all contacts without an associated Telegram account.
contacts.resetTopPeerRatingReset rating of top peer
contacts.searchReturns users found by username substring.
contacts.toggleTopPeersEnable/disable top peers
contacts.unblockDeletes a peer from a blocklist, see here » for more info.
contacts.setBlockedReplace the contents of an entire blocklist, see here for more info ».
contacts.editCloseFriendsEdit the close friends list, see here » for more info.

使用信用卡

NameDescription
payments.getBankCardDataGet info about a credit card

使用对话框

NameDescription
messages.getDialogsReturns the current user dialog list.
messages.getPeerDialogsGet dialog info of specified peers
messages.getPinnedDialogsGet pinned dialogs
messages.toggleDialogPinPin/unpin a dialog
messages.reorderPinnedDialogsReorder pinned dialogs
messages.getDialogUnreadMarksGet dialogs manually marked as unread
messages.markDialogUnreadManually mark dialog as unread
messages.getPeerSettingsGet peer settings
messages.hidePeerSettingsBarShould be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ».
messages.getOnlinesGet count of online users in a chat
messages.sendScreenshotNotificationNotify the other user in a private chat that a screenshot of the chat was taken
messages.setTypingSends a current user typing event (see SendMessageAction for all event types) to a conversation partner or group.
messages.setHistoryTTLSet maximum Time-To-Live of all messages in the specified chat

处理草稿

NameDescription
messages.clearAllDraftsClear all drafts.
messages.getAllDraftsReturn all message drafts.
Returns all the latest updateDraftMessage updates related to all chats with drafts.
messages.saveDraftSave a message draft associated to a chat.


使用文件夹

NameDescription
messages.updateDialogFiltersOrderReorder folders
messages.getDialogFiltersGet folders
messages.getSuggestedDialogFiltersGet suggested folders
messages.updateDialogFilterUpdate folder
folders.editPeerFoldersEdit peers in peer folder
chatlists.exportChatlistInviteExport a folder », creating a chat folder deep link ».
chatlists.deleteExportedInviteDelete a previously created chat folder deep link ».
chatlists.editExportedInviteEdit a chat folder deep link ».
chatlists.getExportedInvitesList all chat folder deep links » associated to a folder
chatlists.checkChatlistInviteObtain information about a chat folder deep link ».
chatlists.joinChatlistInviteImport a chat folder deep link », joining some or all the chats in the folder.
chatlists.getChatlistUpdatesFetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »).
chatlists.joinChatlistUpdatesJoin channels and supergroups recently added to a chat folder deep link ».
chatlists.hideChatlistUpdatesDismiss new pending peers recently added to a chat folder deep link ».
chatlists.getLeaveChatlistSuggestionsReturns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted.
chatlists.leaveChatlistDelete a folder imported using a chat folder deep link »

从事游戏工作

NameDescription
messages.getGameHighScoresGet highscores of a game
messages.getInlineGameHighScoresGet highscores of a game sent using an inline bot
messages.setGameScoreUse this method to set the score of the specified user in a game sent as a normal message (bots only).
messages.setInlineGameScoreUse this method to set the score of the specified user in a game sent as an inline message (bots only).


使用群组通话和直播

NameDescription
phone.exportGroupCallInviteGet an invite link for a group call or livestream
phone.getGroupCallJoinAsGet a list of peers that can be used to join a group call, presenting yourself as a specific user/channel.
phone.editGroupCallParticipantEdit information about a given group call participant

Note: flags.N?Bool parameters can have three possible values:

- If the TL flag is not set, the previous value will not be changed.
- If the TL flag is set and contains a boolTrue, the previous value will be overwritten to true.
- If the TL flag is set and contains a boolFalse, the previous value will be overwritten to false.
phone.toggleGroupCallRecordStart or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves).
phone.editGroupCallTitleEdit the title of a group call or livestream
phone.getGroupParticipantsGet group call participants
phone.checkGroupCallCheck whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs.
Returns an intersection of the source IDs specified in sources, and the source IDs currently being forwarded by the SFU.
phone.createGroupCallCreate a group call or livestream
phone.toggleGroupCallStartSubscriptionSubscribe or unsubscribe to a scheduled group call
phone.leaveGroupCallLeave a group call
phone.toggleGroupCallSettingsChange group call settings
phone.inviteToGroupCallInvite a set of users to a group call.
phone.getGroupCallGet info about a group call
phone.joinGroupCallJoin a group call
phone.leaveGroupCallPresentationStop screen sharing in a group call
phone.discardGroupCallTerminate a group call
phone.joinGroupCallPresentationStart screen sharing in a call
phone.startScheduledGroupCallStart a scheduled group call.
phone.saveDefaultGroupCallJoinAsSet the default peer that will be used to join a group call in a specific dialog.
phone.getGroupCallStreamChannelsGet info about RTMP streams in a group call or livestream.
This method should be invoked to the same group/channel-related DC used for downloading livestream chunks.
As usual, the media DC is preferred, if available.
phone.getGroupCallStreamRtmpUrlGet RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with phone.createGroupCall (the rtmp_stream flag must be set).

处理导入的聊天记录

NameDescription
messages.uploadImportedMediaUpload a media file associated with an imported chat, click here for more info ».
messages.startHistoryImportComplete the history import process, importing all messages into the chat.
To be called only after initializing the import with messages.initHistoryImport and uploading all files using messages.uploadImportedMedia.
messages.checkHistoryImportPeerCheck whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ».

If the check succeeds, and no RPC errors are returned, a messages.CheckedHistoryImportPeer constructor will be returned, with a confirmation text to be shown to the user, before actually initializing the import.
messages.checkHistoryImportObtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ».
messages.initHistoryImportImport chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ».

使用本地化包

NameDescription
langpack.getDifferenceGet new strings in language pack
langpack.getLangPackGet localization pack strings
langpack.getLanguageGet information about a language in a localization pack
langpack.getLanguagesGet information about all languages in a localization pack
langpack.getStringsGet strings from a language pack

使用媒体自动下载设置

NameDescription
account.getAutoDownloadSettingsGet media autodownload settings
account.saveAutoDownloadSettingsChange media autodownload settings

使用媒体自动保存设置

NameDescription
account.getAutoSaveSettingsGet autosave settings
account.saveAutoSaveSettingsModify autosave settings
account.deleteAutoSaveExceptionsClear all peer-specific autosave settings.


使用消息线程

NameDescription
messages.getRepliesGet messages in a reply thread
contacts.blockFromRepliesStop getting notifications about discussion replies of a certain user in @replies
messages.getDiscussionMessageGet discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group
messages.readDiscussionMark a thread as read


处理消息

NameDescription
messages.deleteHistoryDeletes communication history.
messages.deleteMessagesDeletes messages by their identifiers.
messages.editMessageEdit message
messages.forwardMessagesForwards messages by their IDs.
messages.getHistoryReturns the conversation history with one interlocutor / within a chat
messages.getSearchResultsPositionsReturns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation.

Returns the results in reverse chronological order (i.e., in order of decreasing message_id).
messages.getMessageEditDataFind out if a media message's caption can be edited
messages.getMessagesReturns the list of messages by their IDs.
messages.getMessagesViewsGet and increase the view counter of a message sent or forwarded from a channel
messages.getRecentLocationsGet live location history of a certain user
messages.getSearchCountersGet the number of results that would be found by a messages.search call with the same parameters
messages.getUnreadMentionsGet unread messages where we were mentioned
messages.readHistoryMarks message history as read.
messages.readMentionsMark mentions as read
messages.readMessageContentsNotifies the sender about the recipient having listened a voice message or watched a video.
messages.receivedMessagesConfirms receipt of messages by a client, cancels PUSH-notification sending.
messages.searchSearch for messages.
messages.getSearchResultsCalendarReturns information about the next messages of the specified type in the chat split by days.

Returns the results in reverse chronological order.
Can return partial results for the last returned day.
messages.searchGlobalSearch for messages and peers globally
messages.searchSentMediaView and search recently sent media.
This method does not support pagination.
messages.sendMediaSend a media
messages.sendMessageSends a message to a chat
messages.sendMultiMediaSend an album or grouped media
messages.updatePinnedMessagePin a message
messages.unpinAllMessagesUnpin all pinned messages
messages.toggleNoForwardsEnable or disable content protection on a channel or chat
messages.saveDefaultSendAsChange the default peer that should be used when sending messages, reactions, poll votes to a specific group
channels.getSendAsObtains a list of peers that can be used to send messages in a specific group

使用通知设置

NameDescription
account.registerDeviceRegister device to receive PUSH notifications
account.unregisterDeviceDeletes a device by its token, stops sending PUSH-notifications to it.
account.updateDeviceLockedWhen client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications.
account.getNotifyExceptionsReturns list of chats with non-default notification settings
account.getNotifySettingsGets current notification settings for a given user/group, from all users/all groups.
account.updateNotifySettingsEdits notification settings from a given user/group, from all users/all groups.
account.resetNotifySettingsResets all notification settings from users and groups.

使用通知声音

NameDescription
account.getSavedRingtonesFetch saved notification sounds
account.saveRingtoneSave or remove saved notification sound.

If the notification sound is already in MP3 format, account.savedRingtone will be returned.
Otherwise, it will be automatically converted and a account.savedRingtoneConverted will be returned, containing a new document object that should be used to refer to the ringtone from now on (ie when deleting it using the unsave parameter, or when downloading it).
account.uploadRingtoneUpload notification sound, use account.saveRingtone to convert it and add it to the list of saved notification sounds.

与其他用户合作

NameDescription
users.getFullUserReturns extended user info by ID.
users.getUsersReturns basic user info according to their identifiers.
contacts.resolvePhoneResolve a phone number to get user info, if their privacy settings allow it.

处理付款

NameDescription
payments.getSavedInfoGet saved payment information
payments.clearSavedInfoClear saved payment information
payments.getPaymentFormGet a payment form
payments.validateRequestedInfoSubmit requested order information for validation
messages.setBotShippingResultsIf you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an updateBotShippingQuery update. Use this method to reply to shipping queries.
account.getTmpPasswordGet temporary payment password
payments.sendPaymentFormSend compiled payment form
messages.setBotPrecheckoutResultsOnce the user has confirmed their payment and shipping details, the bot receives an updateBotPrecheckoutQuery update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent.
payments.getPaymentReceiptGet payment receipt
payments.exportInvoiceGenerate an invoice deep link


处理民意调查

NameDescription
messages.getPollResultsGet poll results
messages.getPollVotesGet poll results for non-anonymous polls
messages.sendVoteVote in a poll

Starting from layer 159, the vote will be sent from the peer specified using messages.saveDefaultSendAs.

使用预定的消息

NameDescription
messages.sendScheduledMessagesSend scheduled messages right away
messages.getScheduledHistoryGet scheduled messages
messages.deleteScheduledMessagesDelete scheduled messages
messages.getScheduledMessagesGet scheduled messages

处理敏感内容 (NSFW)

NameDescription
account.getContentSettingsGet sensitive content settings
account.setContentSettingsSet sensitive content settings (for viewing or hiding NSFW content)

使用赞助信息

NameDescription
channels.getSponsoredMessagesGet a list of sponsored messages
channels.viewSponsoredMessageMark a specific sponsored message as read
channels.clickSponsoredMessageInforms the server that the user has either:

- Clicked on a link in the sponsored message
- Has opened a sponsored chat or a sponsored website via the associated button
- Has opened the sponsored chat via the sponsored message name, the sponsored message photo, or a mention in the sponsored message

使用迷你机器人应用程序附件菜单 »

NameDescription
messages.getAttachMenuBotsReturns installed attachment menu bot mini apps »
messages.getAttachMenuBotReturns attachment menu entry for a bot mini app that can be launched from the attachment menu »
messages.toggleBotInAttachMenuEnable or disable web bot attachment menu »

与本地反垃圾邮件系统合作

NameDescription
channels.toggleAntiSpamEnable or disable the native antispam system.
channels.reportAntiSpamFalsePositiveReport a native antispam false positive

使用外卖 API,请参阅此处 » 了解更多信息

NameDescription
account.initTakeoutSessionInitialize a takeout session, see here » for more info.
account.finishTakeoutSessionTerminate a takeout session, see here » for more info.
messages.getSplitRangesGet message ranges for saving the user's chat history
channels.getLeftChannelsGet a list of channels/supergroups we left, requires a takeout session, see here » for more info.
invokeWithMessagesRangeInvoke with the given message range
invokeWithTakeoutInvoke a method within a takeout session, see here » for more info.


使用机器人菜单按钮 »

NameDescription
bots.setBotMenuButtonSets the menu button action » for a given user or for all users
bots.getBotMenuButtonGets the menu button action for a given user or for all users, previously set using bots.setBotMenuButton; users can see this information in the botInfo constructor.


使用用户账户

NameDescription
account.changePhoneChange the phone number of the current account
account.confirmPhoneConfirm a phone number to cancel account deletion, for more info click here »
account.deleteAccountDelete the user's account from the telegram servers.

Can also be used to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured, see here » for more info on password recovery, and here » for more info on account deletion.
account.getAccountTTLGet days to live of account
account.getPrivacyGet privacy settings of current account
account.resetAuthorizationLog out an active authorized session by its hash
account.sendChangePhoneCodeVerify a new phone number to associate to the current account
account.sendConfirmPhoneCodeSend confirmation code to cancel account deletion, for more info click here »
account.setAccountTTLSet account self-destruction period
account.setPrivacyChange privacy settings of current account
account.setGlobalPrivacySettingsSet global privacy settings
account.getGlobalPrivacySettingsGet global privacy settings
account.updateProfileUpdates user profile.
account.updateStatusUpdates online user status.
messages.setDefaultHistoryTTLChanges the default value of the Time-To-Live setting, applied to all new chats.
messages.getDefaultHistoryTTLGets the default value of the Time-To-Live setting, applied to all new chats.

使用用户个人资料图片

NameDescription
photos.deletePhotosDeletes profile photos. The method returns a list of successfully deleted photo IDs.
photos.getUserPhotosReturns the list of user photos.
photos.updateProfilePhotoInstalls a previously uploaded photo as a profile photo.
photos.uploadProfilePhotoUpdates current user profile photo.

The filevideo and video_emoji_markup flags are mutually exclusive.
photos.uploadContactProfilePhotoUpload a custom profile picture for a contact, or suggest a new profile picture to a contact.

The filevideo and video_emoji_markup flags are mutually exclusive.

使用用户名

NameDescription
channels.checkUsernameCheck if a username is free and can be assigned to a channel/supergroup
channels.updateUsernameChange or remove the username of a supergroup/channel
account.updateUsernameChanges username for the current user.
account.checkUsernameValidates a username and checks availability.
contacts.resolveUsernameResolve a @username to get peer info
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值