Available methods

createChatInviteLink()

Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.

parameters

parametertyperequireddescription
chat_idnumber | stringrequiredUnique identifier for the target chat or username of the target channel in the format @username
namestringoptionalInvite link name; 0-32 characters
expire_datenumberoptionalPoint in time (Unix timestamp) when the link will expire
member_limitnumberoptionalThe maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
creates_join_requestbooleanoptionalTrue, 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

usage in yaebal

not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.

bot.ts
import type { ChatInviteLink, CreateChatInviteLinkParams } from "@yaebal/types";

await bot.api.call<ChatInviteLink>("createChatInviteLink", {
  chat_id: 123456789,
} satisfies CreateChatInviteLinkParams);

context shortcut

also available as ctx.createChatInviteLink() on 16 context types — see @yaebal/contexts.

context shortcut
/** Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method [revokeChatInviteLink](https://core.telegram.org/bots/api/#revokechatinvitelink). Returns the new invite link as [ChatInviteLink](https://core.telegram.org/bots/api/#chatinvitelink) object. */
ctx.createChatInviteLink(params: Omit<CreateChatInviteLinkParams, "chat_id">)