optimistic-gold
optimistic-gold5mo ago

GHL Calendar booking problem

Dear Team! GHL Calendar Booking not working, wrong date request from VAP side. I'm connected to my GHL account through the native connection within VAPI. contact creation is working but calendar booking just failed. All crosshecked multiple times. What we found in the call log that VAPI something is wrong at converting the UNIX time request. Assistant know the current ime correctly but the UNIX request points back last year to 2024. I need your kind support to check where is the problem coming from and fix that. It seems this is something we can not influence. see photos enclosed. Thank you in advance. CALL ID: ef7b35b4-d94a-41ec-859b-71220b7cbd1d
No description
No description
13 Replies
Vapi Support Bot
Suggestion:
Check your GoHighLevel tool configuration in Vapi and ensure the timeZone field is set correctly (e.g., "America/New_York") and that all date/time values are generated using the current year. In your assistant's system prompt and tool metadata, explicitly format the date using the correct timezone. For example:
"metadata": {
"calendarId": "YOUR_CALENDAR_ID",
"timeZone": "America/New_York"
}
"metadata": {
"calendarId": "YOUR_CALENDAR_ID",
"timeZone": "America/New_York"
}
This helps ensure that UNIX timestamps correspond to the correct year and date. If the issue persists after confirming these settings, please contact Vapi support with your configuration details for further assistance.
Reference: GoHighLevel Tool Configuration Guide Source: - GoHighLevel Tool Configuration Guide
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
optimistic-gold
optimistic-goldOP5mo ago
all crosschecked.. That's why i contact support here.
xenial-black
xenial-black5mo ago
@Norbi AIBusiness you've got to give the agent the current date and time. add this to your system prompt: The current date and time is: {{"now" | date: "%b %d, %Y, %I:%M %p", "America/Los_Angeles"}} Change the timezone to your preferred location. That way, the agent has context on the current time and generate the correct request time for booking in the appointment
optimistic-gold
optimistic-goldOP5mo ago
it is in the prompt. Defined as well in the tool section correctly...And in the call log on the photo i enclosed you can see as well Agent knows correctly the current date and time. The LLM is generating wrong Timestamps i can not influence this in the prompt.. Any Developer from VAPI here to solve the issue?
Kyle Brunker
Kyle Brunker4mo ago
Looking into it.
equal-aqua
equal-aqua4mo ago
@Norbi AIBusiness @hj.ong9 this is a classic prompting architecture failure. The user has provided date context but failed to bridge that context to function parameter requirements. You need to explicitly mention how to convert the current date and time to the epoch timestamp and then how to pass it correctly to the tool. Also, you need to refer to where to look for the current date and time. That's why it's a classic prompting problem. Rework on your prompt to make it more explicit and deterministic in nature so that ALM can be instructed on how the insertion should work according to your requirements. Below I am writing an example which is not perfect but you can take as a reference example_for_refference
You are a helpful assistant for scheduling appointments.

CURRENT CONTEXT:
- Current Date & Time: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
- Timezone: {{userTimezone}}
- Current Year: {{"now" | date: "%Y", "{{userTimezone}}"}}

UNIX TIMESTAMP CALCULATION FOR FUNCTION CALLS:

When calling get_free_slots, you must generate accurate UNIX timestamps in milliseconds based on the current context above.

CALCULATION METHOD:
1. Always reference the current date/time: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
2. Calculate UNIX timestamps relative to this current date
3. Convert target dates to milliseconds since January 1, 1970 UTC
4. Ensure all timestamps correspond to the current year: {{"now" | date: "%Y", "{{userTimezone}}"}}

STEP-BY-STEP PROCESS:
1. Identify target date relative to current date: {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
2. For same day: Use current date at start/end of day
3. For future dates: Add days in milliseconds (86400000ms = 1 day)
4. For date ranges: Calculate start and end boundaries appropriately

FUNCTION SIGNATURE REQUIREMENTS:
get_free_slots expects:
{
"startDate": <UNIX_timestamp_in_milliseconds>,
"endDate": <UNIX_timestamp_in_milliseconds>
}

TIMESTAMP GENERATION RULES:

For "today" requests:
- Calculate UNIX timestamp for {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}} at 00:00:00
- End timestamp for same day at 23:59:59

For "tomorrow" requests:
- Add exactly 86400000ms (24 hours) to today's timestamps

For specific future dates:
- Calculate day difference from {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
- Apply: current_timestamp + (day_difference × 86400000)

For broader date ranges:
- Start from current date: {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
- Extend forward based on requested timeframe

CRITICAL VALIDATION CHECKS:
Before each get_free_slots call, verify:
1. Calculated timestamps represent dates in {{"now" | date: "%Y", "{{userTimezone}}"}} (current year)
2. For current year, timestamps should start with "17" (indicating 2025+)
3. If timestamp starts with "16" or lower, immediately recalculate
4. Ensure startDate < endDate
5. Confirm timestamps are 13 digits (milliseconds format)

ERROR PREVENTION:
- NEVER generate timestamps for previous years
- ALWAYS calculate relative to current context: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
- If unsure about calculation, break down the date conversion step by step
- Verify your target date makes logical sense given current date

EXAMPLE VALIDATION:
If current date shows 2025, your generated timestamps must also represent 2025 dates.
If you generate a timestamp starting with "16", this indicates 2024 or earlier - recalculate immediately.
You are a helpful assistant for scheduling appointments.

CURRENT CONTEXT:
- Current Date & Time: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
- Timezone: {{userTimezone}}
- Current Year: {{"now" | date: "%Y", "{{userTimezone}}"}}

UNIX TIMESTAMP CALCULATION FOR FUNCTION CALLS:

When calling get_free_slots, you must generate accurate UNIX timestamps in milliseconds based on the current context above.

CALCULATION METHOD:
1. Always reference the current date/time: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
2. Calculate UNIX timestamps relative to this current date
3. Convert target dates to milliseconds since January 1, 1970 UTC
4. Ensure all timestamps correspond to the current year: {{"now" | date: "%Y", "{{userTimezone}}"}}

STEP-BY-STEP PROCESS:
1. Identify target date relative to current date: {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
2. For same day: Use current date at start/end of day
3. For future dates: Add days in milliseconds (86400000ms = 1 day)
4. For date ranges: Calculate start and end boundaries appropriately

FUNCTION SIGNATURE REQUIREMENTS:
get_free_slots expects:
{
"startDate": <UNIX_timestamp_in_milliseconds>,
"endDate": <UNIX_timestamp_in_milliseconds>
}

TIMESTAMP GENERATION RULES:

For "today" requests:
- Calculate UNIX timestamp for {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}} at 00:00:00
- End timestamp for same day at 23:59:59

For "tomorrow" requests:
- Add exactly 86400000ms (24 hours) to today's timestamps

For specific future dates:
- Calculate day difference from {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
- Apply: current_timestamp + (day_difference × 86400000)

For broader date ranges:
- Start from current date: {{"now" | date: "%B %d, %Y", "{{userTimezone}}"}}
- Extend forward based on requested timeframe

CRITICAL VALIDATION CHECKS:
Before each get_free_slots call, verify:
1. Calculated timestamps represent dates in {{"now" | date: "%Y", "{{userTimezone}}"}} (current year)
2. For current year, timestamps should start with "17" (indicating 2025+)
3. If timestamp starts with "16" or lower, immediately recalculate
4. Ensure startDate < endDate
5. Confirm timestamps are 13 digits (milliseconds format)

ERROR PREVENTION:
- NEVER generate timestamps for previous years
- ALWAYS calculate relative to current context: {{"now" | date: "%B %d, %Y, %I:%M %p", "{{userTimezone}}"}}
- If unsure about calculation, break down the date conversion step by step
- Verify your target date makes logical sense given current date

EXAMPLE VALIDATION:
If current date shows 2025, your generated timestamps must also represent 2025 dates.
If you generate a timestamp starting with "16", this indicates 2024 or earlier - recalculate immediately.
correct-apricot
correct-apricot4mo ago
@Norbi AIBusiness did this fix the problem, I am having a related issue I think
Kyle Brunker
Kyle Brunker4mo ago
Hey @Ade, This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry.&nbsp;
correct-apricot
correct-apricot4mo ago
I see this ticket as unsolved
rare-sapphire
rare-sapphire4mo ago
Try once more @Ade , we pushed couple of changes related to it. and it should fix it.
conventional-tan
conventional-tan3mo ago
@Wes This helped me, and also, check if the time zones in the prompt, tools and calendar are the same, and ifnot, check if thats the problem. I just updated my prompt using the example that Shubham sent and it worked! Looks that we really need triple the careful and instructions for the AI be able to do it correctly
genetic-orange
genetic-orange3mo ago
I will be testing this week, thank you for the update
Kyle Brunker
Kyle Brunker3mo ago
If you require additional support, please feel free to reach out.

Did you find this page helpful?