
TeleIQ
A Go library & framework for the Telegram Bot API.
Every type and method of Bot API 10.3 as strictly typed Go code, paired with a production runtime for bots that run for months: long polling or webhook, ordered per-chat workers, automatic flood/5xx retries, and built-in token redaction.
$go get github.com/DhurghamAhmed/teleiq@latestonline • Bot API 10.3
Welcome to TeleIQ! Every Bot API 10.3 method & type, zero dependencies, ordered per-chat updates.
b.OnCommand("start", bot.ReplyWith(...))client.SendMessage(ctx, SendMessageParams{...})185
Bot API methods
100% typed coverage
400
Bot API types
Auto-verified daily
0
dependencies
Pure Go standard lib
7
focused packages
Modular architecture
Telegram Cloud
Long Polling / Webhook TLS
Per-Chat Router
Ordered Queue per ChatID
Middleware & Filter
Recovery • Logging • FSM
Typed Client Call
Rate Limiter & Auto-Retry
Why TeleIQ
Built for bots that stay up: the hard parts of talking to Telegram are handled automatically.
The whole Bot API
Every one of the 185 methods and 400 types of Bot API 10.3 is typed Go, generated from Telegram's official documentation and checked for updates every day.
Only the standard library
No third-party dependencies: nothing extra to download, audit or keep up to date.
Ordered, never lost
The updates of each chat are handled one at a time and in order, and an update is confirmed to Telegram only after it is handled.
Retries and rate limits
Failed requests are retried after network errors, server errors and flood control, and an optional rate limiter paces requests in all and per chat.
Errors by name
Check errors with errors.Is: ErrBotBlocked, ErrChatNotFound, ErrMessageNotModified, ErrNotEnoughRights and more.
The token stays secret
The bot token never appears in errors or logs, so they can be shared safely.
Your first bot in 4 steps
From a fresh Go module to a running, production-ready Telegram bot.
- 1STEP 01 // GO MODULE
Install the package
TeleIQ requires Go 1.27 or later and zero third-party packages.
go get github.com/DhurghamAhmed/teleiq@latest - 2STEP 02 // TELEGRAM CREDENTIALS
Create a bot token with @BotFather
Open @BotFather on Telegram, send /newbot, choose a name and username, and copy the HTTP API token.
@BotFather • Official Telegram Botverified ✓/newbotDone! Congratulations on your new bot. Use this token to access the HTTP API:712049182:AAH9xK_teleiq_secret_token_example - 3STEP 03 // BOT LOGIC
Write main.go
A complete, graceful-shutdown bot that greets /start and echoes every incoming message in order.
main.gopackage main import ( "context" "log" "os" "os/signal" "github.com/DhurghamAhmed/teleiq" "github.com/DhurghamAhmed/teleiq/bot" ) func main() { // ctx ends on Ctrl+C, which stops the bot. ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) defer stop() client, err := teleiq.NewClient(os.Getenv("BOT_TOKEN")) if err != nil { log.Fatal(err) } b := bot.New(client) // b is the bot b.OnCommand("start", bot.ReplyWith("Hello! Send me a message and I will repeat it.")) // c is the current message; c.Send replies in its chat. b.OnMessage(func(ctx context.Context, c *bot.Context) error { return c.Send(ctx, "You said: "+c.Text()) }) if err := b.Run(ctx); err != nil { // receives updates until ctx ends log.Fatal(err) } } - 4STEP 04 // LIVE EXECUTION
Run & test in Telegram
Export your token, run the program, and send /start to your bot in Telegram.
export BOT_TOKEN='<token from @BotFather>' go run .
The 7 packages
Use the low-level client alone, or the full bot framework. Every package has a single, clear responsibility.
teleiq
The client: a method for every Bot API method, with retries, rate limits and default options.
bot
The framework: long polling or webhook, handlers, middleware and shortcuts for replying.
filter
Which updates a handler gets: commands, texts, every kind of media, chats and users.
models
Every Bot API type, plus helpers for chats, files and keyboards.
fsm
Conversations of several steps, with the state of each user kept for you.
webapp
Checks that the data of a Mini App really comes from Telegram.
teleiqtest
A fake Bot API server for tests: no Telegram, no token.
Explore every function, struct, sentinel error and runnable example on the official Go package index.
Real-world examples
Click any scenario below to inspect the Go code alongside its live Telegram Bot API execution pipeline.
Required parameters are plain fields; optional ones are pointers, set with teleiq.Ptr. Errors match by name.
me, err := client.GetMe(ctx)
if err != nil {
log.Fatal(err)
}
_, err = client.SendMessage(ctx, teleiq.SendMessageParams{
ChatID: models.ID(123456789), // or models.Username("@channel")
Text: "Hello from " + me.FirstName,
DisableNotification: teleiq.Ptr(true),
})
switch {
case errors.Is(err, teleiq.ErrBotBlocked):
// The user blocked the bot.
case errors.Is(err, teleiq.ErrTooManyRequests):
// Flood control that the retries could not wait out.
}client.GetMe(ctx)STEP 01→ Returns *models.User{FirstName: "TeleIQ", IsBot: true}
client.SendMessage(ctx, params)STEP 02→ ChatID: models.ID(123456789), DisableNotification: Ptr(true)
errors.Is(err, teleiq.ErrBotBlocked)STEP 03→ Typed sentinel error matching without string parsing
Hello from TeleIQ 👋 (silent notification)
All 15 complete example programs (each with automated tests) are available in the GitHub examples directory ↗.
Follow TeleIQ
Release notes, developer community and inline documentation right inside Telegram.
Release Channel
@teleiqgo
Every new release announcement, changelog and Bot API update.
Developer Group
@teleiqgroup
Ask questions, share bots and discuss architecture with other Go developers.
Inline Docs Bot
@TeleIqGoBot
Type @TeleIqGoBot in any Telegram chat to search methods & types with instant Go examples.
Source & Issues
DhurghamAhmed/teleiq
Browse the generator, full source code and 15 tested example programs on GitHub.