How overwirehq/claude-code-telegram works
Claude Code Telegram Bot turns Telegram conversations and automation triggers into Claude Code work, then returns responses through Telegram. The main interaction path is Telegram updates → bot routing → Claude execution → session persistence and formatted replies. Separate branches cover classic commands and file, image, voice, Git, quick-action, and export capabilities; webhook and scheduled events use the event bus and agent handlers. Storage, project-thread synchronization, authentication, validation, rate limiting, and audit logging provide supporting services. Some capabilities are README-documented but their runtime wiring was not sampled, so those relationships are omitted or marked unverified.
Main entry points: main.py Application startup · message.py Message handling · facade.py Claude facade · bus.py Event bus
Components 26
Telegram interaction
- Application startup
src/main.py - Bot runtime
src/bot/core.py - Update orchestration
src/bot/orchestrator.py - Message handling
src/bot/handlers/message.py - Classic commands
src/bot/handlers/command.py - Interaction features
src/bot/features - Response formatting
src/bot/utils/formatting.py
Claude and projects
- Claude integration
src/claude/sdk_integration.py - Claude facade
src/claude/facade.py - Session management
src/claude/session.py - Project registry
src/projects/registry.py - Project threads
src/projects/thread_manager.py
Automation and events
- Webhook API
src/api/server.py - Job scheduler
src/scheduler/scheduler.py - Event bus
src/events/bus.py - Agent and notification handlers
src/events/handlers.py - Notification delivery
src/notifications/service.py
Security and persistence
- Authentication and audit
src/security/auth.py - Path validation
src/security/validators.py - Rate limiting
src/security/rate_limiter.py - Storage services
src/storage/facade.py - SQLite database
src/storage/database.py - Persistent sessions
src/storage/session_storage.py - Configuration
src/config/settings.py
Other components
- Telegram user
- Telegram platform
Connections 30
- Telegram user → Telegram platform: sends messages
- Telegram platform → Bot runtime: delivers updates
- Application startup → Bot runtime: initializes
src/main.py - Bot runtime → Update orchestration: routes updates
- Update orchestration → Message handling: dispatches messages
src/bot/orchestrator.py - Update orchestration → Classic commands: dispatches commands
src/bot/orchestrator.py - Message handling → Claude facade: requests Claude work
src/bot/handlers/message.py - Classic commands → Claude facade: requests Claude work
- Claude facade → Claude integration: delegates execution
src/claude/facade.py - Claude facade → Session management: manages sessions
src/claude/facade.py - Claude integration → Path validation: checks file paths
src/claude/sdk_integration.py - Message handling → Response formatting: formats replies
src/bot/handlers/message.py - Update orchestration → Interaction features: coordinates features
- Application startup → Webhook API: configures webhooks
src/main.py - Webhook API → Event bus: publishes events
src/api/server.py - Job scheduler → Event bus: publishes triggers
src/scheduler/scheduler.py - Event bus → Agent and notification handlers: dispatches events
src/events/bus.py - Agent and notification handlers → Claude facade: runs Claude tasks
src/events/handlers.py - Agent and notification handlers → Event bus: publishes responses
src/events/handlers.py - Notification delivery → Event bus: subscribes to responses
src/notifications/service.py - Application startup → Storage services: initializes storage
src/main.py - Storage services → SQLite database: uses database
src/storage/facade.py - Persistent sessions → SQLite database: persists sessions
src/storage/session_storage.py - Session management → Persistent sessions: stores session state
src/storage/session_storage.py - Application startup → Authentication and audit: configures authentication
src/main.py - Application startup → Configuration: loads settings
src/main.py - Message handling → Rate limiting: checks request limits
src/bot/handlers/message.py - Message handling → Path validation: validates inputs
src/bot/handlers/message.py - Project threads → Project registry: resolves projects
src/projects/thread_manager.py - Project threads → Storage services: persists mappings
src/projects/thread_manager.py