Skip to content
Bot API v10.3 · always up to date

Telegram Bot API for TypeScript

Type-safe SDK for building Telegram bots — auto-generated types, lightweight client, zero runtime dependencies.

npm install @effect-ak/tg-bot-client
import { makeTgBotClient } from "@effect-ak/tg-bot-client"
const client = makeTgBotClient({
bot_token: "YOUR_BOT_TOKEN"
})
// full type safety for params and result
const message = await client.execute("send_message", {
chat_id: 123456,
text: "Hello from the client!"
})
console.log("Sent:", message.message_id)
400TypeScript types
185API methods
0Runtime dependencies
100%Generated from official docs

Why this SDK

Everything typed, nothing heavy

Three small packages that cover the whole Bot API surface — from raw types to a full bot runner.

Examples

See it in code

A full bot, a bare client call, or just the types — the API stays small at every layer.

Create a bot with command handling and text replies — no middleware, no boilerplate.

import { createBot } from "@effect-ak/tg-bot"
createBot()
.onMessage(({ command, text }) => [
command("/start", ({ ctx }) =>
ctx.reply("Hello! I'm your new bot.")
),
text(({ payload, ctx }) =>
ctx.reply(`You said: ${payload.text}`)
)
])
.run({ bot_token: "YOUR_BOT_TOKEN" })

Install with npm install @effect-ak/tg-bot — includes the client and all types.

Packages

Pick your layer

Take just the client, the whole framework, or only the types — each package builds on the one below it.

HTTP client

@effect-ak/tg-bot-client

Call any Bot API method with full type safety. Includes all types.

  • execute() for every API method
  • Automatic FormData for file uploads
  • Typed errors and request timeouts
npm install @effect-ak/tg-bot-client
Read the docs
Bot framework

@effect-ak/tg-bot

Fluent builder API, long polling, and webhooks. Includes the client and all types.

  • createBot() builder with guarded handlers
  • Long polling with offset management
  • Webhook support for serverless
npm install @effect-ak/tg-bot
Read the docs
Types only

@effect-ak/tg-bot-api

Pure TypeScript types for the Bot API and Mini Apps. Zero runtime code.

  • Full Bot API type coverage
  • Telegram.WebApp types for Mini Apps
  • Nothing shipped to your bundle
npm install @effect-ak/tg-bot-api
Read the docs

Ship your first bot in under 5 minutes

Install the SDK, paste a token from BotFather, and your bot is live — or try it right in the browser first.

Open source and free forever — star it on GitHub