Skip to content

api reference

the api reference is auto-generated from the pinned telegram bot api schema that ships with @puregram/api. it reflects exactly what the running version supports — no manual curation, no drift

the three-layer api

puregram exposes the bot api at three levels of abstraction (see the three-layer api):

  • tg.api.X(params) — raw layer. calls the bot api directly and returns the raw bot-api type. use this when you need full control or the method isn't covered by a curated shortcut
  • tg.send(args) — curated layer. friendlier, hand-picked helpers for the most common methods; like tg.api.X, they return the raw Telegram* result (no wrapper)
  • update.send(args) / update.reply(args) — per-kind shortcuts. the same curated helpers, but with "anchors" pre-filled from the current update's payload (e.g. chat_id is taken from update.raw.chat.id). this is what you reach for in most handlers

reference pages

generated from the pinned schema:

  • methods — every telegram bot api method with parameter tables and return types
  • objects — every telegram bot api object (types, interfaces, enums)
  • updates — every wrapped update kind, its handler, shortcuts and helpers
  • filters — the codegen'd hasX presence filters and what each narrows

hand-maintained:

  • errors — the error classes puregram throws
  • Telegram client — the public method index for the Telegram class