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
| parameter | type | required | description |
|---|---|---|---|
chat_id | number | string | required | Unique identifier for the target channel chat or username of the target channel in the format @username |
name | string | optional | Invite link name; 0-32 characters |
subscription_period | number | required | The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). |
subscription_price | number | required | The 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
usage in yaebal
not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.
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.
/** 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">)official Bot API docs: https://core.telegram.org/bots/api/#createchatsubscriptioninvitelink