Type-safe TypeScript SDK for building Telegram bots, automatically generated from official Telegram Bot API documentation.
This monorepo contains three packages:
TypeScript types for Telegram Bot API and Mini Apps, auto-generated from official documentation.
Lightweight HTTP client for Telegram Bot API with full type safety.
Effect-based bot runner with automatic long polling and error handling.
npm install @effect-ak/tg-bot-clientimport { makeTgBotClient } from "@effect-ak/tg-bot-client"
const client = makeTgBotClient({
bot_token: "YOUR_BOT_TOKEN"
})
await client.execute("sendMessage", {
chat_id: "123456789",
text: "Hello, World!"
})npm install @effect-ak/tg-bot effectimport { runTgChatBot } from "@effect-ak/tg-bot"
runTgChatBot({
bot_token: "YOUR_BOT_TOKEN",
mode: "single",
on_message: [
{
match: ({ ctx }) => ctx.command === "/start",
handle: ({ ctx }) => ctx.reply("Welcome!")
},
{
match: ({ update }) => !!update.text,
handle: ({ update, ctx }) => ctx.reply(`You said: ${update.text}`)
}
]
})- Always Up-to-Date: Types generated from official Telegram API documentation
- Fully Type-Safe: Complete TypeScript support for all API methods and types
- Zero Config: Works out of the box with sensible defaults
- No Webhooks Required: Uses long polling - run anywhere without public URLs
Each package has its own detailed documentation:
- API Types Documentation - TypeScript types for Bot API and Mini Apps
- Client Documentation - HTTP client usage and examples
- Bot Runner Documentation - Building bots with handlers and polling
Try it in your browser: Telegram Bot Playground
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Format code
pnpm format:fix