Contents Menu Expand Light mode Dark mode Auto light/dark mode
PyroTGFork 2.2.11 Layer 202
Logo
PyroTGFork

Introduction

  • Quick Start
  • Install Guide

Getting Started

  • Project Setup
  • Authorization
  • Invoking Methods
  • Handling Updates
  • Error Handling
  • Examples
    • hello_world
    • echo_bot
    • business_echo_bot
    • welcome_bot
    • get_history
    • get_chat_members
    • get_dialogs
    • callback_queries
    • inline_queries
    • use_inline_bots
    • bot_keyboards
    • send_voice
    • raw_updates

API Reference

  • Pyrogram Client
  • Available Methods
    • run
    • start
    • stop
    • restart
    • export_session_string
    • add_handler
    • remove_handler
    • stop_transmission
    • set_parse_mode
    • idle()
    • compose()
    • initialize
    • sign_up
    • accept_terms_of_service
    • sign_in
    • sign_in_bot
    • connect
    • send_code
    • resend_code
    • recover_password
    • send_recovery_code
    • get_password_hint
    • check_password
    • log_out
    • disconnect
    • terminate
    • get_me
    • get_active_sessions
    • terminate_session
    • terminate_all_other_sessions
    • send_message
    • forward_messages
    • copy_message
    • send_photo
    • send_audio
    • send_document
    • send_video
    • send_animation
    • send_voice
    • send_video_note
    • send_cached_media
    • send_paid_media
    • send_media_group
    • get_media_group
    • copy_media_group
    • send_location
    • send_venue
    • send_contact
    • send_poll
    • send_dice
    • send_chat_action
    • add_paid_message_reaction
    • set_reaction
    • download_media
    • stream_media
    • edit_message_text
    • edit_inline_text
    • edit_message_caption
    • edit_inline_caption
    • edit_message_media
    • edit_inline_media
    • edit_message_reply_markup
    • edit_inline_reply_markup
    • edit_cached_media
    • stop_poll
    • delete_messages
    • get_chat_sponsored_messages
    • get_chat_history
    • get_chat_history_count
    • read_chat_history
    • get_messages
    • get_chat_pinned_message
    • get_callback_query_message
    • get_replied_message
    • view_messages
    • get_discussion_message
    • get_discussion_replies
    • get_discussion_replies_count
    • search_global
    • search_global_count
    • search_messages
    • search_messages_count
    • search_public_messages_by_tag
    • count_public_messages_by_tag
    • vote_poll
    • retract_vote
    • translate_text
    • translate_message_text
    • delete_chat_history
    • send_screenshot_notification
    • ban_chat_member
    • unban_chat_member
    • restrict_chat_member
    • promote_chat_member
    • set_administrator_title
    • set_chat_permissions
    • set_chat_photo
    • delete_chat_photo
    • set_chat_title
    • set_chat_description
    • pin_chat_message
    • unpin_chat_message
    • unpin_all_chat_messages
    • search_chats
    • join_chat
    • leave_chat
    • get_chat
    • get_chat_members
    • get_chat_members_count
    • get_chat_member
    • get_dialogs
    • get_dialogs_count
    • set_chat_username
    • get_nearby_chats
    • archive_chats
    • unarchive_chats
    • add_chat_members
    • create_channel
    • create_group
    • create_supergroup
    • delete_channel
    • delete_supergroup
    • delete_user_history
    • set_slow_mode
    • set_chat_message_auto_delete_time
    • mark_chat_unread
    • get_chat_event_log
    • get_chat_online_count
    • get_send_as_chats
    • set_send_as_chat
    • set_chat_protected_content
    • get_created_chats
    • transfer_chat_ownership
    • export_chat_invite_link
    • create_chat_invite_link
    • edit_chat_invite_link
    • revoke_chat_invite_link
    • get_chat_admin_invite_links
    • get_chat_admin_invite_links_count
    • get_chat_admins_with_invite_links
    • get_chat_invite_link
    • get_chat_invite_link_joiners
    • get_chat_invite_link_joiners_count
    • delete_chat_invite_link
    • delete_chat_admin_invite_links
    • get_chat_join_requests
    • approve_chat_join_request
    • approve_all_chat_join_requests
    • decline_chat_join_request
    • decline_all_chat_join_requests
    • get_forum_topic_icon_stickers
    • create_forum_topic
    • edit_forum_topic
    • close_forum_topic
    • reopen_forum_topic
    • delete_forum_topic
    • hide_forum_topic
    • unhide_forum_topic
    • get_forum_topics
    • get_forum_topic
    • toggle_forum_topic_is_pinned
    • get_chat_photos
    • get_chat_photos_count
    • get_users
    • set_profile_photo
    • delete_profile_photos
    • set_username
    • update_profile
    • block_user
    • unblock_user
    • get_common_chats
    • get_default_emoji_statuses
    • set_emoji_status
    • set_birthdate
    • set_personal_chat
    • delete_account
    • update_status
    • add_contact
    • delete_contacts
    • import_contacts
    • get_contacts
    • get_contacts_count
    • enable_cloud_password
    • change_cloud_password
    • remove_cloud_password
    • answer_callback_query
    • request_callback_answer
    • set_bot_commands
    • delete_bot_commands
    • get_bot_commands
    • set_bot_name
    • get_bot_name
    • set_bot_info_description
    • get_bot_info_description
    • set_bot_info_short_description
    • get_bot_info_short_description
    • set_chat_menu_button
    • get_chat_menu_button
    • set_bot_default_privileges
    • get_bot_default_privileges
    • send_game
    • set_game_score
    • get_game_high_scores
    • answer_inline_query
    • get_inline_bot_results
    • send_inline_bot_result
    • answer_web_app_query
    • send_web_app_custom_request
    • get_owned_bots
    • get_similar_bots
    • send_sticker
    • get_custom_emoji_stickers
    • get_message_effects
    • get_stickers
    • get_stories
    • send_invoice
    • create_invoice_link
    • answer_shipping_query
    • answer_pre_checkout_query
    • refund_star_payment
    • get_business_connection
    • get_collectible_item_info
    • get_payment_form
    • send_payment_form
    • get_available_gifts
    • get_received_gifts
    • sell_gift
    • send_gift
    • toggle_gift_is_saved
    • get_owned_star_count
    • get_business_account_star_balance
    • create_video_chat
    • discard_group_call
    • get_video_chat_rtmp_url
    • invite_group_call_participants
    • load_group_call_participants
    • invoke
    • resolve_peer
    • get_file
    • save_file
  • Available Types
    • Message
    • MessageEntity
    • TextQuote
    • ExternalReplyInfo
    • ReplyParameters
    • MessageOrigin
    • MessageOriginUser
    • MessageOriginHiddenUser
    • MessageOriginChat
    • MessageOriginChannel
    • MessageImportInfo
    • Photo
    • AlternativeVideo
    • Animation
    • Audio
    • Document
    • Story
    • Video
    • VideoNote
    • Voice
    • PaidMediaInfo
    • PaidMedia
    • PaidMediaPreview
    • PaidMediaPhoto
    • PaidMediaVideo
    • Contact
    • Dice
    • PollOption
    • InputPollOption
    • Poll
    • PollAnswer
    • Location
    • Venue
    • Gift
    • ReceivedGift
    • UpgradedGift
    • WebAppData
    • MessageAutoDeleteTimerChanged
    • ChatBoostAdded
    • ChatBackground
    • Game
    • GiftCode
    • GiftedPremium
    • GiftedStars
    • Giveaway
    • GiveawayCreated
    • GiveawayCompleted
    • GiveawayWinners
    • MessageEffect
    • MessageReactionCountUpdated
    • MessageReactionUpdated
    • MessageReactions
    • Reaction
    • ReactionCount
    • ReactionType
    • ReactionTypeEmoji
    • ReactionTypeCustomEmoji
    • ReactionTypePaid
    • Thumbnail
    • TranslatedText
    • StrippedThumbnail
    • SponsoredMessage
    • Sticker
    • WebPage
    • ContactRegistered
    • ScreenshotTaken
    • DraftMessage
    • Birthdate
    • User
    • Chat
    • Username
    • ChatShared
    • WriteAccessAllowed
    • UsersShared
    • ChatAdminWithInviteLinks
    • ChatColor
    • ChatEvent
    • ChatEventFilter
    • ChatInviteLink
    • ChatJoiner
    • ChatJoinRequest
    • ChatMember
    • ChatMemberUpdated
    • ChatPermissions
    • ChatPhoto
    • ChatPrivileges
    • ChatReactions
    • VideoChatScheduled
    • VideoChatStarted
    • VideoChatEnded
    • VideoChatParticipantsInvited
    • PaidMessagePriceChanged
    • PaidMessagesRefunded
    • Dialog
    • EmojiStatus
    • GroupCallParticipant
    • InviteLinkImporter
    • Restriction
    • RtmpUrl
    • CallbackGame
    • CallbackQuery
    • CopyTextButton
    • ForceReply
    • GameHighScore
    • InlineKeyboardButton
    • InlineKeyboardMarkup
    • KeyboardButton
    • KeyboardButtonPollType
    • KeyboardButtonPollTypeRegular
    • KeyboardButtonPollTypeQuiz
    • KeyboardButtonRequestChat
    • KeyboardButtonRequestUsers
    • ReplyKeyboardMarkup
    • ReplyKeyboardRemove
    • LoginUrl
    • WebAppInfo
    • MenuButton
    • MenuButtonCommands
    • MenuButtonWebApp
    • MenuButtonDefault
    • SentWebAppMessage
    • SwitchInlineQueryChosenChat
    • BotCommand
    • BotCommandScope
    • BotCommandScopeAllChatAdministrators
    • BotCommandScopeAllGroupChats
    • BotCommandScopeAllPrivateChats
    • BotCommandScopeChat
    • BotCommandScopeChatAdministrators
    • BotCommandScopeChatMember
    • BotCommandScopeDefault
    • ForumTopic
    • ForumTopicCreated
    • ForumTopicClosed
    • ForumTopicEdited
    • ForumTopicReopened
    • GeneralForumTopicHidden
    • GeneralForumTopicUnhidden
    • InputMedia
    • InputMediaPhoto
    • InputMediaVideo
    • InputMediaAudio
    • InputMediaAnimation
    • InputMediaDocument
    • InputPhoneContact
    • LinkPreviewOptions
    • InputPaidMedia
    • InputPaidMediaPhoto
    • InputPaidMediaVideo
    • PaidMediaPurchased
    • ChosenInlineResult
    • InlineQuery
    • InlineQueryResult
    • InlineQueryResultCachedAnimation
    • InlineQueryResultCachedAudio
    • InlineQueryResultCachedDocument
    • InlineQueryResultCachedPhoto
    • InlineQueryResultCachedSticker
    • InlineQueryResultCachedVideo
    • InlineQueryResultCachedVoice
    • InlineQueryResultAnimation
    • InlineQueryResultAudio
    • InlineQueryResultDocument
    • InlineQueryResultPhoto
    • InlineQueryResultVideo
    • InlineQueryResultVoice
    • InlineQueryResultArticle
    • InlineQueryResultContact
    • InlineQueryResultGame
    • InlineQueryResultLocation
    • InlineQueryResultVenue
    • InputMessageContent
    • InputTextMessageContent
    • InputLocationMessageContent
    • InputVenueMessageContent
    • InputContactMessageContent
    • InputInvoiceMessageContent
    • ActiveSession
    • ActiveSessions
    • SentCode
    • TermsOfService
    • BusinessBotRights
    • BusinessConnection
    • BusinessIntro
    • BusinessLocation
    • BusinessOpeningHours
    • BusinessOpeningHoursInterval
    • CollectibleItemInfo
    • LabeledPrice
    • Invoice
    • ShippingAddress
    • OrderInfo
    • ShippingOption
    • PaymentForm
    • SuccessfulPayment
    • RefundedPayment
    • ShippingQuery
    • PreCheckoutQuery
    • StarAmount
    • PaidReactionType
    • PaidReactionTypeAnonymous
    • PaidReactionTypeChat
    • PaidReactionTypeRegular
  • Bound Methods
    • click
    • delete
    • download
    • forward
    • copy
    • pin
    • unpin
    • edit
    • edit_text
    • edit_cached_media
    • edit_caption
    • edit_media
    • edit_reply_markup
    • reply
    • reply_text
    • reply_animation
    • reply_audio
    • reply_cached_media
    • reply_chat_action
    • reply_contact
    • reply_document
    • reply_game
    • reply_inline_bot_result
    • reply_location
    • reply_media_group
    • reply_photo
    • reply_poll
    • reply_sticker
    • reply_venue
    • reply_video
    • reply_video_note
    • reply_voice
    • reply_invoice
    • get_media_group
    • react
    • read
    • view
    • translate
    • pay
    • star
    • toggle
    • download
    • archive
    • unarchive
    • set_title
    • set_description
    • set_photo
    • ban_member
    • unban_member
    • restrict_member
    • promote_member
    • get_member
    • get_members
    • add_members
    • join
    • leave
    • mark_unread
    • set_protected_content
    • unpin_all_messages
    • set_message_auto_delete_time
    • archive
    • unarchive
    • block
    • unblock
    • answer
    • edit_message_text
    • edit_message_caption
    • edit_message_media
    • edit_message_reply_markup
    • edit_message_text
    • edit_message_caption
    • edit_message_media
    • edit_message_reply_markup
    • answer
    • answer
    • answer
    • approve
    • decline
    • react
    • download
    • terminate
  • Enumerations
    • ChatAction
    • ChatEventAction
    • ChatMemberStatus
    • ChatMembersFilter
    • ChatType
    • ChatJoinType
    • ClientPlatform
    • MessageEntityType
    • MessageMediaType
    • MessageOriginType
    • MessageServiceType
    • MessagesFilter
    • ParseMode
    • PollType
    • ProfileColor
    • AccentColor
    • SentCodeType
    • NextCodeType
    • UserStatus
  • Update Handlers
  • Decorators
  • RPC Errors
    • 303 - SeeOther
    • 400 - BadRequest
    • 401 - Unauthorized
    • 403 - Forbidden
    • 406 - NotAcceptable
    • 420 - Flood
    • 500 - InternalServerError
  • Update Filters

Topic Guides

  • Using Filters
  • Creating Filters
  • More on Updates
  • Client Settings
  • Speedups
  • Text Formatting
  • Storage Engines
  • Synchronous Usage
  • Smart Plugins
  • Object Serialization
  • Proxy Settings
  • Scheduling Tasks
  • MTProto vs. Bot API
  • Debugging
  • Test Servers
  • Message identifiers
  • Advanced Usage
  • Voice Calls

Meta

  • Frequently Asked Questions
    • Why is the API key needed for bots?
    • How to use webhooks?
    • Using the same file_id across different accounts
    • Using multiple clients at once on the same account
    • Client started, but nothing happens
    • What are the IP addresses of Telegram Data Centers?
    • Migrating the account to another data center
    • Why is the client reacting slowly in supergroups/channels?
    • PEER_ID_INVALID error
    • Code hangs when calling stop, restart, add/remove_handler
    • UnicodeEncodeError: ‘…’ codec can’t encode …
    • Uploading with URLs gives error WEBPAGE_CURL_FAILED
    • sqlite3.OperationalError: database is locked
    • sqlite3.InterfaceError: Error binding parameter
    • socket.send(), OSError(), TimeoutError(), Connection lost/reset
    • How to avoid Flood Waits?
    • The account has been limited/deactivated
  • Release Notes

Telegram Raw API

  • Raw Functions
  • Raw Types
  • Raw Base

External Links

  • TL Schema Explorer
  • TL Diff
View on GitHub
Star
Back to top

export_chat_invite_link()#

Client.export_chat_invite_link()#

Generate a new primary invite link for a chat; any previously generated primary link is revoked.

You must be an administrator in the chat for this to work and must have the appropriate admin rights.

Note

Each administrator in a chat generates their own invite links. Bots can’t use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using this method – after this the link will become available to the bot via the get_chat() method. If your bot needs to generate a new invite link replacing its previous one, use this method again.

Usable by Users Bots
Parameters:

chat_id (int | str) – Unique identifier for the target chat or username of the target channel/supergroup (in the format @username).

Returns:

str – On success, the new invite link as string is returned.

Example

# Generate a new primary link
link = await app.export_chat_invite_link(chat_id)
Next
create_chat_invite_link()
Previous
transfer_chat_ownership()
Made with Sphinx and @pradyunsg's Furo
On this page
  • export_chat_invite_link()
    • Client.export_chat_invite_link()