DEV Community

Cover image for Programming a Booking Bot for Cleaning Services with Telegram and Python
Bruce Silva
Bruce Silva

Posted on

Programming a Booking Bot for Cleaning Services with Telegram and Python

Have you ever forgotten to book a cleaning service and found yourself frantically sweeping the floor before guests arrived? Yeah, I’ve been there. A few months ago, I was scrambling to get my apartment in shape, and that’s when I thought, “Why not automate this whole thing?” That’s how I ended up building a booking bot using Telegram and Python. And guess what? It’s easier than you’d think.

Why Automate Your Bookings?

So here’s the thing: booking systems take time. You’ve got calls, emails, back-and-forth messages… ugh. By using a Telegram bot, you can automate the entire process in one place. People love the convenience, and you’ll save hours each week. Plus, if you’re running a local service like Chicago House Cleaning, clients can book directly without ever leaving the app.

The Basics: What You Need

Before jumping into the how-to, let me run you through five simple concepts (but in plain English):

  1. Telegram Bot API – This is the tool that lets you chat with users and receive their booking details.
  2. Python – Your coding language of choice. It’s flexible and easy to learn.
  3. Database – Where you’ll store your clients’ bookings.
  4. Scheduler – A way to automatically remind customers about their appointments.
  5. Payment Gateway – Optional, but nice if you want customers to pay up-front.

Now, you’re probably thinking, "Okay, but how does this actually work?" Let me break it down step-by-step.

How to Build Your Bot (Without Losing Your Mind)

  1. Create your bot on Telegram: Go to BotFather (that’s literally the name), type /newbot, and follow the prompts. You’ll get a token—save it.
  2. Set up your Python environment: Install python-telegram-bot with pip install. That library makes it super easy to talk to Telegram’s API.
  3. Build the conversation flow: I used ConversationHandler to ask users for their name, date, and service type. Think: "What day works for you?" "Morning or afternoon?"

Python Code Example

from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ConversationHandler, MessageHandler, filters, ContextTypes

NAME, DATE, SERVICE = range(3)

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Welcome! What's your name?")
    return NAME

async def get_name(update: Update, context: ContextTypes.DEFAULT_TYPE):
    context.user_data['name'] = update.message.text
    await update.message.reply_text("Great! What date works for you?")
    return DATE

async def get_date(update: Update, context: ContextTypes.DEFAULT_TYPE):
    context.user_data['date'] = update.message.text
    await update.message.reply_text("What service do you need?")
    return SERVICE

async def get_service(update: Update, context: ContextTypes.DEFAULT_TYPE):
    context.user_data['service'] = update.message.text
    await update.message.reply_text(f"Thanks {context.user_data['name']}! Your booking for {context.user_data['service']} on {context.user_data['date']} is saved.")
    return ConversationHandler.END

async def cancel(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text("Booking canceled.")
    return ConversationHandler.END

app = ApplicationBuilder().token("YOUR_TELEGRAM_BOT_TOKEN").build()

conv_handler = ConversationHandler(
    entry_points=[CommandHandler("start", start)],
    states={
        NAME: [MessageHandler(filters.TEXT & ~filters.COMMAND, get_name)],
        DATE: [MessageHandler(filters.TEXT & ~filters.COMMAND, get_date)],
        SERVICE: [MessageHandler(filters.TEXT & ~filters.COMMAND, get_service)],
    },
    fallbacks=[CommandHandler("cancel", cancel)],
)

app.add_handler(conv_handler)

print("Bot is running...")
app.run_polling()
Enter fullscreen mode Exit fullscreen mode
  1. Store data in a database: SQLite works great for small projects, but if you’re running a bigger service, use PostgreSQL.
  2. Add reminders: With Python’s schedule library, you can ping customers a day before their appointment.

This might sound like a lot, but once you get through the first few steps, the rest just… clicks.

Real-World Example

I tested the bot with a small group of friends who run a House Cleaning Chicago Il business. They were manually juggling texts and emails before. After the bot? Customers booked straight through Telegram, they got reminders, and payments became seamless. My friends said they finally had time to breathe—no more chaos.

Why This Matters for You

Here’s what happens when you automate your booking process:

  • You spend way less time answering repetitive questions.
  • Clients can book 24/7, even when you’re asleep.
  • You cut down on no-shows with automatic reminders.
  • Your service feels more professional (and yeah, customers notice).

I mean, I didn’t expect it to make such a difference, but it really did.

Tools and Resources You’ll Want

  • Python 3 (obvious but important)
  • python-telegram-bot library
  • SQLite or PostgreSQL
  • Optional: Stripe or PayPal API for payments

You don’t need to be a tech wizard. If you can follow instructions, you’ll get it working.

Wrap It Up

Look, whether you’re running a local House Cleaning In Chicago service or any small business, a booking bot will save you time and sanity. Give it a try this week—you’ll see! And hey, once you get the hang of it, you might even start wondering what else you could automate.

Top comments (0)