createInviteLink

Create an invite link.

Parameters

chatId: ID

The identifier of the chat to create the invite link for.

title?: string

An optional title to be attached to the link that can only be seen by admins.

expireAt?: Date

A point in time within the future in which the invite link will be invalidated.

limit?: number

The times the invite link can be used. Cannot be specified while requireApproval is true.

requireApproval?: boolean

Whether an admin must explicitly approve join requests originating from this invite link. Cannot be true while limit is specified.

Result

The newly created invite link.

Syntax

// Required parameters only.
await client.createInviteLink(chatId);

// Required parameters + optional parameters.
// Any of the optional parameters can be omitted.
await client.createInviteLink(chatId, {
    title,
    expireAt,
    limit,
    requireApproval,
});