Custom Calendar tools
Hello, i create custom calendar tools i do that
if not events:
return {
"result": f"Perfect! {date_formatted} is completely open from {time_min} to {time_max}. What time works for you?",
"available": True,
"timeSlots": [
{
"start": f"{date}T{time_min}:00",
"end": f"{date}T{time_max}:00"
}
]
}
else:
available_slots = find_available_slots(events, date, time_min, time_max)
time_slots = []
for slot_time in available_slots[:4]:
slot_start = datetime.strptime(f"{date} {slot_time}", "%Y-%m-%d %H:%M")
slot_end = slot_start + timedelta(hours=1)
time_slots.append({
"start": slot_start.isoformat(),
"end": slot_end.isoformat()
})
slots_text = ", ".join(available_slots[:4])
return {
"result": f"I have these times on {date_formatted}: {slots_text}. Which works best?",
"available": True,
"timeSlots": time_slots
}
but it says :
It seems I'm having trouble checking availability for that date. Could you please provide another date? Or let me know if mornings or afternoons work better for you?
My calendar credentials etc is ok i got 0 events it s a new one but seems not work
what is the return format VAPI want for Check Calendar Availability and same for Create event ?
Thank you
if not events:
return {
"result": f"Perfect! {date_formatted} is completely open from {time_min} to {time_max}. What time works for you?",
"available": True,
"timeSlots": [
{
"start": f"{date}T{time_min}:00",
"end": f"{date}T{time_max}:00"
}
]
}
else:
available_slots = find_available_slots(events, date, time_min, time_max)
time_slots = []
for slot_time in available_slots[:4]:
slot_start = datetime.strptime(f"{date} {slot_time}", "%Y-%m-%d %H:%M")
slot_end = slot_start + timedelta(hours=1)
time_slots.append({
"start": slot_start.isoformat(),
"end": slot_end.isoformat()
})
slots_text = ", ".join(available_slots[:4])
return {
"result": f"I have these times on {date_formatted}: {slots_text}. Which works best?",
"available": True,
"timeSlots": time_slots
}
but it says :
It seems I'm having trouble checking availability for that date. Could you please provide another date? Or let me know if mornings or afternoons work better for you?
My calendar credentials etc is ok i got 0 events it s a new one but seems not work
what is the return format VAPI want for Check Calendar Availability and same for Create event ?
Thank you