Hello,
I'm looking to create a workflow that allows me to make a call via Telegram and retrieve one or more available 45-minute slots from my Google Calendar within a specified period.
I can successfully retrieve a single slot if I provide a start and end time, but I'm having trouble getting it to return all available free slots within a given date range.
How can I achieve this?
Thanks,
Frédéric
(Apologies for any English errors, I'm French)
My workflow:
Hello there!
I hope you’re doing well!
I know it’s been a while, but in case you haven't found a solution yet, here’s my approach:
Here’s what it does:
1 - Retrieves the date provided by the trigger and converts it into the ISO format required by Google Calendar. (The "-03:00" here reflects my local timezone; please adjust it as needed!)
I've set the working hours from 9 AM to 5 PM, but you can modify this to your preference.
2 - It accesses the Google Calendar "freeBusy" endpoint to fetch all currently unavailable time slots. This also uses my timezone, so remember to change it to your desired one.
3 - A code node is utilized to compare all the time slots and isolate only the available ones.
You can set up a new workflow and have an AI call it whenever you need the available time slots, and it will provide them.
Are you currently using the Google Calendar node in callin.io or making API calls directly?
You can try using Google Calendar’s Freebusy API with a loop.
- Instead of asking for one slot, use the “Freebusy” endpoint to get all busy times between your two dates.
- Then, write a small loop (or use a Function node) to scan through the period, checking where the calendar is free for at least 45 minutes.
- Collect all those free slots and return them.
- This way, you get all free slots, not just one.
You could also use multiple “Time Range” queries and combine results:
- Split your total period into smaller chunks (like every day or every few hours).
- For each chunk, query for free slots of 45 minutes.
- Then aggregate these slots from each chunk into a full list to return.
Hope this helps. Cheers!