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.
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
When a customer messages your Telegram bot, ClickRuntime checks your Google Calendar for free slots in the coming days.
The bot replies with the free times as buttons.
When the customer taps a time, ClickRuntime checks it is still free and adds the booking to your calendar.
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
Build your own
Need it to work differently?
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
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?
How far ahead can people book?
What if two people pick the same slot?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Add website bookings to Google Calendar with a Telegram alert
Bookings from your website go straight into your calendar when you are free, and you get a Telegram message for each one.
See how it worksManage your Google Calendar by messaging a Telegram bot
Text your Telegram bot to add an event or ask what is on a given day, and it updates or reads your Google Calendar for you.
See how it worksGet a Telegram reminder before each meeting
A few minutes before each meeting you get a Telegram message with the time, the join link and a short prep note.
See how it worksKeep exploring
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.