Skip to content
v0.1.2Go 1.27+Bot API 10.3MIT License
TeleIQ

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@latest
TeleIQ Bot
TeleIQ Botbot

online • Bot API 10.3

/start✓✓
IQ
TeleIQ Bot • Go 1.27OnCommand

Welcome to TeleIQ! Every Bot API 10.3 method & type, zero dependencies, ordered per-chat updates.

📚 Browse Docs
⚡ Quick Start
Telegram Update
teleiq.Client
GO RUNTIME // ORDERED CHAT WORKERLATENCY: 1.4ms
match →b.OnCommand("start", bot.ReplyWith(...))
call →client.SendMessage(ctx, SendMessageParams{...})
Token Redaction: ACTIVERetries: AUTO (429/5xx)

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

LIVE ARCHITECTURE // HOW AN UPDATE FLOWS THROUGH TELEIQZero-Drop Ordered Pipeline
STAGE 01

Telegram Cloud

Long Polling / Webhook TLS

STAGE 02

Per-Chat Router

Ordered Queue per ChatID

STAGE 03

Middleware & Filter

Recovery • Logging • FSM

STAGE 04

Typed Client Call

Rate Limiter & Auto-Retry

ENGINEERED FOR RELIABILITY

Why TeleIQ

Built for bots that stay up: the hard parts of talking to Telegram are handled automatically.

Bot API 10.3185/185 Typed
01

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.

go.mod0 external deps
02

Only the standard library

No third-party dependencies: nothing extra to download, audit or keep up to date.

chat[1042]#1 ✓→#2→#3
03

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.

429 Retry-AfterAuto-Backoff ✓
04

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.IsErrBotBlocked
05

Errors by name

Check errors with errors.Is: ErrBotBlocked, ErrChatNotFound, ErrMessageNotModified, ErrNotEnoughRights and more.

/bot<REDACTED>
06

The token stays secret

The bot token never appears in errors or logs, so they can be shared safely.

QUICK START GUIDE

Your first bot in 4 steps

From a fresh Go module to a running, production-ready Telegram bot.

  1. 1
    STEP 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
  2. 2
    STEP 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 ✓
    /newbot
    Done! Congratulations on your new bot. Use this token to access the HTTP API:
    712049182:AAH9xK_teleiq_secret_token_example
  3. 3
    STEP 03 // BOT LOGIC

    Write main.go

    A complete, graceful-shutdown bot that greets /start and echoes every incoming message in order.

    main.go
    package 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)
    	}
    }
  4. 4
    STEP 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 .
MODULAR GO ARCHITECTURE

The 7 packages

Use the low-level client alone, or the full bot framework. Every package has a single, clear responsibility.

INTERACTIVE CODE PLAYGROUND

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.

methods.go
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.
}
Typed Client Call
teleiq.Client
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

Telegram Preview

Hello from TeleIQ 👋 (silent notification)

❯POST /bot<REDACTED>/getMe → 200 OK (0.8ms)
❯POST /bot<REDACTED>/sendMessage → 200 OK (1.2ms)
❯errors.Is(err, ErrBotBlocked) == false

All 15 complete example programs (each with automated tests) are available in the GitHub examples directory ↗.

ECOSYSTEM & SUPPORT

Follow TeleIQ

Release notes, developer community and inline documentation right inside Telegram.