editChatSubscriptionInviteLink
Returns: ChatInviteLinkOfficial docs ↗
Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
Parameters
chat_idIntegerStringRequiredUnique identifier for the target chat or username of the target channel (in the format
@channelusername)invite_linkStringRequiredThe invite link to edit
nameStringOptionalminLen 0maxLen 32Invite link name; 0-32 characters
Returns
On success, the ChatInviteLink object is returned.
GramIO Usage
ts
// Rename a subscription invite link
const updated = await bot.api.editChatSubscriptionInviteLink({
chat_id: "@mypaidchannel",
invite_link: "https://t.me/+abc123",
name: "Q2 Subscribers",
});
console.log(updated.name); // "Q2 Subscribers"
console.log(updated.invite_link); // same URL, just renamedts
// Clear the name by passing an empty string
const updated = await bot.api.editChatSubscriptionInviteLink({
chat_id: -1001234567890,
invite_link: "https://t.me/+abc123",
name: "",
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | Invalid or inaccessible chat_id — verify the bot is a member of the target chat |
| 400 | Bad Request: INVITE_HASH_EXPIRED | The subscription link is revoked or expired — create a new one with createChatSubscriptionInviteLink |
| 400 | Bad Request: INVITE_LINK_NAME_INVALID | name exceeds 32 characters |
| 400 | Bad Request: method not available for this chat type | Target chat doesn't support subscription invite links (only supergroups/channels do) |
| 403 | Forbidden: not enough rights | Bot lacks the can_invite_users administrator right |
| 403 | Forbidden: bot is not a member of the channel chat | Bot was removed from the chat |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after, use auto-retry plugin |
TIP
Use GramIO's auto-retry plugin to handle 429 errors automatically.
Tips & Gotchas
- Only the name can be edited on subscription links. The subscription price and period are fixed at creation time and cannot be changed via this method.
- Only bot-created subscription links can be edited. The link must have been created by the same bot calling this method.
nameaccepts 0–32 characters. Passing an empty string clears the label entirely.- Bot must have
can_invite_usersadmin right. Other administrator permissions don't imply this right — it must be explicitly granted. chat_idaccepts@usernamestrings for public channels. Private chats require the numeric ID.
See Also
createChatSubscriptionInviteLink— Create a new subscription invite linkeditChatInviteLink— Edit a regular (non-subscription) invite linkrevokeChatInviteLink— Revoke a bot-created invite linkcreateChatInviteLink— Create a regular additional invite linkChatInviteLink— The return type of this method