Link Search Menu Expand Document

Method: account.changePhone

Back to methods index

Change the phone number of the current account

Parameters:

NameTypeDescriptionRequired
phone_numberstringNew phone numberOptional
phone_code_hashstringPhone code hash received when calling account.sendChangePhoneCodeOptional
phone_codestringPhone code received when calling account.sendChangePhoneCodeOptional

Return type: User

Can userbots use this method: YES

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$User = $MadelineProto->account->changePhone(phone_number: 'string', phone_code_hash: 'string', phone_code: 'string', );