Skip to main content


Telegram Messenger is a globally accessible freemium, cross-platform, encrypted, cloud-based and centralized instant messaging service. The application also provides optional end-to-end encrypted chats and video calling, VoIP, file sharing and several other features.

This notebook covers how to load data from Telegram into a format that can be ingested into LangChain.

from langchain_community.document_loaders import (
loader = TelegramChatFileLoader("example_data/telegram.json")
[Document(page_content="Henry on 2020-01-01T00:00:02: It's 2020...\n\nHenry on 2020-01-01T00:00:04: Fireworks!\n\nGrace 🧀 Γ°ΕΈ\x8d’ on 2020-01-01T00:00:05: You're a minute late!\n\n", metadata={'source': 'example_data/telegram.json'})]

TelegramChatApiLoader loads data directly from any specified chat from Telegram. In order to export the data, you will need to authenticate your Telegram account.

You can get the API_HASH and API_ID from

chat_entity – recommended to be the entity of a channel.

loader = TelegramChatApiLoader(
chat_entity="<CHAT_URL>", # recommended to use Entity here
api_hash="<API HASH >",
username="", # needed only for caching the session.

Was this page helpful?

You can leave detailed feedback on GitHub.