Need Help With Make.com Calendar Gap Detection Flo...
# support
p
Hey All, I’ve built most of my voice assistant using Vapi + Make and it’s working great for quoting, logging leads, and handling cancellations. Right now, I’m stuck finalizing the CheckAvailability flow for booking jobs based on real gaps in my Google Calendar. Goal: I want to return up to 3 realistic time slots for a given day and job type, using: Job duration (from GPT/OpenAI) Job-specific travel buffer Working hours (e.g., 7 AM–4 PM) Existing events in Google Calendar My current Make setup includes: Webhook from Vapi OpenAI module to calculate job duration + buffer Google Calendar: Search Events I’m trying to use a JS module to detect free time gaps long enough for the job Where I'm stuck: I’m having trouble writing clean JS inside Make to: Loop through the day’s events Insert working hours as boundary blocks Detect valid gaps (≥ duration + buffers) Return 3 formatted time slots to Vapi If anyone has a working example of this logic (gap detection between calendar events), or advice on how to simplify this setup — I’d massively appreciate it. Also open to Replit or Cloudflare Worker alternatives if that’s easier to maintain long term — but would love to finish the Make version first. Thanks in advance 🙏
v
It sounds like you have a solid setup with Vapi and Make, and you're very close to achieving your goal! For the JavaScript logic inside Make, the general approach would be to: 1. Sort your day's events by start time. 2. Add your working hours as the first and last "events" of the day to serve as boundaries. 3. Loop through the events, and for each gap between the end of one event and the start of the next, check if it's long enough for the job duration plus buffer. 4. Collect up to 3 of these valid gaps and format them as time slots. If you haven't already, try representing each event as an object with start and end times (in a consistent format), and use simple comparisons to find gaps. Once you detect a gap that's long enough, push it to an array of available slots. When you have three, you can stop the loop and return them. You're definitely on the right track, and with a bit of iteration on the JS logic, you should be able to get those time slots formatted and sent back to Vapi!
v
For detecting availability, Vapi has a google calendar integration that already has this logic built into the 'check-availability' tool. Just make sure to give the assistant the current date and time with {{now}} variable in the main prompt and include any constraints required such as working hours, returning 3 time slots, etc.
s
How can you capture the caller's phone number into the appointment description details?
v
You can pass the customer number in prompt through dynamic variable and instruct the LLM to pass it