Telegram bot that acts as a 24/7 booking assistant for service businesses. Built with Claude AI + Cal.com API integration.
- 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
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
- 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
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.
git clone https://github.com/elijahvasylchenko/ai-booking-agent-telegram
cd ai-booking-bot
pip install -r requirements.txtCreate .env:
ANTHROPIC_API_KEY=your_key
CAL_API_KEY=your_key
BOT_TOKEN=your_telegram_bot_token
Run:
python main.pyTool calling loop — handles multi-step AI reasoning:
while response.stop_reason == "tool_use":
# execute tool, append result, call Claude againTimezone conversion — slots returned in UTC, displayed in Kyiv time:
# UTC timestamp preserved for booking API
# Kyiv time shown to the client
start_utc → create_booking()
start_kyiv → shown to userConversation memory — per-user history with deque(maxlen=20):
chat_histories[user_id] = deque(maxlen=20)| Service | Duration | Price | Cal.com Event ID |
|---|---|---|---|
| AI Automation Audit | 60 min | $100 | 5165179 |
| Custom Workflow Setup | 30 min | negotiable | 4921514 |
Illia Vasylchenko — AI Automation Engineer github.com/elijahvasylchenko