LogoTeleTemplate Docs
LogoTeleTemplate Docs
Homepage

Getting Started

Quick Start

Telegram

Telegram Bot

Introduction to Telegram Bot integration

Overview

SuperTele provides a complete Telegram Bot integration based on grammY, supporting command handling, inline queries, payments, and more.

Configuration

Environment Variables

Configure the following environment variables in your .env.local file:

# Telegram Bot Token (get from @BotFather)
TELEGRAM_BOT_TOKEN=your_bot_token

# Webhook secret for security verification
TELEGRAM_BOT_WEBHOOK_SECRET=your_webhook_secret

# Your website URL (for webhook setup)
NEXT_PUBLIC_APP_URL=https://your-domain.com

Development Mode

In development, use long polling mode:

pnpm bot:dev

Production Mode

In production, set up webhook:

pnpm bot:webhook

Bot Commands

The template includes the following built-in commands:

CommandDescription
/startStart the bot and show welcome message
/helpShow help information
/buyPurchase credits
/balanceCheck credit balance
/inviteGet invitation link
/supportContact support

Telegram Stars Payment

SuperTele supports Telegram Stars as a payment method:

User Initiates Payment

User clicks buy button or uses /buy command.

Display Invoice

Bot sends an invoice with product details.

Process Payment

Handle pre_checkout_query and successful_payment events.

Deliver Product

Add credits or unlock features for the user.

File Structure

src/telegram/
├── bot/
│   ├── bot.ts           # Bot instance
│   ├── commands/        # Command handlers
│   └── i18n.ts          # Internationalization
├── stars/
│   └── payment-service.ts  # Stars payment service
├── miniapp/             # MiniApp utilities
└── invite/              # Invitation system

Learn More

grammY Documentation

Learn more about the grammY framework

Telegram Bot API

Official Telegram Bot API documentation

Table of Contents

Overview
Configuration
Environment Variables
Development Mode
Production Mode
Bot Commands
Telegram Stars Payment
User Initiates Payment
Display Invoice
Process Payment
Deliver Product
File Structure
Learn More