Skip to content

Repository files navigation

AI Booking Assistant — Telegram Bot

Telegram bot that acts as a 24/7 booking assistant for service businesses. Built with Claude AI + Cal.com API integration.

What it does

  • Qualifies leads via natural conversation
  • Checks real-time availability from Cal.com calendar
  • Creates confirmed bookings automatically
  • Handles timezone conversion (UTC → Kyiv time)
  • Maintains conversation history per user
  • Shows "typing..." indicator during processing

Demo flow

User: I want to book a consultation

Bot: Which service? Audit ($100) or Custom Setup (negotiable)?

User: Audit, tomorrow at 4pm

Bot: I need your name and email first

User: John / john@example.com

Bot: 4 PM is not available. Open slots: 10:00, 11:00, 12:00, 13:00

User: 1 pm works

Bot: ✅ Booked! Thursday June 18 at 1:00 PM. Confirmation sent to john@example.com

Stack

  • Python + aiogram 3 (async Telegram bot framework)
  • Anthropic Claude (claude-haiku) — conversation + tool calling
  • Cal.com API v2 — real-time slot availability + booking creation
  • httpx — async HTTP client

Architecture

User message

aiogram handler

Claude API (with tools)

├── tool_use: get_available_slots → Cal.com API → format UTC to Kyiv TZ

├── tool_use: create_booking → Cal.com API → confirmation

└── end_turn → send reply to user

The bot uses a while loop to handle chained tool calls — Claude can check availability and create a booking in a single conversation turn without extra user input.

Setup

git clone https://github.com/elijahvasylchenko/ai-booking-agent-telegram
cd ai-booking-bot
pip install -r requirements.txt

Create .env: ANTHROPIC_API_KEY=your_key

CAL_API_KEY=your_key

BOT_TOKEN=your_telegram_bot_token

Run:

python main.py

Key implementation details

Tool calling loop — handles multi-step AI reasoning:

while response.stop_reason == "tool_use":
    # execute tool, append result, call Claude again

Timezone conversion — slots returned in UTC, displayed in Kyiv time:

# UTC timestamp preserved for booking API
# Kyiv time shown to the client
start_utccreate_booking()
start_kyivshown to user

Conversation memory — per-user history with deque(maxlen=20):

chat_histories[user_id] = deque(maxlen=20)

Services configured

Service Duration Price Cal.com Event ID
AI Automation Audit 60 min $100 5165179
Custom Workflow Setup 30 min negotiable 4921514

Author

Illia Vasylchenko — AI Automation Engineer github.com/elijahvasylchenko

About

24/7 Telegram booking assistant built with Python — Claude AI tool calling + Cal.com API. Qualifies leads, checks real-time availability, and creates confirmed bookings automatically.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages