How yagop/node-telegram-bot-api works
Main Components
a. Client Application Layer
• As the topmost layer
• External applications that use this library
b. Node-Telegram-Bot-API Core (Middle Layer)
• Split into three main modules:
• TelegramBot Base (telegram.js)
• Polling Handler (telegramPolling.js)
• Webhook Handler (telegramWebHook.js)
c. External Services Layer
• Telegram Bot API
• SSL/HTTPS Services (for webhook mode)
Connection Flows to Illustrate
a. Two Main Communication Paths:
• Polling Flow:
• Client → TelegramBot → Polling Handler → Telegram API
• Webhook Flow:
• Telegram API → Webhook Handler → TelegramBot → Client
b. Error Handling Flow:
• Error.js to both main paths
Specific Elements
a. Components:
• [Client Application]
• ↕
• [Node-Telegram-Bot-API]
• TelegramBot (Base)
• Polling Handler
• Webhook Handler
• Utils & Error Handling
• ↕
• [Telegram Bot API]
b. Important Notations:
• Webhook endpoints (/webhook)
• SSL certificate requirements
• Configuration options (polling vs webhook)
• Event listeners (message, error, etc.)
Additional Details
• API Calls
• Event Handlers
• Error Propagation
• Configuration Flow
• Notes about:
• Authentication (Bot Token)
• Supported Message Types
• Error Handling Mechanisms
Implementation Notes
• Use standardized UML notation where applicable
• Use straight lines for direct connections and curved lines for event-based flows
• Version information and supported Telegram Bot API version