telegram-phone-number-checker
Python tool/script to check if phone numbers are connected to Telegram accounts. Retrieving username, name, and IDs where available.
⚠️ NB: We advise you not to use your personal account for automations as telegram may block it. A fresh account works best from residential IPs rather than known VPN IPs.
Installation
You can install this tool directly from the official pypi release.
pip install telegram-phone-number-checker
You can also install it and run it directly from GitHub as a script.
git clone https://github.com/bellingcat/telegram-phone-number-checker
cd telegram-phone-number-checker
pip install -r requirements.txt
python telegram-phone-number-checker/main.py
Requirements
To run it, you need:
- A Telegram account with an active phone number;
- Telegram
API_IDandAPI_HASH, which you can get by creating a developers account at https://my.telegram.org/. Place these values in a.envfile, along with the phone number of your Telegram account:
API_ID=
API_HASH=
PHONE_NUMBER=
If you don't create this file, you can also provide these 3 values when calling the tool, or even be prompted for them interactively.
Usage
Search by phone number
The tool accepts a comma-separated list of phone numbers to check, you can pass this when you call the tool, or interactively.
See the examples below:
# single phone number
telegram-phone-number-checker --phone-numbers +1234567890
# single phone number, download profile photo
telegram-phone-number-checker --phone-numbers +1234567890 --download-profile-photos
# multiple phone numbers
telegram-phone-number-checker --phone-numbers +1234567890,+9876543210,+111111111
# interactive version, you will be prompted for the phone-numbers
telegram-phone-number-checker
# overwrite the telegram API keys in .env (or if no .env is found)
telegram-phone-number-checker --api-id YOUR_API_KEY --api-hash YOUR_API_HASH --api-phone-number YOUR_PHONE_NUMBER --phone-numbers +1234567890
Search by Username
You can also search by Telegram username(s):
# single username
telegram-phone-number-checker --usernames john
# multiple usernames
telegram-phone-number-checker --usernames john,jane
# combine phone numbers and usernames
telegram-phone-number-checker --phone-numbers +1234567890 --usernames johndoe
# with profile photo download
telegram-phone-number-checker --usernames johndoe --download-profile-photos
The result will be written to the console but also written as JSON to a results.json file, you can write it to another file by adding --output your_filename.json to the command.
Connecting through a proxy
If you need to connect through a SOCKS5/SOCKS4/HTTP proxy (for example, to avoid
using a known VPN/datacenter IP - see the warning above), install the optional
proxy extra and pass --proxy:
pip install telegram-phone-number-checker[proxy]
telegram-phone-number-checker --phone-numbers +1234567890 --proxy socks5://user:pass@127.0.0.1:1080
The proxy can also be set via the PROXY environment variable or in your .env file.
For each phone number or username, you can expect the following possible responses:
- If available, you will receive the Telegram Username, Name, and ID that are connected with this number.
- 'no username detected'. This means that it looks like the number was used to create a Telegram account but the user did not choose a Telegram Username. It is optional to create a Username on Telegram.
- 'ERROR: no response, the user does not exist or has blocked contact adding.': There can be several reasons for this response. Either the phone number has not been used to create a Telegram account. Or: The phone number is connected to a Telegram account but the user has restricted the option to find him/her via the phone number.
- For username searches: The username may not exist, or it may belong to a channel/group rather than a user account. In the latter case, an output such as '@group_name is a channel or supergroup ('Group'), not a user account. This tool is for searching user accounts only'
- Or: another error occurred.
Development
This section describes how to install the project in order to run it locally, for example if you want to build new features.
# clone the code
git clone https://github.com/bellingcat/telegram-phone-number-checker
# move into the project's folder
cd telegram-phone-number-checker
This project uses poetry to manage dependencies. You can install dependencies via poetry, or use the up-to-date requirements.txt file.
# install poetry if you haven't already
pip install poetry
# with poetry
poetry install
# with pip
pip install -r requirements.txt
You can then run it with any of these:
# with poetry
poetry run telegram-phone-number-checker
# with pip installation
python3 telegram_phone_number_checker/main.py
Generating requirements.txt & requirements-dev.txt
Poetry is used to generate both of these files. requirements.txt contains only those dependencies necessary for
running the CLI. requirements-dev.txt contains all dependencies including those used for running tests, linters, etc.
To generate requirements.txt:
poetry export --output=requirements.txt --without-urls
To generate requirements-dev.txt:
poetry export --output=requirements-dev.txt --without-urls --with=dev
💡 --without-urls is for users who install from their own private package repository
instead of pypi.org
Metadata
Release files for telegram-phone-number-checker 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| telegram_phone_number_checker-1.2.2.tar.gz | 9.6 kB | Without provenance | Details for telegram_phone_number_checker-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| telegram_phone_number_checker-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for telegram_phone_number_checker-1.2.2-py3-none-any.whl |
Total release size: 20.5 kB
Release files / telegram_phone_number_checker-1.2.2.tar.gz
| Download URL | telegram_phone_number_checker-1.2.2.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba2c81c0bb4836a0db2c0f6f6125875a285ff2812ce60f0a1cf78715a6ca6ba9
|
|
BLAKE2b-256 checksum How to use checksums |
5f60fe469bef5c4a4c0b897a73ee6ff7454acc104ac6a0540a93cc4eda1aaccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.16 Linux/6.17.0-1022-azure
|
Release files / telegram_phone_number_checker-1.2.2-py3-none-any.whl
| Download URL | telegram_phone_number_checker-1.2.2-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3098315d2afabe56c776287c9c934c588c92659c966a8cf80487ec3a93a93f30
|
|
BLAKE2b-256 checksum How to use checksums |
1004c4df53382858797edbe0cf81836b22a355a377ddc7374505d0f4f26ad7bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.16 Linux/6.17.0-1022-azure
|
Security for telegram-phone-number-checker 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.