Skip to content
Back to top
View this page

# ChatInviteLink

class telegram.ChatInviteLink(invite_link, creator, creates_join_request, is_primary, is_revoked, expire_date=None, member_limit=None, name=None, pending_join_request_count=None, subscription_period=None, subscription_price=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object represents an invite link for a chat.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `invite_link`, `creator`, `creates_join_request`, `is_primary` and `is_revoked` are equal.

  Use In

  - `telegram.Bot.edit_chat_invite_link()`

  - `telegram.Bot.edit_chat_subscription_invite_link()`

  - `telegram.Bot.revoke_chat_invite_link()`

  Available In

  - `telegram.ChatJoinRequest.invite_link`

  - `telegram.ChatMemberUpdated.invite_link`

  Returned In

  - `telegram.Bot.create_chat_invite_link()`

  - `telegram.Bot.create_chat_subscription_invite_link()`

  - `telegram.Bot.edit_chat_invite_link()`

  - `telegram.Bot.edit_chat_subscription_invite_link()`

  - `telegram.Bot.revoke_chat_invite_link()`

  Added in version 13.4.

  Changed in version 20.0:

  - The argument & attribute `creates_join_request` is now required to comply with the Bot API.

  - Comparing objects of this class now also takes `creates_join_request` into account.

  Parameters:

    - invite_link (`str`) – The invite link.

    - creator (`telegram.User`) – Creator of the link.

    - creates_join_request (`bool`) –

      `True`, if users joining the chat via the link need to be approved by chat administrators.

      Added in version 13.8.

    - is_primary (`bool`) – `True`, if the link is primary.

    - is_revoked (`bool`) – `True`, if the link is revoked.

    - expire_date (`datetime.datetime`, optional) –

      Date when the link will expire or has been expired.

      Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    - 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`.

    - name (`str`, optional) –

      Invite link name. 0-`32` characters.

      Added in version 13.8.

    - pending_join_request_count (`int`, optional) –

      Number of pending join requests created using this link.

      Added in version 13.8.

    - subscription_period (`int` | `datetime.timedelta`, optional) –

      The number of seconds the subscription will be active for before the next payment.

      Added in version 21.5.

      Changed in version v22.2: `datetime.timedelta` objects are accepted in addition to plain `int` values.

    - subscription_price (`int`, optional) –

      The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link.

      Added in version 21.5.

  invite_link

    The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with `'…'`.

    Type:

      `str`

  creator

    Creator of the link.

    Type:

      `telegram.User`

  creates_join_request

    `True`, if users joining the chat via the link need to be approved by chat administrators.

    Added in version 13.8.

    Type:

      `bool`

  is_primary

    `True`, if the link is primary.

    Type:

      `bool`

  is_revoked

    `True`, if the link is revoked.

    Type:

      `bool`

  expire_date

    Optional. Date when the link will expire or has been expired.

    Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Type:

      `datetime.datetime`

  member_limit

    Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; `1`- `99999`.

    Type:

      `int`

  name

    Optional. Invite link name. 0-`32` characters.

    Added in version 13.8.

    Type:

      `str`

  pending_join_request_count

    Optional. Number of pending join requests created using this link.

    Added in version 13.8.

    Type:

      `int`

  subscription_period

    Optional. The number of seconds the subscription will be active for before the next payment.

    Added in version 21.5.

    Deprecated since version v22.2: In a future major version this attribute will be of type `datetime.timedelta`. You can opt-in early by setting PTB_TIMEDELTA=true or `PTB_TIMEDELTA=1` as an environment variable.

    Type:

      `int` | `datetime.timedelta`

  subscription_price

    Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link.

    Added in version 21.5.

    Type:

      `int`

  classmethod de_json(data, bot=None)

    See `telegram.TelegramObject.de_json()`.