Free
Introduction
In this comprehensive guide, we explore a powerful and customizable feature that enables you to replace traditional scheduling tools like Calendly with a fully integrated, chatbot-driven appointment booking system.
This innovative approach leverages the Air Charity CRM API v2 to fetch available calendar slots, format them for user-friendly display, and seamlessly create appointments—all within your chatbot environment.
The process involves fetching free slots, formatting dates, saving data dynamically, and creating appointments programmatically, offering a flexible alternative to third-party scheduling tools.
In this video we are using some JS nodes. The link to the codes can be found here: https://drive.google.com/file/d/1vqm7sBrW2jSwPPIY5F067vN-_xEQLwf-/view?usp=share_link
Step-by-Step Breakdown of the Booking System
1. Fetching Available Calendar Slots
Prerequisites:
Integration of your CRM with the chatbot.
Access to the CRM Version 2 API actions.
Key Actions:
Get Calendars: Retrieve all calendars to identify the relevant calendar ID.
Get Users: Fetch user IDs associated with calendars, especially if multiple users are involved.
Implementation:
Use the "Get Calendars" action to obtain calendar IDs.
Use the "Get Users" action to fetch user IDs, possibly filtering by name.
Map these IDs into variables or bot fields for subsequent use.
Data Inputs Needed:
Calendar ID
User ID
Start Date & End Date: Can be static or dynamic (e.g., current date + 7 days).
Time Zone: Critical for international bookings; defaults to calendar's timezone if left blank.
Sample Request:
Outcome:
Returns a list of available time slots within the specified date range, adjusted for the specified timezone.
2. Dynamic Date Range and Time Zone Handling
Adjusting Date Range:
Use system variables like "now" or "today" for dynamic start dates.
Add days programmatically (e.g., +10 days) to set the end date.
Time Zone Considerations:
Default to calendar's timezone if none specified.
For international users, request timezone info dynamically.
The API automatically adjusts slots based on the provided timezone.
Example:
Fetch slots for 3 days starting from today.
Adjust timezone to America/New_York or Asia/Tokyo as needed.
Sample Output:
Slots from 28th January to 30th January, with times adjusted to the user's timezone.
3. Storing and Formatting Free Slots
Saving Slots:
Store the fetched free slots in a JSON custom field (e.g.,
calendar_free_date_time
).Example JSON structure:
Formatting Dates for User Display:
Use JavaScript libraries like Day.js to convert raw date strings into readable formats (e.g., "27th of January").
Implement a small script (provided in the video description) to format dates dynamically.
Implementation:
Map the formatted dates into a choice block for user selection.
Display options like:
"27th of January"
"28th of January"
User Selection:
Save the selected date in a custom field (e.g.,
calendar_date_selected
).
4. Fetching and Displaying Available Time Slots
Based on User's Date Choice:
Use the selected date to filter the stored JSON.
Fetch available time slots for that specific date.
Formatting Times:
Use JavaScript to format times into more readable formats (e.g., "10:00 AM" instead of "10:00").
Save formatted times in a JSON field (e.g.,
calendar_free_times
).
Display Options:
Present the user with a list of formatted times:
"10:00 AM"
"11:00 AM"
"2:00 PM"
User Choice:
Save the selected time in a custom field (e.g.,
calendar_time_selected
).
5. Confirming and Saving the Appointment
Combine Date & Time:
Concatenate the selected date and time into a single datetime string.
Save this in a custom field (e.g.,
calendar_selected_date_time_format
).
Create Contact if Needed:
Check if the contact exists via system contact ID.
If not, create a new contact and store the contact ID.
Create the Calendar Appointment:
Use the "Create Appointment" API action.
Map:
Contact ID
Calendar ID
Start Time: The unformatted date-time string.
End Time: Based on default event duration (e.g., 30 mins).
Title & Status: e.g., "New Appointment".
User ID
Additional details: Address, meeting link, etc.
Outcome:
The appointment is scheduled directly in the CRM calendar.
The system returns a meeting ID for future modifications.
Summary
This innovative approach transforms your chatbot into a fully functional scheduling assistant, capable of fetching real-time availability, formatting data for user-friendly interaction, and creating appointments seamlessly within your CRM.
By leveraging API actions, dynamic date handling, and JavaScript formatting, you can replace third-party tools like Calendly with a custom, integrated solution tailored to your needs.
Key Benefits:
Full customization of booking flow.
International support via timezone adjustments.
Enhanced user experience with formatted dates and times.
Automated appointment creation reduces manual effort.
Flexibility to adapt to various scheduling scenarios.
Final Tips
Test thoroughly with different date ranges and time zones.
Secure API keys and sensitive data.
Optimize user prompts for clarity.
Maintain data consistency across custom fields.
Iterate and improve based on user feedback.
By implementing this system, you empower your chatbot to handle bookings 24/7, reduce no-shows, and streamline your scheduling process—all within your existing CRM infrastructure.
If you have questions or want more tutorials, stay tuned for future updates, and don't hesitate to share your feedback!