Logo
1.0.7

Introduction

  • Quick Start
  • Install Guide
  • Project Setup

Getting Started

  • Authorization
  • Calling Methods
  • Handling Updates
  • Error Handling
  • Examples

API Reference

  • Pyrogram Client
  • Available Methods
    • Utilities
    • Messages
    • Chats
      • join_chat
      • leave_chat
      • kick_chat_member
      • unban_chat_member
      • restrict_chat_member
      • promote_chat_member
      • set_administrator_title
      • export_chat_invite_link
      • 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
      • iter_chat_members
      • get_dialogs
      • iter_dialogs
      • get_dialogs_count
      • update_chat_username
      • get_common_chats
      • get_nearby_chats
      • archive_chats
      • unarchive_chats
      • add_chat_members
      • create_channel
      • create_group
      • create_supergroup
      • delete_channel
      • delete_supergroup
      • set_slow_mode
    • Users
    • Contacts
    • Password
    • Bots
    • Authorization
    • Advanced
  • Available Types
  • Bound Methods
  • Update Handlers
  • Decorators
  • RPC Errors
  • Update Filters

Topic Guides

  • Using Filters
  • Creating Filters
  • More on Updates
  • Configuration File
  • Smart Plugins
  • Session Settings
  • Fast Crypto
  • Storage Engines
  • Text Formatting
  • Object Serialization
  • SOCKS5 Proxy
  • Scheduling Tasks
  • Bots Interaction
  • MTProto vs. Bot API
  • Debugging
  • Test Servers
  • Advanced Usage
  • Voice Calls

Meta

  • Pyrogram FAQ
  • Pyrogram Glossary
  • Powered by Pyrogram
  • Support Pyrogram
  • About the License

Telegram API

  • Raw Functions
  • Raw Types
  • Raw Base
Pyrogram
  • »
  • Available Methods »
  • export_chat_invite_link()
  • View page source

export_chat_invite_link()¶

Client.export_chat_invite_link()¶

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

You must be an administrator in the chat for this to work and 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.

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 exported invite link is returned.

Raises

ValueError – In case the chat_id belongs to a user.

Example

link = app.export_chat_invite_link(chat_id)
print(link)
Next Previous

Built with Sphinx using a theme provided by Read the Docs.