create_chat_invite_link()

Create an additional invite link for a chat.

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

The link can be revoked using the method revoke_chat_invite_link().

Usable by Users Bots
  • chat_id (int | str) – Unique identifier for the target chat or username of the target channel/supergroup (in the format @username). You can also use chat public link in form of t.me/<username> (str).

  • name (str, optional) – Invite link name.

  • expire_date (datetime, optional) – Point in time when the link will expire. Defaults to None (no expiration date).

  • member_limit (int, optional) – Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999. Defaults to None (no member limit).

  • creates_join_request (bool, optional) – True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can’t be specified.

  • subscription_period (int, optional) – Date when the subscription will expire. for now, only 30 days is supported (30*24*60*60).

  • subscription_price (int, optional) – Subscription price (stars).

ChatInviteLink – On success, the new invite link is returned.

Example

# Create a new link without limits
link = await app.create_chat_invite_link(chat_id)

# Create a new link for up to 3 new users
link = await app.create_chat_invite_link(chat_id, member_limit=3)

# Create subcription link
link = await app.create_chat_invite_link(chat_id, subscription_period=60*24*60*60, subscription_price=1)