Skip to main content

auth.signUp

Registers a validated phone number in the system.

func (c *Client) AuthSignUp(ctx context.Context, request *AuthSignUpRequest) (AuthAuthorizationClass, error)

Calling this method

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

res, err := api.AuthSignUp(ctx, &tg.AuthSignUpRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // AuthAuthorizationClass
return nil
})

Parameters

NameTypeRequiredDescription
NoJoinedNotificationsboolIf set, users on Telegram that have already added phone_number to their contacts will not receive signup notifications about this user.
PhoneNumberstringyesPhone number in the international format
PhoneCodeHashstringyesSMS-message ID
FirstNamestringyesNew user first name
LastNamestringyesNew user last name

Returns

AuthAuthorizationClass

Possible errors

CodeTypeDescription
400FIRSTNAME_INVALIDThe first name is invalid.
400LASTNAME_INVALIDThe last name is invalid.
400PHONE_CODE_EMPTYphone_code is missing.
400PHONE_CODE_EXPIREDThe phone code you provided has expired.
400PHONE_CODE_INVALIDThe provided phone code is invalid.
400PHONE_NUMBER_FLOODYou asked for the code too many times.
406PHONE_NUMBER_INVALIDThe phone number is invalid.
400PHONE_NUMBER_OCCUPIEDThe phone number is already in use.

References