How amanprojects-ops/telegram-bot-manager works
Telegram Bot Manager serves Telegram users through a webhook-driven bot and provides administrators with lead and broadcast management. The main bot workflow validates and logs updates, dispatches them to message or callback handling, then supports service and project discovery, brochure delivery, and quote capture. Admins review and update leads or create and launch broadcasts; scheduled and queued jobs deliver messages to bot users. The README documents campaign deep links, cached brochure file IDs, and webhook protections, but those implementation details were not fully sampled, so their internal wiring is not expanded here.
Main entry points: GeneralFlowService.php Menus and catalog · CallbackHandler.php Callback handling · ProcessBroadcast.php Broadcast processor · TelegramApi.php Telegram API client
Components 26
Telegram Bot
- Webhook endpoint
app/Http/Controllers/Telegram/WebhookController.php - Bot update router
app/Services/Telegram/TelegramBot.php - Message handling
app/Services/Telegram/MessageHandler.php - Callback handling
app/Services/Telegram/CallbackHandler.php - Telegram API client
app/Services/Telegram/TelegramApi.php - Bot user records
app/Models/TelegramUser.php
Business Features
- Menus and catalog
app/Services/Telegram/GeneralFlowService.php - Services catalog
app/Models/Service.php - Pricing plans
app/Models/PricingPlan.php - Projects catalog
app/Models/Project.php - Brochure delivery
app/Services/Telegram/BrochureService.php - Brochure records
app/Models/Brochure.php - Quote and leads
app/Services/Telegram/LeadService.php - Lead records
app/Models/TelegramLead.php
Admin Operations
- Lead administration
app/Http/Controllers/Admin/LeadController.php - Broadcast management
app/Http/Controllers/Admin/BroadcastController.php - Admin dashboard
app/Http/Controllers/Admin/DashboardController.php
Broadcast Delivery
- Broadcast records
app/Models/Broadcast.php - Scheduled dispatch
app/Console/Commands/DispatchScheduledBroadcasts.php - Broadcast processor
app/Jobs/ProcessBroadcast.php - Send message job
app/Jobs/SendBroadcastMessage.php
Other components
- Telegram user
- Telegram platform
- Administrator
- Application database
- Queue worker
Connections 39
- Telegram user → Webhook endpoint: sends updates
- Webhook endpoint → Application database: checks and logs updates
- Webhook endpoint → Bot update router: dispatches update
- Bot update router → Message handling: routes messages
- Bot update router → Callback handling: routes callbacks
- Message handling → Quote and leads: handles quote input
- Message handling → Menus and catalog: handles bot flow
- Callback handling → Quote and leads: dispatches quote actions
- Callback handling → Brochure delivery: dispatches brochure actions
- Callback handling → Menus and catalog: dispatches menu actions
- Callback handling → Services catalog: reads services
- Menus and catalog → Services catalog: reads services
- Menus and catalog → Pricing plans: reads pricing
- Menus and catalog → Projects catalog: reads projects
- Brochure delivery → Brochure records: uses brochure data
- Brochure delivery → Telegram API client: sends brochure
- Quote and leads → Lead records: creates and updates leads
- Quote and leads → Application database: persists lead state
- Message handling → Telegram API client: sends replies
- Menus and catalog → Telegram API client: sends menus
- Telegram API client → Telegram platform: calls Bot API
- Telegram user → Telegram platform: uses bot
- Administrator → Lead administration: manages leads
- Administrator → Broadcast management: manages broadcasts
- Administrator → Admin dashboard: views dashboard
- Lead administration → Lead records: reads and updates
- Broadcast management → Broadcast records: creates and reads
- Broadcast management → Bot user records: counts recipients
- Broadcast management → Broadcast processor: dispatches job
- Scheduled dispatch → Broadcast records: finds due broadcasts
- Scheduled dispatch → Broadcast processor: dispatches job
- Queue worker → Broadcast processor: runs job
- Broadcast processor → Broadcast records: updates progress
- Broadcast processor → Send message job: dispatches recipient jobs
- Send message job → Bot user records: loads recipient
- Send message job → Telegram API client: sends broadcast
- Broadcast records → Application database: persists broadcasts
- Bot user records → Application database: persists bot users
- Lead records → Application database: persists leads