For the complete documentation index, see llms.txt. This page is also available as Markdown.

Real-World Use Cases

Telebot Creator Documentation — Platform v7.1.2 · Telegram Bot API 10.1

This section demonstrates how to apply Telebot Creator's features and libraries in real-world scenarios. By combining workflows, advanced commands, and external integrations, you can create bots that solve practical problems and enhance user engagement.


8.1 Referral System

Overview

A referral system tracks users who invite others to the bot and rewards them with points or other incentives. This use case involves:

  1. Generating unique referral links.

  2. Tracking referrals.

  3. Rewarding users based on their referral count.

  4. Displaying leaderboards for top referrers.


Implementation

Step 1: Generate Unique Referral Links

In the /start command, include the user’s ID as a parameter to generate a referral link:

bot.sendMessage(f"Invite your friends using this link: t.me/{bot.username}?start={u}")

Step 2: Track Referrals

In the /start command, check if a referral ID is provided:

Step 3: Reward Users

Track and display referral rewards dynamically:

Step 4: Create a Leaderboard

Display the top referrers using libs.Resources:


8.2 Payment Automation Bot

Overview

This bot automates payment handling using the libs.Coinbase library. It can:

  1. Generate payment requests.

  2. Confirm payment status.

  3. Notify users of successful payments.


Implementation

Step 1: Set Up Coinbase Client

Configure the Coinbase client with your API keys:

Step 2: Generate Payment Requests

Request payment for specific amounts:

Step 3: Verify Payment Status

Check payment status using the charge ID:


8.3 Survey and Data Collection Bot

Overview

This bot collects user input for surveys or forms and stores the data in a CSV file for easy analysis.


Implementation

Step 1: Collect User Responses

Ask users a series of questions:

Store the responses:

Step 2: Save Data to CSV

Save the collected data into a CSV file using libs.CSV:


8.4 Crypto Airdrop Bot

Overview

This bot automates cryptocurrency distributions using libs.web3lib (supports all EVM chains: Ethereum, Polygon, Arbitrum, BSC, etc.).

Note: libs.Polygon, libs.ARB, libs.TTcoin, and libs.Tomochain are deprecated. Use libs.web3lib for all EVM blockchain operations.


Implementation

Step 1: Send Tokens

Step 2: Automate Multiple Transfers


8.5 Real-Time Notification Bot

Overview

This bot uses libs.Webhook to send real-time updates based on external events, such as sales or user actions.


Implementation

Step 1: Generate Webhook URL

Generate a webhook URL for notifications:

Step 2: Process Webhook Events

Handle incoming webhook events in a command:


8.6 Event Management Bot

Overview

This bot manages events, allowing users to RSVP, receive reminders, and track attendance.


Implementation

Step 1: RSVP System

Allow users to RSVP to an event:

Store responses:

Step 2: Event Reminders

Send reminders using runCommandAfter:

In the reminder command:


8.7 AI Chatbot

Overview

Build a GPT-powered conversational bot using libs.openai_lib or libs.gemini_lib.


Implementation

Command: * (Wildcard — handles all user messages)

This creates a full conversational AI bot that remembers context across messages.


8.8 Tips and Best Practices

  1. Optimize Point Usage:

    • Combine commands where possible.

    • Use wildcards (*) for unstructured messages to reduce redundant commands.

  2. Handle Large User Bases:

    • Use in-built broadcasting strategies.

    • Target active users only.

  3. Secure Data:

    • Encrypt sensitive user data.

    • Use HTTPS webhooks for secure communication.

  4. Use Error Handling:

    • Wrap external API calls in try-except blocks.

    • Log errors for debugging.

  5. Use the Account Class:

    • Share data across all your bots with Account.saveData(name, data) and Account.getData(name) (up to 10MB per key).

    • Monitor active users with Account.getStats(time_frames=["24h", "7d"]).

    • Manage bots and commands programmatically — Account.create_bot, Account.clone_bot, Account.create_command, Account.export_bot / Account.import_commands, and block users with Account.blockUser / Account.unblockUser.

Last updated