Skip to main content

llama-index readers telegram integration

Project description

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:

  1. Login to your Telegram account with the phone number of the developer account to use.
  2. Click under API Development tools.
  3. 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.
  4. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_readers_telegram-0.5.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_readers_telegram-0.5.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_readers_telegram-0.5.0.tar.gz.

File metadata

  • Download URL: llama_index_readers_telegram-0.5.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_readers_telegram-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8a98a8d56de4ce1b96deb71717389f2d91625173da7655828c4c96e0a1f87c1f
MD5 a193853b16e0d1fa81adf160b5147801
BLAKE2b-256 af3e85e930cd47a88701304ef4900bb554de193b20a397127eb96c3354b73f25

See more details on using hashes here.

File details

Details for the file llama_index_readers_telegram-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_readers_telegram-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_readers_telegram-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ad6044028a05e1dedcafef3b5b5883ea1976998e02025b1c88156468d6039f
MD5 8850bf335c97006a369e579ccf347f78
BLAKE2b-256 2bdca1d67968715c9c38166c2d9bccc2f2d36d3dc67dd3a038ddc9fe2672bf1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page