Operations & Admin
scheduling calendar
How to Build an AI Meeting Scheduler
Let AI handle meeting scheduling by finding optimal times for all parties.
Jay Banlasan
The AI Systems Guy
This ai meeting scheduler finds optimal times across multiple calendars and books meetings without the back-and-forth emails. Automated booking that respects everyone's preferences.
What You Need Before Starting
- Python 3.8+
- Google Calendar API credentials
- Flask for webhook endpoints
- SMTP or Slack for notifications
Step 1: Connect Calendar API
Set up access to Google Calendar or Outlook.
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
def get_calendar_service(creds_path):
creds = Credentials.from_authorized_user_file(creds_path)
return build("calendar", "v3", credentials=creds)
def get_events(service, time_min, time_max):
events = service.events().list(
calendarId="primary", timeMin=time_min, timeMax=time_max,
singleEvents=True, orderBy="startTime"
).execute()
return events.get("items", [])
Step 2: Build the Logic
Implement the core meeting scheduler algorithm.
from datetime import datetime, timedelta
def find_available_slots(events, date, duration_minutes=30):
busy = [(e["start"]["dateTime"], e["end"]["dateTime"]) for e in events]
slots = []
current = datetime.combine(date, datetime.min.time().replace(hour=9))
end_of_day = current.replace(hour=17)
while current + timedelta(minutes=duration_minutes) <= end_of_day:
slot_end = current + timedelta(minutes=duration_minutes)
is_free = all(slot_end <= b[0] or current >= b[1] for b in busy)
if is_free:
slots.append({"start": current.isoformat(), "end": slot_end.isoformat()})
current += timedelta(minutes=15)
return slots
Step 3: Handle Notifications
Send confirmations and updates automatically.
def send_calendar_notification(event, recipients, notification_type):
templates = {
"confirmed": "Your {event_type} is confirmed for {time}",
"reminder": "Reminder: {event_type} in {minutes} minutes",
"cancelled": "{event_type} has been cancelled",
}
message = templates[notification_type].format(
event_type=event["summary"], time=event["start"],
minutes=event.get("reminder_minutes", 15))
for recipient in recipients:
send_email(recipient, f"Calendar: {event['summary']}", message)
Step 4: Store and Track
Keep a log of all scheduling actions.
import sqlite3
def log_scheduling_action(action_type, event_data):
conn = sqlite3.connect("scheduling.db")
conn.execute("""INSERT INTO schedule_log
(action, event_id, details, timestamp)
VALUES (?, ?, ?, ?)""",
(action_type, event_data["id"], json.dumps(event_data), datetime.now().isoformat()))
conn.commit()
Step 5: Automate the Workflow
Set up triggers and cron jobs.
# Run scheduling checks every 15 minutes during business hours
*/15 8-17 * * 1-5 cd /root/scheduler && python check_schedule.py
def run_scheduled_checks():
service = get_calendar_service("creds.json")
events = get_events(service, datetime.now().isoformat(), (datetime.now() + timedelta(hours=1)).isoformat())
for event in events:
check_and_notify(event)
What to Build Next
Add meeting type detection. Route discovery calls to 30-min slots, demos to 60-min.
Related Reading
- Building Automated Task Lists from Meeting Transcripts - automated task lists meeting transcripts
- Creating an Automated Meeting Scheduling System - automated meeting scheduling system guide
- Competitive Intelligence with AI - competitive intelligence ai automated
Want this system built for your business?
Get a free assessment. We will map every system your business needs and show you the ROI.
Get Your Free Assessment