messages.exportChatInvite
Export an invite link for a chat
func (c *Client) MessagesExportChatInvite(ctx context.Context, request *MessagesExportChatInviteRequest) (ExportedChatInviteClass, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.MessagesExportChatInvite(ctx, &tg.MessagesExportChatInviteRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // ExportedChatInviteClass
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
LegacyRevokePermanent | bool | — | Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. |
RequestNeeded | bool | — | Whether admin confirmation is required before admitting each separate user into the chat |
Peer | InputPeerClass | yes | Chat |
ExpireDate | int | — | Expiration date |
UsageLimit | int | — | Maximum number of users that can join using this link |
Title | string | — | Description of the invite link, visible only to administrators |
SubscriptionPricing | StarsSubscriptionPricing | — | For Telegram Star subscriptions », contains the pricing of the subscription the user must activate to join the private channel. |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHANNEL_INVALID | The provided channel is invalid. |
| 400 | CHANNEL_MONOFORUM_UNSUPPORTED | Monoforums do not support this feature. |
| 400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 400 | CHAT_ADMIN_REQUIRED | You must be an admin in this chat to do this. |
| 400 | CHAT_ID_INVALID | The provided chat id is invalid. |
| 403 | CHAT_WRITE_FORBIDDEN | You can't write in this chat. |
| 400 | EXPIRE_DATE_INVALID | The specified expiration date is invalid. |
| 400 | INPUT_USER_DEACTIVATED | The specified user was deleted. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
| 400 | PRICING_CHAT_INVALID | The pricing for the subscription is invalid, the maximum price is specified in the stars_subscription_amount_max config key ». |
| 400 | SUBSCRIPTION_PERIOD_INVALID | The specified subscription_pricing.period is invalid. |
| 400 | USAGE_LIMIT_INVALID | The specified usage limit is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
messages.exportChatInvite#a455de90