ptgb
A complete Telegram Bot API client for Dart

ptgb

A complete, pure-Dart client for the Telegram Bot API. Typed methods for every endpoint, plus keyboards, media, webhooks, payments, stickers, and Telegram Business accounts — no raw JSON required.

import 'package:ptgb/ptgb.dart';

Future<void> main() async {
  final bot = Bot(); // loads your token from a .env file
  await for (final update in bot.poll()) {
    if (update.text == '/start') {
      await bot.sendMessage(update.chatId!, 'Hello from ptgb!');
    }
  }
}

Why ptgb

  • Full API coverage — messaging, media, chat & forum administration, inline mode, payments & Telegram Stars, stickers, games, Telegram Business accounts, Stories, and Web Apps.
  • Two update sources — long-polling out of the box (Bot.poll) or your own webhook server (Bot.serveWebhook).
  • Typed helpers, not raw JSON for keyboards (InlineKeyboardMarkup, ReplyKeyboardMarkup), media (InputMedia*), and permissions (ChatPermissions, ChatAdministratorRights).
  • Telegram Mini App support — verify a Web App’s signed initData with Bot.verifyWebAppInitData.
  • A low-level escape hatch (Bot.call) for any Bot API method that doesn’t have a typed wrapper yet.

Install

dart pub add ptgb