$ account yagop
node-telegram-bot-api is a TypeScript client library for the Telegram Bot API, built as a runtime-agnostic core plus Node.js and Bun adapters. It exposes a Bot class with koa-style middleware, Context helpers, generated Api methods that map 1:1 to Telegram endpoints, and both long-polling and webhook update ingestion. The package targets Node 18+, Bun, Deno, Cloudflare Workers, and Vercel Edge by restricting src/core to Web-standard APIs and enforcing these boundaries with CI gates. It is a library, not a standalone app; consumers embed it to build Telegram bots. In production, the library receives updates either from getUpdates long polling (an AsyncGenerator with retry, backoff, and conflict handling) or from webhook callbacks (Web-standard Request to Response handlers plus adapters for Express, Next.js App Router, and Node HTTP). It includes a resilient transport layer with timeouts, retries, token-bucket rate limiting, and streaming multipart uploads, plus optional session middleware with pluggable stores (memory, file, SQLite, Redis) and a reply/callback tracking layer for structured conversations. The full Telegram type surface is auto-generated from live Bot API documentation by scripts/api-parser.ts, producing schemas.ts and api.ts, and the e2e suite exercises real Telegram endpoints. Architecturally, the most reusable patterns are generic middleware composition, an injectable fetch transport with backoff, a token-bucket rate limiter with per-key LRU state, and a streaming multipart encoder that avoids buffering whole uploads in memory. Session stores are deliberately minimal string-keyed KV contracts, with versioned envelopes allowing optional layers to extend state. The codebase is well tested, documented with 18 examples, and under active maintenance. This is not a data_research repository; the code generation pipeline is a build-time tool, not the product itself.