Telegram app icon (Logo)

Build a Telegram Client Management Bot with Python | Freelancer Guide

|

Learn how to build a professional Telegram bot using Python to automate client communication, showcase your portfolio, and estimate project costs instantly.

Word Count: ~850 · Reading Time: 4 minutes

Note: This article is completely modular and standalone. However, if you are an absolute beginner to programming, we highly recommend starting from the very first article in this series:
Why Every Freelancer Working in Web Should Learn Python in 2026 to build your foundational knowledge step by step.

How many times have you lost two or three hours of your valuable day answering the exact same questions from prospective clients? “How much for a basic landing page?”, “Are you available for work right now?”, “Where can I see your portfolio?”. While these conversations are crucial for closing deals, they drain energy that you could otherwise spend on actual development work—the kind that directly generates income.

In 2026, manually playing the role of both secretary and developer is no longer efficient. The answer lies in smart automation. By building a simple bot on communication platforms like Telegram or WhatsApp, you can deploy a 24/7 digital assistant. This script can answer client inquiries, display your rate card, share your portfolio links, and even calculate a rough project estimate before a human ever steps in.

In this practical guide from Zy Yazan Platform, we will build a smart, custom Telegram bot to manage your freelance clients using Python. We selected Telegram because it allows developers to build bots completely free of charge, with no arbitrary restrictions or upfront verification fees—unlike the WhatsApp Business API, which requires paid third-party brokers and complex corporate documentation for beginners.

Telegram vs. WhatsApp: A Quick Freelancer Breakdown

Before writing any code, let us look at why Telegram is the ideal starting point for your freelance automation workflows:

Feature Telegram Bot WhatsApp Business API
Cost 100% Free with generous rate limits. Paid per conversation (via providers like Twilio).
Setup Complexity 2 minutes via chat with BotFather. Requires a registered business and Meta Business Manager.
UI Customization Highly flexible keyboard menus and inline buttons. Strict template guidelines and limited button layouts.

For speed, efficiency, and zero overhead costs, Telegram is our clear winner today.

Step 1: Create Your Bot via BotFather

Creating a Telegram bot requires no complicated developer account sign-ups. You handle the entire process directly inside Telegram via an official bot named BotFather.

  1. Open Telegram and search for @BotFather (look for the blue verification checkmark to avoid copycats).
  2. Click Start and send the command: /newbot.
  3. Enter a display name for your bot (e.g., Zy Yazan Assistant).
  4. Choose a unique username that must end in “bot” (e.g., ZyYazanAssistant_bot).
  5. Once approved, BotFather will send you an API Token (a long string of characters and numbers). Keep this token completely secure; anyone who has access to it can control your bot.

Step 2: Environment Setup and Library Installation

Let us move to your local development machine. To interface Python with the Telegram API seamlessly, we will use a highly stable and popular wrapper library called pyTelegramBotAPI.

Open your terminal or command prompt and execute the following installation command:

pip install pyTelegramBotAPI

Step 3: Writing the Client Management Script

Now, let us write the comprehensive Python script. This bot will welcome new users and generate an interactive menu offering four distinct paths: Rates & Services, Portfolio, Cost Calculator, and Leaving a Message.

Create a new file named client_bot.py and add the following complete code block. Make sure to replace the placeholder string with your actual API token:

import telebot
from telebot import types

# Replace with the API token you received from BotFather
BOT_TOKEN = "YOUR_ACTUAL_TELEGRAM_BOT_TOKEN_HERE"

bot = telebot.TeleBot(BOT_TOKEN)

# Handle the /start and /help commands
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    welcome_text = (
        "Welcome to Zy Yazan Technical Services! 🚀\n\n"
        "I am your automated assistant, here to save your time and answer your questions. "
        "Please select an option from the menu below:"
    )
    
    # Create an interactive keyboard layout
    markup = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
    btn_services = types.KeyboardButton("💼 Services & Rates")
    btn_portfolio = types.KeyboardButton("🌐 Our Portfolio")
    btn_calculator = types.KeyboardButton("🧮 Cost Calculator")
    btn_contact = types.KeyboardButton("📩 Leave a Message")
    
    markup.add(btn_services, btn_portfolio, btn_calculator, btn_contact)
    bot.reply_to(message, welcome_text, reply_markup=markup)

# Handle incoming text selections
@bot.message_handler(func=lambda message: True)
def handle_messages(message):
    if message.text == "💼 Services & Rates":
        services_text = (
            "✨ **Current Available Services:**\n\n"
            "1️⃣ **Static Web Development:** Starting at $300.\n"
            "2️⃣ **Python Automation & Bots:** Starting at $200.\n"
            "3️⃣ **Dynamic Web Apps (Flask/Django):** Starting at $600.\n\n"
            "💡 All projects include 1 month of free technical support."
        )
        bot.reply_to(message, services_text, parse_mode="Markdown")
        
    elif message.text == "🌐 Our Portfolio":
        portfolio_text = (
            "We love sharing our success stories! 🎯\n\n"
            "You can browse our active code repositories and web projects directly at:\n"
            "🔗 https://zyyazan.synn"
            "Let us know if a specific project catches your eye!"
        )
        bot.reply_to(message, portfolio_text)
        
    elif message.text == "🧮 Cost Calculator":
        calc_instruction = (
            "💡 **Smart Instant Estimation:**\n\n"
            "To calculate a rough project estimate, send a message starting with the word 'estimate' "
            "followed by the type of project. Examples:\n"
            "`estimate landing page`\n"
            "`estimate e-commerce`"
        )
        bot.reply_to(message, calc_instruction, parse_mode="Markdown")
        
    elif message.text == "📩 Leave a Message":
        contact_text = (
            "Your time is incredibly valuable to us. 🤝\n\n"
            "Please type your project details or question right here in the next message. "
            "The developer will review it and reply personally within 4 hours."
        )
        bot.reply_to(message, contact_text)
        
    # Basic logic engine: Process calculation requests
    elif message.text.lower().startswith("estimate"):
        project_type = message.text.lower().replace("estimate", "").strip()
        
        if "landing" in project_type or "static" in project_type:
            price_estimate = "💰 Estimated Cost for a Static Site: $300 - $450. Delivery: 5 days."
        elif "e-commerce" in project_type or "store" in project_type:
            price_estimate = "💰 Estimated Cost for an E-commerce Platform: $800 - $1500. Delivery: 14 days."
        elif "bot" in project_type or "automation" in project_type:
            price_estimate = "💰 Estimated Cost for Automation/Bots: $200 - $400. Delivery: 3 days."
        else:
            price_estimate = "❓ Project type not recognized. Our custom development rates begin at $200. Please leave your specific details, and the developer will provide a tailored quote."
            
        bot.reply_to(message, price_estimate)
        
    else:
        # Fallback response to keep user engaged
        default_response = "Message received successfully! I have passed this along to the developer. If you want to view the main menu again, just send /start."
        bot.reply_to(message, default_response)

# Start the continuous polling loop
if __name__ == "__main__":
    print("🤖 Bot is currently listening for incoming messages...")
    bot.infinity_polling()

How the Bot Works Under the Hood

This script runs on an architectural pattern known as Event Handlers. Let us break down the critical functions:

  • The @bot.message_handler Decorator: This instructs Python to trigger the underlying function only when incoming messages match specific criteria (such as a /start command or text filter).
  • The types.ReplyKeyboardMarkup Class: This handles the generation of the client-facing buttons. Setting resize_keyboard=True ensures that the menu dynamically adapts to mobile screens, tablet displays, and laptops without awkward stretching.
  • The bot.infinity_polling() Method: This sets up a non-blocking loop that continuously checks Telegram’s servers for fresh events, guaranteeing real-time response speeds for your clients.

Step 4: Running and Testing Locally

To run your script locally, execute the file from your console environment:

python client_bot.py

You should see the message “Bot is currently listening…”. Open Telegram, go to your bot’s chat interface, and click Start. Your automated digital companion is now fully operational!

Step 5: Deploying Your Bot to the Cloud (24/7 Runtime)

Running the script on your laptop is perfect for testing, but as soon as you close your lid or lose internet connection, your bot goes offline. A professional freelance pipeline requires zero downtime.

To keep your bot running perpetually, you must upload your script to a cloud environment or a managed Python hosting solution. Excellent cloud options for freelancers include:

  1. PythonAnywhere: Offers a highly reliable free tier where you can upload your script and set it as an “Always-on task” with a single click, completely abstracting away linux server management.
  2. Render or Heroku: Excellent PaaS platforms that allow you to deploy simple background service scripts straight from a GitHub repository, offering scalable pricing plans as your client roster grows.

The Next Horizon: Moving from Bot to CRM

What we built today is a highly efficient triage system. However, you can eventually evolve this script into a full Customer Relationship Management (CRM) tool. By integrating database connections, you can track user history, log incoming project leads automatically, and configure instant push notifications to your personal account whenever a high-ticket client requests an explicit consultation.

Recommended Next Step:

Now that your front-facing communications are automated, it is time to build backend scripts that track your internal finances, log billable hours, and generate client invoices programmatically.

Join us in Part 8 of our series: Manage Your Projects, Time, and Invoices Using Python.


Documentation & References:

  1. Official pyTelegramBotAPI Open Source Repository: pyTelegramBotAPI GitHub
  2. Core Telegram Bot API Developer Guidelines: Telegram Bots API Documentation

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *