Available

Telegram Subscription Bot

Autonomous membership management bot that processes crypto payments through Coinbase/CoinGate and drives viral growth via a custom MLM affiliate engine. Built with TypeScript, Grammy, and MongoDB. Features dynamic pricing, multi-language support, and a Next.js Mini App for enhanced user experience.

Next.jsGrammy MongoDBTypeScript (Node.js)
Telegram Subscription Bot

Building a Scalable Telegram Subscription Bot with Crypto Payments

Introduction

This project represents a high-performance Telegram bot designed to automate the management of a paid membership community. The core objective was to replace manual administration with a fully autonomous system that handles user onboarding, subscription payments, and access control around the clock. By leveraging the familiarity of Telegram's interface, the bot provides a seamless "SaaS-like" experience directly within the chat app.

Project Overview
Project Overview


Core Features

1. Automated Membership Management

The bot acts as a digital gatekeeper and sales agent. Users can browse through various membership tiers (e.g., Basic, Lifetime, Mentoring). The system is smart enough to handle upgrades logically—for example, if a user already holds a Lifetime membership, the bot hides lower-tier subscriptions and only offers Mentoring upgrades. It also enforces stack limits to prevent users from purchasing redundant plans.

2. Seamless Crypto Payments

To support a global audience, the project integrates with major cryptocurrency payment gateways (Coinbase and CoinGate). When a user selects a plan, the bot communicates with these APIs to generate a secure, time-sensitive invoice link. Upon payment confirmation, the system automatically activates the user's subscription and grants access to exclusive channels or content groups immediately.

3. 3-Tier Viral Referral System

One of the most complex features is the custom-built affiliate engine. It goes beyond simple "invite-a-friend" mechanics by implementing a 3-level Multi-Level Marketing (MLM) structure:

  • Level 1: Direct referrals
  • Level 2: Users invited by your direct referrals
  • Level 3: The extended network

Users can track their entire downline count and earnings in real-time. The system also calculates commissions based on configurable rates for each level and allows users to save their crypto wallet addresses for automated commission payouts.

4. Dynamic Discount Engine

To drive marketing campaigns, the bot includes a flexible discount system. Administrators can configure percentage-based discounts for specific plans that are valid only for a set period. The bot automatically calculates and displays the effective price (e.g., "100€ → 80€ (-20%)") to users, increasing conversion rates during sales events.

5. Multilingual & Admin Capabilities

The architecture supports internationalization (i18n), allowing the bot to serve users in their native language. On the backend, administrators have access to a suite of commands to view global statistics, manage users, and intervene if necessary.

Chat UI
Chat UI

6. Modern Telegram Mini App Integration

To provide an even richer user experience, I integrated a custom-built Telegram Mini App.

  • Tech Stack: Next.js (React)
  • Functionality: This standalone web application brings most of the bot's functionality into a beautiful, interactive UI
  • Accessibility: It is fully accessible as a standard website outside of Telegram, featuring a secure Telegram-based login system. This hybrid approach ensures users can manage their subscriptions and referrals from any device or browser with ease

Technical Architecture

Language: TypeScript (Node.js) – chosen for type safety and maintainability in a complex logic environment.

Framework: Grammy – a modern, lightweight, and fast wrapper for the Telegram Bot API.

Database: MongoDB (with Mongoose) – selected for its flexibility in handling user profiles with nested objects (like membership arrays and referral structures).

Architecture: The codebase follows a clean separation of concerns. "Services" handle database interactions, "Commands" handle user input, and dedicated modules manage external API integrations (Payment Gateways).


My Role

I was responsible for the entire product lifecycle—from conceptualizing the business logic and designing the system architecture to writing the code. I structured the database schemas, designed the referral algorithms, and implemented the full-stack solution to create a cohesive and scalable product.


Conclusion

This solution demonstrates how complex business logic—typically found in web dashboards—can be effectively implemented within a chat interface, providing a robust tool for community monetization and growth.

Marko | Vienna