create_chat_invite_link()#
- Client.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- Parameters:
chat_id (
int
|str
) – Unique identifier for the target chat or username of the target channel/supergroup (in the format @username).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.
- Returns:
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)