TeleCode
Bridge your VS Code with Telegram - control your IDE from anywhere! Work with AI assistants, monitor tasks, and stay connected to your development environment through Telegram.
Features
- Telegram Bot Integration: Connect your VS Code instance to a Telegram bot
- AI Assistant Integration: Works with any VS Code Language Model (Claude, GPT, Gemini, etc.)
- Bidirectional Communication: Send and receive messages between Telegram and VS Code
- Extension API: Other extensions can send notifications via Telegram
- Copilot Chat Mirroring: Can mirror Copilot Chat responses back to Telegram with transcript-based sync
- Secure: Whitelist specific chat IDs for security
- Persistent State: Active chat survives VS Code restarts
- Auto-start: Optional automatic bot startup with VS Code
- Relay Panel: Built-in webview panel for incoming/outgoing Telegram relay
Setup
1. Create Telegram Bot
- Open Telegram and search for @BotFather
- Send
/newbot and follow the instructions
- Copy the bot token you receive
- Open VS Code Command Palette (
Cmd+Shift+P or Ctrl+Shift+P)
- Run
TeleCode: Configure Bot Token
- Paste your bot token
3. Start the Bot
- Run
TeleCode: Start Bot command
- Open your bot on Telegram
- Send
/start to get your chat ID
- Run
TeleCode: Configure Allowed Telegram Chats
- Paste your chat ID(s) as comma-separated values (e.g.,
123456789)
Usage
Telegram Bot Commands
/start: Get your chat ID and welcome message
/clear: Clear conversation history
From Telegram
Simply send any message to your bot! If AI integration is enabled, you'll get automatic responses from your configured Language Model.
From VS Code
TeleCode: Send Message: Send a message to all configured chat IDs
TeleCode: Configure Bot Token: Store/update Telegram bot token in SecretStorage
TeleCode: Configure Allowed Telegram Chats: Set allowed chat IDs in extension state
TeleCode: Start Bot: Start the Telegram bot
TeleCode: Stop Bot: Stop the Telegram bot
TeleCode: Clear Conversation History: Clear all conversation histories
TeleCode: Open Relay Panel: Open the relay panel UI
TeleCode: Forward Latest Message to Copilot Chat: Forward the latest incoming Telegram message to Copilot Chat
TeleCode: Test Send: Test sending a message to active chat
TeleCode: Send to Active Chat: Programmatically send message (for extensions)
Configuration
All settings are available under telecode in VS Code settings:
autoStart: Automatically start bot on VS Code startup
autoOpenRelayPanel: Automatically open relay panel on bot start/message
enableAutoReply: Enable/disable automatic replies for incoming Telegram messages
replySource: Reply source (directModel or copilotChatMirror)
forwardIncomingToChat: Also forward incoming Telegram messages into Copilot Chat
sendAcknowledgement: Send immediate receipt message on inbound Telegram messages
enableAIIntegration: Legacy compatibility toggle (available setting)
Mirror behavior tuning settings:
mirrorPollIntervalMs, mirrorMaxWaitMs, mirrorMaxAttempts
mirrorMarkerMaxWaitMs, mirrorTranscriptSettleMs
mirrorEnableTurnCompletionFastPath, mirrorEnableClipboardFallback
mirrorRequestDispatchTimeoutMs, mirrorRequestDispatchQuickVerifyMs, mirrorNonBlockingDispatchVerification
mirrorSendProgressUpdates, mirrorSendProgressIntro, mirrorProgressUpdateIntervalMs
mirrorMaxWaitMs supports 0 to wait indefinitely for a mirrored Copilot reply.
mirrorEnableClipboardFallback is enabled by default so TeleCode can capture a reply from the live chat UI if transcript flush timing lags behind what Copilot is showing on screen.
Deprecated legacy settings (auto-migrated then cleared):
Security-sensitive values are not stored in plain settings:
- Bot token is stored in VS Code SecretStorage via
TeleCode: Configure Bot Token
- Allowed chat IDs are stored in extension state via
TeleCode: Configure Allowed Telegram Chats
Features in Detail
Conversation Context
The extension stores pending inbound messages and mirrors relay traffic in the panel. It does not maintain a dedicated per-chat 10-exchange memory buffer.
Extension API
Other VS Code extensions can integrate with TeleCode:
// Get TeleCode API
const telecodeExt = vscode.extensions.getExtension('your-publisher.telecode');
const telecode = telecodeExt?.exports;
// Send message to active Telegram chat
if (telecode?.isInTelegramContext()) {
await telecode.sendToActiveTelegramChat('Hello from my extension!');
}
// Or use command
await vscode.commands.executeCommand('telecode.sendToActiveChat', 'My message');
Message Length Handling
Long AI responses are automatically split into multiple Telegram messages to respect Telegram's 4096 character limit.
Security
- Only whitelisted chat IDs can interact with your bot
- Bot token is stored in VS Code SecretStorage (not in workspace files)
- Allowed chat IDs are stored in extension state (not in workspace files)
- Unauthorized access attempts are logged and rejected
Troubleshooting
Bot not responding
- Check if the bot is running:
TeleCode: Start Bot
- Verify your bot token is correct
- Ensure your chat ID is in the allowed list
- Check Output channel: View → Output → Select "TeleCode"
AI not responding
- Check that
enableAutoReply is enabled in settings
- Ensure you have a Language Model available in VS Code (Claude Code, GitHub Copilot, etc.)
- If using mirror mode, verify
replySource is set to copilotChatMirror and Copilot Chat is available
- Check the Output channel for error messages
Development
# Install dependencies
npm install
# Compile
npm run compile
# Watch mode
npm run watch
License
MIT