Telegram Loader
pip install llama-index-readers-telegram
This loader fetches posts/chat messages/comments from Telegram channels or chats into Documents.
Before working with Telegram’s API, you need to get your own API ID and hash:
- Login to your Telegram account with the phone number of the developer account to use.
- Click under API Development tools.
- A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.
- Click on Create application at the end. Remember that your API hash is secret and Telegram won’t let you revoke it. Don’t post it anywhere!
This API ID and hash is the one used by your application, not your phone number. You can use this API ID and hash with any phone number.
Usage
The first parameter you pass to the constructor of the TelegramReader is the session_name, and defaults to be the session name (or full path). That is, if you create a TelegramReader(session_name='anon', ...) instance and run load_data(), an anon.session file will be created in the working directory where you run this loader.
The Auth procedure asks for:
- Security Code
- Password
Please enter the code you received: 12345
Please enter your password: *******
(You are now logged in)
If the .session file already existed, it will not login again, so be aware of this if you move or rename the file! See here for more instructions.
To use this loader, you simply need to pass in a entity name.
from llama_index.readers.telegram import TelegramReader
loader = TelegramReader(
session_name="[YOUR_SESSION_NAME]",
api_id="[YOUR_API_ID]",
api_hash="[YOUR_API_HASH]",
phone_number="[YOUR_PHONE_NUMBER]",
)
documents = loader.load_data(
entity_name="https://t.me/[ENTITY_NAME]", limit=100
)
Examples
This loader is designed to be used as a way to load data into LlamaIndex.
Metadata
Release files for llama-index-readers-telegram 0.6.0
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 |
|---|---|---|---|---|
| llama_index_readers_telegram-0.6.0.tar.gz | 5.2 kB | Without provenance | Details for llama_index_readers_telegram-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_readers_telegram-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_readers_telegram-0.6.0-py3-none-any.whl |
Total release size: 10.3 kB
Release files / llama_index_readers_telegram-0.6.0.tar.gz
| Download URL | llama_index_readers_telegram-0.6.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7529f9e1ce799b2f0840a260272d8d4263d6d4a5abc79e002d70af81f542244
|
|
BLAKE2b-256 checksum How to use checksums |
6345bff0a21c1fa4f2e6b330286e588dc41ee760238bee721cd138bb04a36a3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_readers_telegram-0.6.0-py3-none-any.whl
| Download URL | llama_index_readers_telegram-0.6.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fd83eac18255c88adcd889a766ae02084a2b9ab2de1c91aa29ba6096e72517c
|
|
BLAKE2b-256 checksum How to use checksums |
78d1663642ce48a65f33b6fab5ddfeda48dfe35c038992adcad506a2344cfdf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-readers-telegram 0.6.0
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.