Telegram bot bridge for Factory AI Droid CLI — Control your AI coding agent directly from Telegram.
Telegram Droid Connector is a Telegram bot that bridges Factory AI's Droid (an AI coding agent) with Telegram, allowing you to interact with your AI-powered software engineering assistant from anywhere. Send messages, review code, manage MCP servers, and get real-time tool progress — all through your Telegram chat.
- Chat with Droid from Telegram — Send natural language messages and receive AI responses directly in your Telegram chat
- Real-time tool progress — See which tools Droid is using (file reads, grep searches, command executions) as brief progress updates
- Permission approval via inline buttons — When Droid requests permission to use a tool, approve or deny with one tap
- Interactive questionnaires — When Droid asks questions, answer them via inline keyboard buttons or free text
- Conversation context persistence — Chat history is saved locally and restored when sessions restart, so Droid remembers previous conversations
- MCP server management — Add, remove, toggle, and browse MCP (Model Context Protocol) servers and tools directly from Telegram
- One-shot commands — Run code reviews and readiness reports without starting a persistent session
- Multi-user authorization — Restrict bot access to specific Telegram user IDs
- Autonomy level control — Set Droid's autonomy (low/medium/high) per session
- Auto-startup on Windows — Included scripts for running the bot as a Windows startup task
Telegram User → Telegram Bot → Droid SDK Client → Factory AI Droid CLI
↑ ↓
Inline Buttons / Text Tool Progress / Responses
The bot uses the Droid SDK (droid-sdk Python package) to communicate with the Factory AI Droid CLI process. Each Telegram chat gets its own Droid session, with full support for tool permission requests and interactive questionnaires via Telegram's inline keyboard system.
- Python 3.11+ installed
- Factory AI Droid CLI installed and configured (
droidcommand available) - A Telegram Bot Token — Create one via @BotFather on Telegram
- A Factory AI API Key — Get one from app.factory.ai/settings/api-keys
git clone https://github.com/MaulanaR/telegram-droid-connector.git
cd telegram-droid-connectorpip install -r requirements.txtThis installs:
python-telegram-bot— Telegram Bot API wrapperpython-dotenv— Environment variable loaderdroid-sdk— Factory AI Droid SDK client
Copy the example env file and fill in your credentials:
cp .env.example .envEdit .env with your values:
# Required: Telegram Bot Token from @BotFather
TELEGRAM_BOT_TOKEN=your_bot_token_here
# Required: Factory AI API Key
FACTORY_API_KEY=fk-your-key-here
# Required: Your Telegram user ID (comma-separated for multiple users)
# Find your ID by messaging @userinfobot on Telegram
ALLOWED_USER_IDS=123456789
# Optional: Droid autonomy level (low, medium, high)
DEFAULT_AUTO_LEVEL=medium
# Optional: AI model ID (empty = default model)
DEFAULT_MODEL=
# Optional: Working directory for Droid sessions
DEFAULT_CWD=.
# Optional: Execution timeout in seconds
EXEC_TIMEOUT=300python main.pyYou should see: Bot starting... in the console.
Open your bot on Telegram and send /start to see the available commands.
| Command | Description |
|---|---|
/start |
Show help and available commands |
/help |
Show help and available commands |
/new |
Start a new Droid session |
/stop |
Stop the current active session |
/interrupt |
Interrupt a running Droid session |
/clear |
Clear saved conversation context (fresh start) |
/status |
Show current session info (ID, autonomy, model, CWD) |
/auto <level> |
Set autonomy level: low, medium, or high |
/model <id> |
Set the AI model for Droid |
/cwd <path> |
Set the working directory for Droid |
/skills |
List available Droid skills |
/mcp |
List configured MCP servers |
/mcp_tools |
List available MCP tools |
/mcp_registry |
Browse the MCP server registry |
/mcp_add <name> <url> |
Add a new MCP server |
/mcp_remove <name> |
Remove an MCP server |
/review |
Run a code review (one-shot) |
/readiness |
Generate a readiness report (one-shot) |
Simply send any text message to the bot (not a command) and Droid will process it. You'll see:
- A progress message showing what tool Droid is currently using (e.g., "⏳ Read File: src/main.py")
- The final response when Droid completes its turn
When Droid wants to use a tool that requires approval, you'll get an inline message with Allow ✅ and Deny ❌ buttons. Tap one to respond.
You can also reply with text: allow, yes, ya, ok, or y to approve, or anything else to deny.
When Droid asks you a question (via the AskUser tool), you'll see inline keyboard buttons with the options. Tap to select your answer, or type a free-text response if no options are shown.
Conversation history is automatically saved per chat. When you restart the bot or start a new session, previous context is loaded so Droid remembers what you discussed. Use /clear to wipe saved context.
To run the bot automatically when you log in to Windows:
# Install as startup task
install_startup.bat
# Remove startup task
uninstall_startup.bat
# Stop the running bot
stop_bot.batTo start manually in the background: double-click start_background.vbs
telegram-droid-connector/
├── main.py # Telegram bot handlers and command routing
├── droid_executor.py # Droid SDK session management and context store
├── config.py # Configuration from environment variables
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
├── .gitignore # Git ignore rules
├── CLAUDE.md # AI agent instructions (customize as needed)
├── install_startup.bat # Windows startup task installer
├── start_background.vbs # Background launcher for Windows
├── stop_bot.bat # Script to stop the running bot
├── uninstall_startup.bat # Windows startup task remover
└── context_store/ # Conversation history (auto-created, not committed)
All configuration is via environment variables (loaded from .env):
| Variable | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
(required) | Bot token from @BotFather |
FACTORY_API_KEY |
(required) | Factory AI API key |
ALLOWED_USER_IDS |
(empty = all) | Comma-separated Telegram user IDs allowed to use the bot |
DEFAULT_AUTO_LEVEL |
medium |
Default Droid autonomy level |
DEFAULT_MODEL |
(empty) | Default AI model ID |
DEFAULT_CWD |
. |
Default working directory |
EXEC_TIMEOUT |
300 |
Execution timeout in seconds |
DROID_EXEC_PATH |
droid |
Path to Droid CLI executable |
LOG_FILE |
droidtele.log |
Log file path |
LOG_MAX_BYTES |
5242880 |
Max log file size before rotation (5 MB) |
LOG_BACKUP_COUNT |
3 |
Number of rotated log backups |
CONTEXT_DIR |
context_store |
Directory for conversation context files |
MAX_CONTEXT_EXCHANGES |
20 |
Max conversation exchanges per chat |
SUMMARY_INTERVAL |
5 |
Exchanges before context compaction |
- Bot not responding: Check that
TELEGRAM_BOT_TOKENandFACTORY_API_KEYare set correctly in.env - "Droid tidak merespon" timeout: Increase
EXEC_TIMEOUTin.env(default 300 seconds) - "Anda tidak diizinkan": Add your Telegram user ID to
ALLOWED_USER_IDSin.env - Droid CLI not found: Ensure
droidis installed and available in PATH, or setDROID_EXEC_PATHto its full path - Session errors: Use
/stopto end the current session, then/newto start fresh
- Restrict bot access by setting
ALLOWED_USER_IDSto only your Telegram user ID(s) - The bot runs Droid with the autonomy level you configure —
lowrequires approval for most tool uses,highallows autonomous execution
MIT License — see LICENSE for details.
Keywords: telegram bot, AI coding agent, factory droid, droid SDK, telegram AI assistant, code review bot, MCP protocol, AI agent bridge, telegram droid connector, software engineering AI, coding assistant telegram, droid CLI telegram