Free
Introduction
In this detailed summary, we explore the intricate process of creating an AI-powered appointment booking system.
The workflow involves multiple interconnected functions designed to capture user details, determine their time zone, fetch available time slots, and prepare the system for subsequent appointment confirmation.
This guide emphasizes clarity, structure, and technical precision, ensuring a comprehensive understanding of each component involved in the process.
The Connected Functions
The core functions of the AI agent are:
Book Appointment
Cancel Appointment
Capture User Details
Reschedule Appointment
This summary concentrates primarily on capturing user details and fetching available time slots, which are foundational to the booking process.
Step-by-Step Breakdown
1. Capturing User Details
The initial phase involves collecting essential user information:
Parameter | Description | Storage Method | Notes |
---|---|---|---|
Full Name | User's complete name |
| Must be validated; prompts if missing |
User's email address |
| Validates presence; prompts if absent | |
Phone Number | Contact number |
| Used for timezone detection |
Time Zone | User's local timezone | Derived via phone number | Ensures correct time slot display |
Implementation Highlights:
Consistency: Parameter names mirror those in the AI agent prompt for seamless integration.
Validation: Checks if parameters already exist; if so, skips prompts.
Memory Toggle: Utilizes conversation history to recall previous inputs, but accounts for new users or guest sessions.
2. Parameter Validation and Data Handling
The system performs conditional checks:
If
full_name
is empty or contains "guest", prompt the user for their name.If
email
is missing, request the email.If
phone_number
is absent, ask for the contact number.
Once validated, each parameter is saved explicitly to ensure data integrity.
3. Triggering the Workflow
After capturing all necessary details, a function call initiates the next phase:
Function Call: Executes the workflow to determine the user's timezone and fetch available slots.
Workflow Components:
Determine User's Time Zone: Uses AI task based on phone number.
Set End Date: Adds a predefined number of days (e.g., 6 days) to define the window for available slots.
Fetch Available Time Slots: Queries based on event type ID, start, and end times.
4. Determining User's Time Zone
Methodology:
Input: Phone number
Output: Time zone in
Region/City
format (e.g.,Europe/Budapest
)Process:
AI task analyzes the phone number.
Returns matched time zone.
Saved into a custom user field, e.g.,
time_zone
.
Example:
Input Phone Number | Output Time Zone | Saved As |
---|---|---|
+36123456789 | Europe/Budapest |
|
This step ensures that all subsequent time-related data aligns with the user's local time.
5. Setting the End Date for Slot Fetching
Operation: Adds a specific number of days (e.g., 6 days) to the current date.
Purpose: Defines the window for available appointment slots.
Flexibility: Can be adjusted to 7, 10, or more days based on requirements.
Implementation:
This ensures the system fetches slots within a manageable timeframe, preventing excessive data retrieval.
6. Fetching Available Time Slots
Process Overview:
Input Parameters:
Start Time: Current date/time
End Time: Calculated end date
Event Type ID: Specific to appointment category
User's Time Zone: For correct slot display
Execution:
Calls an API or internal function to retrieve slots.
Uses the
find available time slots by event slot
method.Can be customized by replacing event type ID with a bot field.
Handling Data:
Results: Multiple time slots are returned, e.g., May 30, June 2, etc.
Storage: All slots are saved into a data field, e.g.,
cal_available_time_slots
.
Error Management:
If the response exceeds 20,000 characters, reduce the number of days fetched.
For example, fetch only 7 days instead of 11 to prevent overflow.
7. Presenting Available Slots to the User
Post-fetch Actions:
Use an AI function result action to relay available slots.
Message Format:
This JSON data is then displayed to the user, enabling them to select a preferred time.
8. Next Steps and Future Enhancements
The current workflow prepares the system for appointment confirmation.
The next phase involves booking the appointment based on user-selected date and time.
Future improvements may include:
Dynamic slot filtering
User notifications
Integration with external calendar systems
Conclusion
This comprehensive workflow exemplifies a robust, user-centric approach to appointment scheduling via AI. It meticulously captures user details, intelligently determines their timezone, fetches relevant time slots, and prepares data for seamless booking. The system's modular design allows for flexibility, scalability, and customization, ensuring it can adapt to various business needs.