Skip to main content

account.changePhone

Change the phone number of the current account

func (c *Client) AccountChangePhone(ctx context.Context, request *AccountChangePhoneRequest) (UserClass, error)

Calling this method

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

res, err := api.AccountChangePhone(ctx, &tg.AccountChangePhoneRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UserClass
return nil
})

Parameters

NameTypeRequiredDescription
PhoneNumberstringyesNew phone number
PhoneCodeHashstringyesPhone code hash received when calling account.sendChangePhoneCode
PhoneCodestringyesPhone code received when calling account.sendChangePhoneCode

Returns

UserClass

Possible errors

CodeTypeDescription
400PHONE_CODE_EMPTYphone_code is missing.
400PHONE_CODE_EXPIREDThe phone code you provided has expired.
400PHONE_CODE_INVALIDThe provided phone code is invalid.
406PHONE_NUMBER_INVALIDThe phone number is invalid.
400PHONE_NUMBER_OCCUPIEDThe phone number is already in use.

References