Skip to content

The moment it happens

Let customers book appointments through your Telegram bot

Customers message your Telegram bot, pick a free slot from buttons, and the booking appears in your Google Calendar.

Runs
The moment it happens
Apps
Google Calendar, Telegram
AI
Optional
Access
calendar read+write; bot token

Send this to your assistant

Create a ClickRuntime automation: let customers message my Telegram bot to book: show my free slots from Google Calendar as buttons and create the event when they pick one.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A barber runs his bookings through Telegram messages. Customers ask 'any time Thursday?', he checks his calendar between cuts, replies, and by the time they answer the slot has gone to someone else.

A bot that shows real free times and books the chosen one straight into your calendar lets customers book in seconds, at any hour, without you replying to each message.

What you get out of it

  • Customers book at any hour

    Late-evening and early-morning requests are handled straight away instead of waiting for your reply.

  • Only real free times are offered

    Slots come from your Google Calendar, so customers cannot pick a time you are already busy.

  • Bookings land where you work

    Each booking is a calendar event with the customer's name, so your day is already planned.

  • Fewer messages to answer

    The back-and-forth of agreeing a time disappears, leaving you to reply only to real questions.

How it works

What happens, step by step

  1. When a customer messages your Telegram bot, ClickRuntime checks your Google Calendar for free slots in the coming days.

  2. The bot replies with the free times as buttons.

  3. When the customer taps a time, ClickRuntime checks it is still free and adds the booking to your calendar.

  4. The customer gets a confirmation message in Telegram.

Before it runs live

  • Connect Google Calendar
  • Connect Telegram
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Let customers book appointments through your Telegram botjust nowSucceeded
Telegram · Northwind Barbers botYou're booked for Thursday 23 October at 14:00. See you then!

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Google Calendar and Telegram steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
appointment_booking_bot_for_customers_on_telegram.pyexample
from datetime import datetime, timedelta, timezone
from clickruntime import on_event, credentials, http
CAL = "https://www.googleapis.com/calendar/v3"
def free_slots(h):
    now = datetime.now(timezone.utc).replace(minute=0, second=0, microsecond=0) + timedelta(hours=1)
    busy = http.post(f"{CAL}/freeBusy", headers=h, json={"timeMin": now.isoformat(), "timeMax": (now + timedelta(days=7)).isoformat(),
                     "items": [{"id": "primary"}]}).json()["calendars"]["primary"]["busy"]
    slots = [now + timedelta(hours=i) for i in range(168)]
    return [s for s in slots if s.weekday() < 6 and 9 <= s.hour < 18 and all(
        s + timedelta(hours=1) <= datetime.fromisoformat(b["start"]) or s >= datetime.fromisoformat(b["end"]) for b in busy)][:6]
@on_event
def handle(event):
    u = event.json or {}
    tg = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
    h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
    if "callback_query" in u:
        q = u["callback_query"]
        start = datetime.fromisoformat(q["data"])
        if start in free_slots(h):
            http.post(f"{CAL}/calendars/primary/events", headers=h, json={"summary": f"Booking: {q['from'].get('first_name')}",
                      "start": {"dateTime": start.isoformat()}, "end": {"dateTime": (start + timedelta(hours=1)).isoformat()}})
            text = f"You're booked for {start:%A %d %B at %H:%M}. See you then!"
        else:
            text = "Sorry, that time has just gone. Send any message to see fresh times."
        http.post(f"{tg}/sendMessage", json={"chat_id": q["message"]["chat"]["id"], "text": text})
        return {"booked": "You're" in text}
    buttons = [[{"text": f"{s:%a %d %b %H:%M}", "callback_data": s.isoformat()}] for s in free_slots(h)]
    http.post(f"{tg}/sendMessage", json={"chat_id": u["message"]["chat"]["id"], "text": "Pick a time:", "reply_markup": {"inline_keyboard": buttons}})
    return {"offered": len(buttons)}

FAQ

Common questions

How does a customer start a booking?
They send any message to your bot, such as /book or 'hi'. The bot replies with the next available times as buttons.
How far ahead can people book?
As far as you choose, for example the next 7 days within your opening hours.
What if two people pick the same slot?
The slot is checked again before booking. The second person is told it has just gone and shown fresh times.
What permissions does it need?
calendar read+write; bot token. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Let customers book appointments through your Telegram bot” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.