Skip to main content

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​

NameTypeRequiredDescription
LegacyRevokePermanentbool—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.
RequestNeededbool—Whether admin confirmation is required before admitting each separate user into the chat
PeerInputPeerClassyesChat
ExpireDateint—Expiration date
UsageLimitint—Maximum number of users that can join using this link
Titlestring—Description of the invite link, visible only to administrators
SubscriptionPricingStarsSubscriptionPricing—For Telegram Star subscriptions », contains the pricing of the subscription the user must activate to join the private channel.

Returns​

ExportedChatInviteClass

Possible errors​

CodeTypeDescription
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_MONOFORUM_UNSUPPORTEDMonoforums do not support this feature.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_ID_INVALIDThe provided chat id is invalid.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400EXPIRE_DATE_INVALIDThe specified expiration date is invalid.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.
400PRICING_CHAT_INVALIDThe pricing for the subscription is invalid, the maximum price is specified in the stars_subscription_amount_max config key ».
400SUBSCRIPTION_PERIOD_INVALIDThe specified subscription_pricing.period is invalid.
400USAGE_LIMIT_INVALIDThe specified usage limit is invalid.

References​