SendChangePhoneCodeRequest

Only users can use this request. See code examples.

---functions---
account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode

Returns

auth.SentCode

This type can be an instance of either:

SentCodeSentCodeSuccess

Parameters

phone_numberstring
settingsCodeSettings

Known RPC errors

This request can cause 2 known errors:

FreshChangePhoneForbiddenErrorRecently logged-in users cannot use this request.
PhoneNumberInvalidErrorThe phone number is invalid.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.account.SendChangePhoneCodeRequest(
        phone_number='some string here',
        settings=types.CodeSettings(
            allow_flashcall=True,
            current_number=True,
            allow_app_hash=True,
            allow_missed_call=True,
            allow_firebase=True,
            unknown_number=True,
            logout_tokens=[b'arbitrary\x7f data \xfa here'],
            token='some string here',
            app_sandbox=False
        )
    ))
    print(result.stringify())