Available methods

createChatSubscriptionInviteLink()

Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

parameters

parametertyperequireddescription
chat_idnumber | stringrequiredUnique identifier for the target channel chat or username of the target channel in the format @username
namestringoptionalInvite link name; 0-32 characters
subscription_periodnumberrequiredThe number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
subscription_pricenumberrequiredThe amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000

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, CreateChatSubscriptionInviteLinkParams } from "@yaebal/types";

await bot.api.call<ChatInviteLink>("createChatSubscriptionInviteLink", {
  chat_id: 123456789,
  subscription_period: 1,
  subscription_price: 1,
} satisfies CreateChatSubscriptionInviteLinkParams);

context shortcut

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

context shortcut
/** Use this method to create a [subscription invite link](https://telegram.org/blog/superchannels-star-reactions-subscriptions#star-subscriptions) for a channel chat. The bot must have the *can\_invite\_users* administrator rights. The link can be edited using the method [editChatSubscriptionInviteLink](https://core.telegram.org/bots/api/#editchatsubscriptioninvitelink) or revoked using the method [revokeChatInviteLink](https://core.telegram.org/bots/api/#revokechatinvitelink). Returns the new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api/#chatinvitelink) object. */
ctx.createChatSubscriptionInviteLink(params: Omit<CreateChatSubscriptionInviteLinkParams, "chat_id">)