Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BOOK / BOOK_MEETING / CHECK_AVAILABILITY Keywords

The BOOK family of keywords provides calendar and scheduling functionality, allowing bots to create appointments, schedule meetings with attendees, and check availability.

Keywords Overview

KeywordPurpose
BOOKCreate a simple calendar appointment
BOOK_MEETINGSchedule a meeting with multiple attendees
CHECK_AVAILABILITYFind available time slots

BOOK

Creates a calendar appointment for the current user.

Syntax

result = BOOK title, description, start_time, duration_minutes, location

Parameters

ParameterTypeDescription
titleStringTitle/subject of the appointment
descriptionStringDetailed description of the appointment
start_timeStringWhen the appointment starts (see Time Formats)
duration_minutesIntegerDuration in minutes (default: 30)
locationStringLocation or meeting room

Example

' Book a dentist appointment
result = BOOK "Dentist Appointment", "Annual checkup", "2024-03-15 14:00", 60, "123 Medical Center"
TALK "Your appointment has been booked: " + result

' Book a quick meeting
result = BOOK "Team Sync", "Weekly standup", "tomorrow 10:00", 30, "Conference Room A"

BOOK_MEETING

Schedules a meeting with multiple attendees, sending calendar invites.

Syntax

result = BOOK_MEETING meeting_details, attendees

Parameters

ParameterTypeDescription
meeting_detailsJSON StringMeeting configuration object
attendeesArrayList of attendee email addresses

Meeting Details Object

{
    "title": "Meeting Title",
    "description": "Meeting description",
    "start_time": "2024-03-15 14:00",
    "duration": 60,
    "location": "Conference Room B",
    "reminder_minutes": 15,
    "recurrence": "weekly"
}

Example

' Schedule a team meeting
meeting = '{
    "title": "Sprint Planning",
    "description": "Plan next sprint tasks and priorities",
    "start_time": "Monday 09:00",
    "duration": 90,
    "location": "Main Conference Room",
    "reminder_minutes": 30
}'

attendees = ["alice@company.com", "bob@company.com", "carol@company.com"]

result = BOOK_MEETING meeting, attendees
TALK "Meeting scheduled with " + LEN(attendees) + " attendees"

CHECK_AVAILABILITY

Finds available time slots for a given date and duration.

Syntax

available_slots = CHECK_AVAILABILITY date, duration_minutes

Parameters

ParameterTypeDescription
dateStringThe date to check availability
duration_minutesIntegerRequired duration for the meeting

Example

' Check availability for a 1-hour meeting tomorrow
slots = CHECK_AVAILABILITY "tomorrow", 60

TALK "Available time slots:"
FOR EACH slot IN slots
    TALK "  - " + slot
NEXT

Time Formats

The BOOK keywords support flexible time formats:

Absolute Formats

FormatExample
ISO 8601"2024-03-15T14:00:00"
Date + Time"2024-03-15 14:00"
Date + Time (12h)"2024-03-15 2:00 PM"

Relative Formats

FormatExample
Day name"Monday 10:00"
Relative day"tomorrow 14:00"
Next week"next Tuesday 09:00"

Complete Example: Appointment Scheduling Bot

' appointment-bot.bas
' A complete appointment scheduling workflow

TALK "Welcome to our scheduling assistant!"
TALK "What type of appointment would you like to book?"

HEAR appointment_type

SWITCH appointment_type
    CASE "consultation"
        duration = 60
        description = "Initial consultation meeting"
    CASE "follow-up"
        duration = 30
        description = "Follow-up discussion"
    CASE "review"
        duration = 45
        description = "Project review session"
    DEFAULT
        duration = 30
        description = appointment_type
END SWITCH

TALK "When would you like to schedule this?"
HEAR preferred_date

' Check available slots
slots = CHECK_AVAILABILITY preferred_date, duration

IF LEN(slots) = 0 THEN
    TALK "Sorry, no availability on that date. Please try another day."
ELSE
    TALK "Available times:"
    index = 1
    FOR EACH slot IN slots
        TALK index + ". " + slot
        index = index + 1
    NEXT
    
    TALK "Which time slot would you prefer? (enter number)"
    HEAR choice
    
    selected_time = slots[choice - 1]
    
    TALK "Where would you like the meeting to take place?"
    HEAR location
    
    ' Book the appointment
    result = BOOK appointment_type, description, selected_time, duration, location
    
    TALK "✅ Your appointment has been booked!"
    TALK "Details: " + result
END IF

Meeting with Recurrence

' Schedule a recurring weekly meeting
meeting = '{
    "title": "Weekly Team Standup",
    "description": "Daily sync on project progress",
    "start_time": "Monday 09:00",
    "duration": 15,
    "location": "Virtual - Teams",
    "reminder_minutes": 5,
    "recurrence": {
        "frequency": "weekly",
        "interval": 1,
        "count": 12,
        "by_day": ["MO", "WE", "FR"]
    }
}'

attendees = ["team@company.com"]
result = BOOK_MEETING meeting, attendees

Event Status

Calendar events can have the following statuses:

StatusDescription
ConfirmedEvent is confirmed and scheduled
TentativeEvent is tentatively scheduled
CancelledEvent has been cancelled

Calendar Event Structure

When an event is created, it contains:

{
    "id": "uuid",
    "title": "Meeting Title",
    "description": "Description",
    "start_time": "2024-03-15T14:00:00Z",
    "end_time": "2024-03-15T15:00:00Z",
    "location": "Conference Room",
    "organizer": "user@example.com",
    "attendees": ["attendee1@example.com"],
    "reminder_minutes": 15,
    "recurrence_rule": null,
    "status": "Confirmed",
    "created_at": "2024-03-10T10:00:00Z",
    "updated_at": "2024-03-10T10:00:00Z"
}

Configuration

To enable calendar functionality, configure the following in config.csv:

KeyDescription
calendar-providerCalendar service (google, outlook, caldav)
calendar-client-idOAuth client ID
calendar-client-secretOAuth client secret
calendar-default-reminderDefault reminder time in minutes

Error Handling

' Handle booking errors gracefully
ON ERROR GOTO handle_error

result = BOOK "Meeting", "Description", "invalid-date", 30, "Location"
TALK "Booked: " + result
END

handle_error:
    TALK "Sorry, I couldn't book that appointment. Please check the date and time format."
    TALK "Error: " + ERROR_MESSAGE
END

Best Practices

  1. Always check availability first: Before booking, use CHECK_AVAILABILITY to ensure the time slot is free.

  2. Use descriptive titles: Make appointment titles clear and searchable.

  3. Set appropriate reminders: Configure reminder times based on appointment importance.

  4. Handle time zones: Be explicit about time zones when scheduling across regions.

  5. Validate inputs: Check user-provided dates and times before attempting to book.

  • SET SCHEDULE - Schedule recurring bot tasks
  • WAIT - Pause execution for a duration
  • SEND MAIL - Send meeting confirmations via email

See Also