TeleAutomator — AI Telegram Chat Automation & Mini App

The open, modern AI-powered Telegram userbot and personal automation assistant.
Context-aware auto-replies with Google Gemini & OpenAI LLMs, Telethon MTProto user account client, and an Android Material 3 Expressive claymorphic Mini App control panel.
🔑 First Time Setup & Requirements Guide
Wondering which API keys, Telegram IDs, and environment settings are required? Read REQUIREMENTS.md for a beginner-friendly walkthrough on where to get your TG_API_ID, TG_API_HASH, bot token, and AI provider key.
🚀 Deploying to Railway, Render, or Cloud VPS 24/7?
For complete step-by-step cloud deployment walkthroughs, automated build guides, and environment variable configurations, see DEPLOYMENT.md.
⚡ Quickstart (Local)
📖 Before starting, configure your credentials in .env. See REQUIREMENTS.md for where to find each value.
# 1. Clone repository
git clone https://github.com/mkr-infinity/TeleAutomator.git && cd TeleAutomator
# 2. Universal automated setup (installs dependencies and creates .env)
./setup.sh
# 3. Authenticate with your Telegram account (Phone, OTP, 2FA)
./authenticate.sh
# 4. (Optional) Export your headless Cloud session string:
./session.sh
# 5. Start TeleAutomator
./start.sh
(Windows / cross-platform: python run.py --setup -> python run.py --auth -> python run.py --session -> python run.py)
For a dedicated headless login use ./session.sh --new or python run.py --new-session.
./session.sh / python run.py --session only export an existing authenticated local session.
Session files and strings are unencrypted bearer credentials. Stop the local sender before
starting a deployment. A separate session avoids sharing an auth key, but two senders for
the same account can still duplicate replies and use independent safety counters.
Setup requires Python 3.10+ with venv/pip already installed. Setup scripts install Python
packages and create configuration; they do not install Python, Docker, or OS packages.
With AI disabled or unavailable, conversational replies stay silent; there is no canned offline fallback.
Containers require persistent storage; follow DEPLOYMENT.md before Compose or cloud startup.
📱 Telegram Mini App (Web App GUI)
TeleAutomator includes a built-in Telegram Mini App running concurrently on the same server/container without requiring a separate domain or infrastructure.
- Direct Launch in Telegram: Registered automatically as the bot's persistent chat menu button (
Open) via Telegram's setChatMenuButton API, and accessible via /miniapp inline Web App buttons.
- Sleek Loading Screen: Smooth animated startup with glowing project logo, gradient progress bar, and instant state hydration.
- Overview Dashboard: Live status pill, 24h reply counters, speaking style, quiet hours schedule, and quick controls (Pause 30m, Resume, Emergency Stop, Mode switch).
- Chats & Memory Management: Capsule-style chat cards showing profile initials, titles, allowlist status, per-chat custom personas, voice profiles, and isolated disk context files (
data/contexts/{chat_id}.json).
- AI Engine & Testing Playground: Custom base URL configuration, live model fetch from
/models endpoints, multi-model selection with automatic fallback rotation, and an interactive test playground.
- Draft Approvals: Approve or reject drafts with in-place card updates (zero message deletions on Telegram).
- Action History & Diagnostics: More → Action history shows sent, skipped, blocked, and failed actions with filters and live engine details. It keeps at most 1,100 metadata entries, excluding message bodies and command arguments.
- Reply Feedback & Stages: Rate automated messages from Overview → Recent replies as helpful, unneeded, off-topic, or a style mismatch. More → Reply feedback & stages shows the ratings, filters, and context/writer/local-check stages. Ratings guide only their own chat, and rejected replies are checked before sending again.
- Preference Export & Import: The main owner can download a JSON backup and preview a merge before applying it. Reply settings, keyword rules, and separate chat profiles are included; credentials, access permissions, and conversation history are excluded. Keep exported prompts and notes private.
- Access Control & Paywall: Multi-user permissions with an automated authorization note (100 Stars or 1 TON to
@mkr_infinity).
📑 Operating Modes
Switch modes on the fly from terminal, the Mini App GUI, or your Telegram Control Bot:
| Mode |
Description |
How to Activate |
draft |
Generates and logs drafts to SQLite; never sends to chat. |
/mode draft or ./start.sh --draft |
approval |
Sends drafts to your Control Bot for /approve <id> dispatch. |
/mode approval or ./start.sh --mode approval |
restricted_auto (Template default) |
Automatically replies to allowlisted chats with human-like delays (min 2.0s between bubbles). |
/mode auto or set REPLY_MODE=restricted_auto |
📱 Remote Control & Command Reference
Manage your automation straight from your phone by texting your Control Bot:
Permanent Group Context & Memory
| Command |
Action |
Example |
/syncpins [chat_id] |
Auto-fetches pinned messages from group(s) as permanent context |
/syncpins -1001234567890 or /syncpins |
/setcontext <id> <notes> |
Saves permanent rules/facts for a group so AI never talks nonsense |
/setcontext -1001234 Tech team, building AI agents. |
/showcontext <chat_id> |
Inspects active pinned info, notes, AI memory, and isolated disk context file |
/showcontext -1001234567890 |
/delcontext <chat_id> |
Removes permanent context for a group |
/delcontext -1001234567890 |
/chatprompt <id> <text> |
Sets an isolated custom AI persona for that specific chat/group only |
/chatprompt -1001234 Speak like a crypto trader |
/gencontext <chat_id> |
AI analyzes recent chat banter to create an authentic voice profile |
/gencontext -1001234567890 |
/contextttl <hours> |
Sets conversation auto-aging window (default: 4.0 hours) |
/contextttl 4.0 |
/clearcontext <chat_id> |
Resets rolling conversation cache (guaranteed zero Telegram message deletions) |
/clearcontext -1001234567890 |
Core Controls & Identity
| Command |
Action |
Example |
/status |
Displays active mode, models, quota, quiet hours, and DataFrame table |
/status |
/name <name|sync> |
Sets display persona name, or syncs automatically from Telegram profile |
/name sync or /name Kaif |
/mode <draft|approval|auto> |
Switches operating mode dynamically |
/mode auto |
/style <casual|concise|formal|humorous> |
Changes AI speaking persona on the fly |
/style concise |
/lang <dynamic|english|hindi|...> |
Sets target language (dynamic match or forced language) |
/lang dynamic |
/chats |
Displays active allowlisted chats in structured DataFrame format |
/chats |
/allowchat <id> |
Adds a chat ID to the allowlist directly from phone |
/allowchat 123456789 |
/removechat <id> |
Removes a chat from allowlist |
/removechat 123456789 |
/mentiononly <on|off> |
Reply in groups only when tagged or replied to |
/mentiononly on |
/miniapp |
Launches the TeleAutomator Mini App control panel |
/miniapp |
/feedback [chat_id message_id rating] |
Review ratings or rate an automated reply; helpful, unnecessary, off_topic, style, clear |
/feedback -100123 42 off_topic |
AI Models, Quota & Cooldowns
| Command |
Action |
Example |
/aiconfig |
Inspects provider, base URL, temperature, and reasoning parameters |
/aiconfig |
/setai |
Custom AI setup dashboard & 1-line configuration |
/setai <provider> <api_key> [endpoint] [model] |
/apikey <key> |
Update active AI API key directly from Telegram without restarts |
/apikey <your_api_key> |
/baseurl <url> |
Update custom endpoint URL |
/baseurl https://api.your-provider.com/v1 |
/provider <name> |
Switch AI engine (custom, gemini, openai, nvidia, local) |
/provider custom |
/model <name> |
Switch AI candidate model (supports comma-separated fallbacks) |
/model <model_name> |
/usage |
Displays 24h consumption, total token usage, and remaining free quota |
/usage |
/checkmodels |
Pings candidate models live and picks verified working ones |
/checkmodels |
/reasoning <default|instant|low|medium|high|off|none> |
Adjusts reasoning effort for reasoning-capable models |
/reasoning instant |
/reaction <on|off> |
Toggles natural emoji reactions (pool of 26 mobile emojis) |
/reaction on |
/reactioncooldown <min> <max> |
Sets randomized reaction interval (default: 3s–9s) |
/reactioncooldown 3 9 |
/chatcooldown <min> <max> |
Sets randomized per-chat reply cooldown (default: 5s–60s) |
/chatcooldown 5 60 |
/quiethours <on|off|start end> |
Simulates human sleep schedule (pauses replies & reactions) |
/quiethours on 23:00 07:00 |
/stop |
Emergency kill switch: immediately halts all outgoing messages |
/stop |
/resume |
Resumes automation and clears all stops/pauses |
/resume |