Contents Menu Expand Light mode Dark mode Auto light/dark mode
Pyrogram
Logo
Pyrogram

Introduction

  • Quick Start
  • Install Guide

Getting Started

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

API Reference

  • Pyrogram Client
  • Available Methods
    • start
    • stop
    • run
    • restart
    • add_handler
    • remove_handler
    • stop_transmission
    • export_session_string
    • set_parse_mode
    • idle()
    • compose()
    • send_message
    • forward_messages
    • copy_message
    • copy_media_group
    • send_photo
    • send_audio
    • send_document
    • send_sticker
    • send_video
    • send_animation
    • send_voice
    • send_video_note
    • send_media_group
    • send_location
    • send_venue
    • send_contact
    • send_cached_media
    • send_reaction
    • edit_message_text
    • edit_message_caption
    • edit_message_media
    • edit_message_reply_markup
    • edit_inline_text
    • edit_inline_caption
    • edit_inline_media
    • edit_inline_reply_markup
    • send_chat_action
    • delete_messages
    • get_messages
    • get_media_group
    • get_chat_history
    • get_chat_history_count
    • read_chat_history
    • send_poll
    • vote_poll
    • stop_poll
    • retract_vote
    • send_dice
    • search_messages
    • search_messages_count
    • search_global
    • search_global_count
    • download_media
    • stream_media
    • get_discussion_message
    • get_discussion_replies
    • get_discussion_replies_count
    • get_custom_emoji_stickers
    • join_chat
    • leave_chat
    • ban_chat_member
    • unban_chat_member
    • restrict_chat_member
    • promote_chat_member
    • set_administrator_title
    • set_chat_photo
    • delete_chat_photo
    • set_chat_title
    • set_chat_description
    • set_chat_permissions
    • pin_chat_message
    • unpin_chat_message
    • unpin_all_chat_messages
    • get_chat
    • get_chat_member
    • get_chat_members
    • get_chat_members_count
    • 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
    • mark_chat_unread
    • get_chat_event_log
    • get_chat_online_count
    • get_send_as_chats
    • set_send_as_chat
    • set_chat_protected_content
    • get_me
    • get_users
    • get_chat_photos
    • get_chat_photos_count
    • set_profile_photo
    • delete_profile_photos
    • set_username
    • update_profile
    • block_user
    • unblock_user
    • get_common_chats
    • get_default_emoji_statuses
    • set_emoji_status
    • get_chat_invite_link
    • export_chat_invite_link
    • create_chat_invite_link
    • edit_chat_invite_link
    • revoke_chat_invite_link
    • delete_chat_invite_link
    • get_chat_invite_link_joiners
    • get_chat_invite_link_joiners_count
    • get_chat_admin_invite_links
    • get_chat_admin_invite_links_count
    • get_chat_admins_with_invite_links
    • get_chat_join_requests
    • delete_chat_admin_invite_links
    • approve_chat_join_request
    • approve_all_chat_join_requests
    • decline_chat_join_request
    • decline_all_chat_join_requests
    • add_contact
    • delete_contacts
    • import_contacts
    • get_contacts
    • get_contacts_count
    • enable_cloud_password
    • change_cloud_password
    • remove_cloud_password
    • get_inline_bot_results
    • send_inline_bot_result
    • answer_callback_query
    • answer_inline_query
    • request_callback_answer
    • send_game
    • set_game_score
    • get_game_high_scores
    • set_bot_commands
    • get_bot_commands
    • delete_bot_commands
    • set_bot_default_privileges
    • get_bot_default_privileges
    • set_chat_menu_button
    • get_chat_menu_button
    • answer_web_app_query
    • connect
    • disconnect
    • initialize
    • terminate
    • send_code
    • resend_code
    • sign_in
    • sign_in_bot
    • sign_up
    • get_password_hint
    • check_password
    • send_recovery_code
    • recover_password
    • accept_terms_of_service
    • log_out
    • invoke
    • resolve_peer
    • save_file
  • Available Types
    • User
    • Chat
    • ChatPreview
    • ChatPhoto
    • ChatMember
    • ChatPermissions
    • ChatPrivileges
    • ChatInviteLink
    • ChatAdminWithInviteLinks
    • ChatEvent
    • ChatEventFilter
    • ChatMemberUpdated
    • ChatJoinRequest
    • ChatJoiner
    • Dialog
    • Restriction
    • EmojiStatus
    • Message
    • MessageEntity
    • Photo
    • Thumbnail
    • Audio
    • Document
    • Animation
    • Video
    • Voice
    • VideoNote
    • Contact
    • Location
    • Venue
    • Sticker
    • Game
    • WebPage
    • Poll
    • PollOption
    • Dice
    • Reaction
    • VideoChatScheduled
    • VideoChatStarted
    • VideoChatEnded
    • VideoChatMembersInvited
    • WebAppData
    • MessageReactions
    • ChatReactions
    • ReplyKeyboardMarkup
    • KeyboardButton
    • ReplyKeyboardRemove
    • InlineKeyboardMarkup
    • InlineKeyboardButton
    • LoginUrl
    • ForceReply
    • CallbackQuery
    • GameHighScore
    • CallbackGame
    • WebAppInfo
    • MenuButton
    • MenuButtonCommands
    • MenuButtonWebApp
    • MenuButtonDefault
    • SentWebAppMessage
    • BotCommand
    • BotCommandScope
    • BotCommandScopeDefault
    • BotCommandScopeAllPrivateChats
    • BotCommandScopeAllGroupChats
    • BotCommandScopeAllChatAdministrators
    • BotCommandScopeChat
    • BotCommandScopeChatAdministrators
    • BotCommandScopeChatMember
    • InputMedia
    • InputMediaPhoto
    • InputMediaVideo
    • InputMediaAudio
    • InputMediaAnimation
    • InputMediaDocument
    • InputPhoneContact
    • InlineQuery
    • InlineQueryResult
    • InlineQueryResultCachedAudio
    • InlineQueryResultCachedDocument
    • InlineQueryResultCachedAnimation
    • InlineQueryResultCachedPhoto
    • InlineQueryResultCachedSticker
    • InlineQueryResultCachedVideo
    • InlineQueryResultCachedVoice
    • InlineQueryResultArticle
    • InlineQueryResultAudio
    • InlineQueryResultContact
    • InlineQueryResultDocument
    • InlineQueryResultAnimation
    • InlineQueryResultLocation
    • InlineQueryResultPhoto
    • InlineQueryResultVenue
    • InlineQueryResultVideo
    • InlineQueryResultVoice
    • ChosenInlineResult
    • InputMessageContent
    • InputTextMessageContent
    • SentCode
    • TermsOfService
  • Bound Methods
    • click
    • delete
    • download
    • forward
    • copy
    • pin
    • unpin
    • edit
    • edit_text
    • 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
    • get_media_group
    • react
    • 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
    • archive
    • unarchive
    • block
    • unblock
    • answer
    • edit_message_text
    • edit_message_caption
    • edit_message_media
    • edit_message_reply_markup
    • answer
    • approve
    • decline
  • Enumerations
    • ChatAction
    • ChatEventAction
    • ChatMemberStatus
    • ChatMembersFilter
    • ChatType
    • MessageEntityType
    • MessageMediaType
    • MessageServiceType
    • MessagesFilter
    • ParseMode
    • PollType
    • 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
  • Synchronous Usage
  • Smart Plugins
  • Storage Engines
  • Object Serialization
  • Proxy Settings
  • Scheduling Tasks
  • MTProto vs. Bot API
  • Debugging
  • Test Servers
  • Advanced Usage

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
    • Pyrogram v2.0
    • v1 Releases
      • Pyrogram v1.4
      • Pyrogram v1.3
      • Pyrogram v1.2
      • Pyrogram v1.1
      • Pyrogram v1.0
    • v0 Releases
      • Pyrogram v0.18.0
      • Pyrogram v0.17.1
      • Pyrogram v0.17.0
      • Pyrogram v0.16.0
      • Pyrogram v0.15.1
      • Pyrogram v0.14.1
      • Pyrogram v0.13.0
      • Pyrogram v0.12.0
      • Pyrogram v0.11.0
      • Pyrogram v0.10.3
      • Pyrogram v0.10.2
      • Pyrogram v0.9.3
      • Pyrogram v0.9.1
      • Pyrogram v0.9.0
      • Pyrogram v0.8.0
      • Pyrogram v0.7.5
      • Pyrogram v0.7.4
      • Pyrogram v0.7.3
      • Pyrogram v0.7.2
      • Pyrogram v0.7.1
      • Pyrogram v0.6.5
      • Pyrogram v0.6.3
      • Pyrogram v0.6.2
      • Pyrogram v0.6.1
      • Pyrogram v0.6.0
      • Pyrogram v0.5.0
      • Pyrogram v0.4.2

Telegram Raw API

  • Raw Functions
  • Raw Types
  • Raw Base
Pyrogram — version 2.0
  • Home »
  • Available Methods »
  • export_chat_invite_link()
View on GitHub
Star
Used by
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)
Consider disabling your ad-blocker on this site to support Pyrogram
Next
 
 
Previous
Pyrogram Copyright 2017 – , Dan
Released under the GNU LGPL v3.0 license
Support Pyrogram
On this page
  • export_chat_invite_link()
    • Client.export_chat_invite_link()