README file from
GithubTelegram AI Sync
An advanced plugin that syncs Telegram messages to your vault with AI-powered processing (OpenAI), smart categorization, and automated content organization.
✨ Key Features
- 🤖 AI Intelligence: Supports OpenAI (GPT-4 & Whisper). Automatically analyzes text, images, and seamlessly transcribes voice messages, audio, and video files.
- 📂 Local Processing: Extracts text from documents (PDF, DOCX, TXT, Code files) locally to protect privacy and save API costs, with AI processing as a fallback.
- 📸 Media Albums: Smartly handles Telegram media groups/albums, keeping context together in a single note.
- 🔗 Smart Logic: URL-only messages skip AI to save tokens; distinct prompts can be applied based on the content type.
- 🛡️ Robust Error Handling: Automatically detects and displays user-friendly alerts for API issues, such as exhausted billing quotas or invalid/revoked keys, preventing silent failures.
- 📝 Dynamic Templates: Use powerful variables like
{{ai:title}},{{category}}, and{{date:YYYY-MM}}for file naming.
🚀 Quick Start
- Install: Download
main.js,manifest.json, andstyles.cssfrom Releases to.obsidian/plugins/telegram-ai/. - Obsidian: Settings → Community Plugins → Enable "Telegram AI Sync".
- Telegram Bot: Create a bot via @BotFather, copy the Token.
- Configure:
- Enter Bot Token in plugin settings.
- Add your Telegram User ID to "Allowed Chats".
- Select your AI Provider and enter the API Key.
📋 Configuration & Usage
Template Variables
Customize how notes are created in the settings:
{{date:YYYY-MM-DD}}: Current date.{{ai:title}}: AI-generated title based on content.{{content}}: The processed message body.{{category}}: AI-detected category (e.g., Work, Ideas).
AI Prompts
Using the built-in wide-modal prompt editor, you can define specific behavior and toggle processing for different content types:
- General Formatting: Applied to all processed content as a final formatting step.
- Text: Instructions for processing plain text messages.
- Audio & Video: A unified prompt for handling transcripts generated by the Whisper API from voice messages, audio files, and video tracks.
- Photos: "Analyze this image and extract text/context..." (Requires Vision API).
- Documents: "Summarize this document..." (Handles parsed text from PDFs, DOCX, etc.).
🎛️ Settings Overview
Telegram Connection
- Bot Token: Your Telegram bot token.
- Allowed Chats: Whitelist of authorized users.
- Connection Status: Real-time connection monitoring.
AI Configuration
- Provider Selection: OpenAI.
- Model Settings: Temperature, max tokens, timeout.
- Prompt Management: Content-specific, unified media, and general prompts with a dedicated full-width editing interface.
- Processing Toggles: Enable/disable AI parsing for each content type (Text, Photos, Audio/Video, Documents).
Organization
- Categories: Define note categories with keywords.
- Templates: Customize file paths and naming.
- Distribution Rules: Advanced message routing.
- Local Processing: Enable direct document text extraction for PDF and DOCX files.
🤝 Acknowledgments
Special thanks to the open-source community.
- Foundation: This plugin was inspired by and built upon the excellent work of obsidian-telegram-sync by soberhacker.
- Libraries: Built with Obsidian API,
node-telegram-bot-api,pdf-parse, andmammoth.