Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram has stopped sending SMS code. #3835

Closed
3 tasks done
Subachev opened this issue May 25, 2022 · 10 comments
Closed
3 tasks done

Telegram has stopped sending SMS code. #3835

Subachev opened this issue May 25, 2022 · 10 comments

Comments

@Subachev
Copy link

Subachev commented May 25, 2022

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't a duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.

Code that causes the issue

self.telethon_client = TelegramClient(
            StringSession(),
            self.device_data.api_id,
            self.device_data.api_hash,
            proxy=self.proxy_data.tg_proxy,
            device_model=self.device_data.device_model,
            app_version=self.device_data.app_version,
            system_version=self.device_data.system_version,
        )
        self.telethon_client.start(
            first_name=first_name,
            last_name=last_name,
            phone=lambda: phone_number,
            force_sms=True,
            max_attempts=2,
        )
...

For a long time everything worked fine, but yesterday we ran into a problem. SMS messages stopped being sent from telegram. At all.
We used various proxies, api_id/api_hash, phone numbers (mostly +7 and a little +1).
There is no error or warning. Everything is as usual. But telegram just doesn't send SMS.

We tried to send the SMS code immediately using the send_code_request method. The result is the same.

@Lonami
Copy link
Member

Lonami commented May 25, 2022

The library is making the requests to Telegram for it to send the SMS. If Telegram isn't sending the SMS even after it was requested to do so, it probably has its own reasons (avoid spam), and Telethon can likely do nothing about it.

@w1ld32
Copy link

w1ld32 commented May 27, 2022

I have been trying to solve this problem for 3 days. But to no avail. Codes come from official apps, but not from the telethon(

@Lonami
Copy link
Member

Lonami commented May 27, 2022

This might be Telegram's anti-spam measures. There is not much that can be done by Telethon to mitigate this.

@w1ld32
Copy link

w1ld32 commented May 27, 2022

The codes do not even come to the official Telegram client on the PC. Not for any major third-party client (Telegram X, X Chat). The problem is definitely not in the Thelethon, but I want to solve it somehow (

@ZE1L
Copy link

ZE1L commented Jun 3, 2022

works fine for me, uninstall telethon and reinstall it

@Lonami
Copy link
Member

Lonami commented Sep 20, 2022

Closing since this is not something Telethon can fix. It's just the way Telegram decides to work. Telethon is making the necessary requests for Telegram to send the code, but if it still doesn't, well, then Telegram is simply ignoring the request Telethon made.

@Lonami Lonami closed this as completed Sep 20, 2022
@dumpload
Copy link

Try to send SMS verification or verification code, it may be sent successfully, the possibility is very small, this problem may be the problem of tg node

@Lonami
Copy link
Member

Lonami commented Oct 30, 2022

Also duplicate of #3822.

@Lonami
Copy link
Member

Lonami commented Oct 30, 2022

And #3697, and #3719, and probably a few others.

@Lonami
Copy link
Member

Lonami commented Feb 20, 2023

On the 10th of February, Telegram sent this message to those with an application registered on https://my.telegram.org:

Telegram API Update. Hello ▒▒▒▒,. Thank you for contributing to the open Telegram ecosystem by developing your app, ▒▒▒▒.

Please note that due to recent updates to Telegram's handling of SMS and the integration of new SMS providers like Firebase, we are changing the way login codes are handled in third-party apps based on the Telegram API.

Starting on 18.02.2023, users logging into third-party apps will only be able to receive login codes via Telegram. It will no longer be possible to request an SMS to log into your app – just like when logging into Telegram's own desktop and web clients.

Exactly like with the Telegram Desktop and Web apps, if a user doesn’t have a Telegram account yet, they will need to create one first using an official mobile Telegram app.

We kindly ask you to update your app’s login and signup interfaces to reflect these changes before they go live on 18.02.2023 at 13:00 UTC.

This change will not significantly affect users since, according to our research, the vast majority of third-party app users also use official Telegram apps. In the coming months, we expect to offer new tools for third-party developers that will help streamline the login process.

What this means for Telethon:

  • You can no longer use Telethon to sign up.
  • You will only be able to receive the code via Telegram. Not SMS.

Why has Telegram done this? Probably in an attempt to reduce spam, and also because sending SMS is likely not cheap at their scale. Another possible reason may be security. We cannot know. Telethon cannot do anything to bypass these new limitations, and won't try playing tricks to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants