RepositoryPython
dimonier

dimonier/tg2obsidian

This bot pulls new messages from a Telegram chat or group and puts them into Obsidian vault on a local machine

155stars
28forks
6issues
0views

Featured achievements

The project's latest awards

4
TINIX TRENDING·Topic: telegram

#4 Repository of the month

8
TINIX TRENDING·Topic: productivity

#8 Repository of the month

3
TINIX TRENDING·Topic: telegram

#3 Repository of the week

tg2obsidian

This program (hereinafter referred to as the Bot) utilizes the free functionality of the Telegram bot to save messages from a Telegram group into an Obsidian vault on your local computer.

The Markdown formatting used will also work for most other programs that work with local Markdown files. The Bot is designed to run locally on the computer where the Obsidian files are located.

This readme is also available in Russian.

Use Case

  • You write, dictate, or forward messages on the go to the Bot or to your personal Telegram group where the Bot is administrator
  • The Bot receives new messages from Telegram and saves them as notes, thus forming an incoming stream of information directly into your note vault
  • Later, in a calm environment, you process these notes, distributing the information from them to appropriate places in your vault

Features

  • One or more Teleram users could send messages to the Obsidian vault.
  • Each user could use custom folder to store notes coming from Teleram.
  • All messages are grouped by date — one note per day/month/year (according to the note name template) — or stored in a single note.
  • Each message in a note has a header with a timestamp (can be suppressed for rapid message bursts).
  • Depending on the settings, message formatting is either preserved or ignored.
  • For forwarded messages, information about the message source is added.
  • Photographs, animations, videos, and documents are saved in the vault and embedded in the note.
  • Contacts are saved as YAML front matter and vcard.
  • For locations, links to Google Maps and Yandex.Maps are created.
  • There is an option to convert notes with specific keywords into tasks.
  • There is an option to force all posts into tasks per chat via /tasks on|off.
  • There is an option to tag notes with specific keywords.
  • There is an option for OCR on images. In this case, the Bot sends the recognized text as a reply to the original message.
  • There is an option for speech recognition from voice messages and audio messages (local Whisper or cloud OpenAI-compatible API). In this case, the Bot sends the recognized text as a reply to the original message.
  • After processing a message, the bot adds OK emoji to it.

Installation and Setup

The instructions below are intended for Windows users. For Linux and MacOS users, the installation and setup procedure is similar, but the commands for running programs may differ.

Main Steps

  1. Install Python 3.10+.
  2. Install the required dependencies:
pip install -r requirements.txt
  1. Create your bot using https://t.me/BotFather
  2. Insert the token received from @botfather into the corresponding variable in the config.py file and modify the other parameters in config.py as required.
  3. (Optional) Add the bot created above to a private Telegram group and make it an administrator so that it can read messages.
  4. Run the bot (see the "Usage" section)
  5. Send the /start command to your bot on Telegram. In response, the bot will tell you your id. Insert it into the allowed_chats parameter in the config.py file. Separate more than one chat id with a colon.

Optional: Telegram Proxy

If direct access to Telegram is blocked in your network, the Bot can connect to the Telegram Bot API through a proxy.

Add the proxy settings to config.py:

telegram_proxy_url = "socks5h://your-proxy-host:1080"
telegram_proxy_login = ""
telegram_proxy_password = ""

Notes:

  • Leave telegram_proxy_url empty to keep using a direct connection.
  • Supported proxy URL formats are socks5h://..., socks5://..., socks4a://..., socks4://..., and http://....
  • If your proxy requires authentication, fill telegram_proxy_login and telegram_proxy_password.
  • The proxy is used only for Telegram Bot API requests and Telegram file downloads. Regular external URL previews are not routed through it.
  • Proxy support requires the aiohttp-socks package, which is already included in requirements.txt.

Proxy / VPN how-tos

  1. How to set up full fledged VPN on VPS
  2. How to set up SOCKS5 proxy on 3x-ui

If Text Recognition on Images is Required

  1. Install Tesseract and add the path to the executable file (tesseract.exe on Windows) to the system's PATH environment variable.
  2. Navigate to the folder containing this script and ensure that tesseract.exe can be run from it.

If Speech Recognition is Required

  1. For local Whisper: install the compiled FFMPEG and add the path to the executable file (ffmpeg.exe on Windows) to the system's PATH environment variable.
  2. Navigate to the folder containing this script and ensure that ffmpeg.exe can be run from it.
  3. For cloud STT: set stt_provider = "cloud" and fill stt_base_url, stt_api_key, stt_model_name, stt_language in config.py (OpenAI-compatible API).

Usage

  1. Send/forward messages that should be added to your Obsidian vault directly to your bot or to your private Telegram group.

  2. Run the Bot:

python tg2obsidian_bot.py
  • On a continuously running computer or server, the Bot can be left running. It will then recognize speech and add notes to Obsidian in real-time.
  • If you only turn on your computer when you need to use it, run the Bot immediately when you need to receive messages in Obsidian, and close the program after receiving all messages.

Important! The Bot can only receive messages from the last 24 hours due to lifetime of Telegram updates. If more than 24 hours have passed since a message was sent before the Bot is run, that message will not be received by the Bot.

Bot Commands

  • /start — show chat id for allowed_chats.
  • /help — show help.
  • /set_folder <path> — set custom relative notes folder for the current chat.
  • /tasks on|off — force all posts from this chat to be tasks (adds a task suffix).

Timestamp Grouping

To avoid repeating timestamps for bursts of messages, set message_timestamp_interval in config.py (seconds). If a message arrives within this interval, the header timestamp is omitted for that message.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
harry0703/MoneyPrinterTurbo

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

147.4k
Dec 3, 2026
RepositoryPython
datalab-to/marker

Convert PDF to markdown + JSON quickly with high accuracy

41.1k
Nov 28, 2026
Modeltext-to-speech
hexgrad/Kokoro-82M

Kokoro is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be...

♥0
13.9M
Apr 10, 2025
RepositoryTypeScript
firecrawl/firecrawl

Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.

216.1k
Dec 3, 2026
RepositoryShell
ohmyzsh/ohmyzsh

🙃 A delightful, community-driven framework for managing your zsh configuration. Built by 2,600+ contributors, with hundreds of plugins (git, rails, laravel, node, python, docker, kubectl, aws, and more), themes to spice up your terminal, and automatic updates to keep your command line feeling like home.

191.0k
Nov 29, 2026
RepositoryPython
microsoft/markitdown

Python tool for converting files and office documents to Markdown.

199.6k
Dec 3, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
156.6M
Jun 1, 2026
Modeltext-to-speech
coqui/XTTS-v2

ⓍTTS ⓍTTS is a Voice generation model that lets you clone voices into different languages by using just a quick 6-second audio clip. There is no need for an excessive amount of training data that spans countless hours. This is the same or similar mo...

♥0
4.5M
Dec 11, 2023
Repository
obsidianmd/obsidian-releases

Community plugins list, theme list, and releases of Obsidian.

23.8k
Nov 30, 2026