Skip to main content

messages.importChatInvite

Import a chat invite and join a private chat/supergroup/channel

func (c *Client) MessagesImportChatInvite(ctx context.Context, hash string) (MessagesChatInviteJoinResultClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesImportChatInvite(ctx, hash)
if err != nil {
return err
}
_ = res // MessagesChatInviteJoinResultClass
return nil
})

Parameters

NameTypeRequiredDescription
Hashstringyeshash from a chat invite deep link

Returns

MessagesChatInviteJoinResultClass

Possible errors

CodeTypeDescription
400CHANNELS_TOO_MUCHYou have joined too many channels/supergroups.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_INVALIDInvalid chat.
400INVITE_HASH_EMPTYThe invite hash is empty.
406INVITE_HASH_EXPIREDThe invite link has expired.
400INVITE_HASH_INVALIDThe invite hash is invalid.
400INVITE_REQUEST_SENTYou have successfully requested to join this chat or channel.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.
400STARS_PAYMENT_REQUIREDTo import this chat invite link, you must first pay for the associated Telegram Star subscription ».
400USERS_TOO_MUCHThe maximum number of users has been exceeded (to create a chat, for example).
400USER_ALREADY_PARTICIPANTThe user is already in the group.
400USER_CHANNELS_TOO_MUCHOne of the users you tried to add is already in too many channels/supergroups.

References