Skip to main content

channels.joinChannel

Join a channel/supergroup

func (c *Client) ChannelsJoinChannel(ctx context.Context, channel InputChannelClass) (MessagesChatInviteJoinResultClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
ChannelInputChannelClassyesChannel/supergroup to join

Returns

MessagesChatInviteJoinResultClass

Possible errors

CodeTypeDescription
400CHANNELS_TOO_MUCHYou have joined too many channels/supergroups.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_MONOFORUM_UNSUPPORTEDMonoforums do not support this feature.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_INVALIDInvalid chat.
420FROZEN_METHOD_INVALIDThe current account is frozen, and thus cannot execute the specified action.
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.
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