https://retellai.com/?utm_source=discord&utm_medium=seo logo
whats the best practice/way for handling timezone ...
# ❓・ai-evy-support
h
whats the best practice/way for handling timezone conversion/booking with GPT 4.1 or if not specifically with gpt 4.1 atleast give me general best practices of whats worked for other people or that you reccomend, give me full guideance from prompting to tools ect @AI Evy
a
Thanks for tagging me @hans_70884. I'll look through relevant sources and get back to you shortly.
### Answer I don't have specific documentation about timezone handling or booking workflows with GPT-4.1 in the available Retell AI sources. However, I can provide general best practices for handling timezone conversion and booking with Retell AI agents: ## General Best Practices for Timezone & Booking Prompting Strategy: - Include explicit timezone handling instructions in your agent's system prompt - Specify that the agent should always ask for and confirm the user's timezone - Instruct the agent to convert times to a standard format (like UTC) before processing Tool/Function Calling Approach: - Create a custom function for timezone conversion that accepts user timezone and target timezone - Build a booking tool that requires timezone as a mandatory parameter - Include validation logic to ensure timezone data is captured before proceeding with bookings Recommended Workflow: 1. Capture timezone early - Have your agent ask "What timezone are you in?" at the start of booking conversations 2. Standardize internally - Convert all times to UTC for storage and processing 3. Confirm with user - Always repeat back the appointment time in the user's local timezone before finalizing 4. Use structured data - Pass timezone information as structured parameters in your tool calls (e.g.,
{"timezone": "America/New_York", "appointment_time": "2025-01-15T14:00:00"}
) Dynamic Variables: If you have timezone information from your CRM or previous interactions, you can inject it using dynamic variables in your agent configuration to personalize the conversation from the start. Since I don't have Retell AI-specific documentation on this topic, would you like me to provide a more general answer based on common patterns for voice AI timezone handling? Alternatively, you can: - Visit [Contact Sales]() for specific imple
mentation guidance - Check [Retell AI GitHub]() for example implementations
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
message has been deleted
h
OK, SO ESSENTIALLY ALL MY TIMES COMING FROM CHECK_SLOTS ARE IN AUSTRALIAN EASTERN TIME SO AEDT AND ESSENTIALLY I'M DEALING WITH MULTIPLE TIME ZONES HERE NOW ALL OF THE SLOTS ARE IN OBVIOUSLY LIKE THE ISO 860 ONE TIMESTAMPS THERE AND +11 OFFSET FOR AUSTRALIA I NEED MY ASSISTANT TO BE ABLE TO FOR EXAMPLE LIKE IF THE USER SAYS YEAH I'M IN NEW ZEALAND TIME I WANT 10 AM THAT WORKS FOR ME OBVIOUSLY WHEN CHECKING SLOTS IN AUSTRALIA BECAUSE NEW ZEALAND IS TWO HOURS AHEAD IT WOULD BE CHECKING FOR 8 AM. DO YOU UNDERSTAND BUT LIKE MY ASSISTANT FUMBLES I LIKE HALLUCINATES IT LIKE DOESN'T REALLY LIKE CHECK THE SLOTS LIKE VERY ORIGINALLY IT LIKE KIND OF FUMBLES OUT AND THEN LIKE I DON'T KNOW I DON'T KNOW HOW I CAN FIX THIS OR LIKE WHEN OFFERING SLOTS OBVIOUSLY IF IT'S IN THE USERTIME ZONE FOR EXAMPLE IF IT'S OFFERING LIKE LET'S JUST SAY I HAVE 5 PM AVAILABLE AND THEN THAT'S WHERE MY CUTOFF IS LIKE. I DON'T HAVE ANY TIMES AFTER 5 PM. IT OBVIOUSLY CAN'T SAY IF THE USE IS IN NEW ZEALAND TIME OH OK I HAVE 5 PM FOR YOU LIKE YES IT IS IN AUSTRALIAN TIBUT LIKE 5 PM IN AUSTRALIAN TIME WHICH ALL THE TIME ARE THEY ARE IN AUSTRALIAN TIME EQUATES TO LIKE 7 PM WHICH DOES NOT EXIST THEREFORE YOU'D SAY IT DOES NOT EXIST. THE CLOSEST AVAILABLE TIME WOULD BE 3 PM WHICH IS ESSENTIALLY 5 PM YOU KNOW, CAN YOU CREATE A RULE THAT I GUESS LIKE DOES THIS LIKE CAN YOU CREATE MY WHOLE PROM STRUCTURE KEEP IT COMPACT KEEP IT LIKEkeep it proving like obviously I want like proven that you are there RETELLAI bot so i want perfections create me time zone internal conversion capabiloty @AI Evy
a
Thanks for the follow-up, @hans_70884. I'll get back to you soon.
### Answer I understand your timezone conversion challenge. Based on the available sources, here's a structured approach to handle timezone conversions with Retell AI: ## Core Strategy 1. Capture User Timezone Early Use dynamic variables to store the user's timezone [(1) ]() . Add this to your agent prompt:
Copy code
At the start of every booking conversation, ask: "What timezone are you in?" and store the response in {{user_timezone}}.
2. Leverage System Variables for Reference Retell provides
{{current_time_[timezone]}}
system variables . For example: -
{{current_time_Australia/Sydney}}
gives current time in AEDT -
{{current_time_Pacific/Auckland}}
gives current time in NZDT 3. Create Explicit Conversion Rules in Your Prompt
Copy code
TIMEZONE CONVERSION RULES:
- All available slots from check_slots are in Australia/Sydney timezone (AEDT, UTC+11)
- When user specifies their timezone, you MUST convert their requested time to AEDT before checking slots
- Example: If user in Pacific/Auckland (UTC+13) requests 10 AM, check slots for 8 AM AEDT
- NEVER offer times that don't exist after conversion
- If 5 PM AEDT is the last slot and user is in Pacific/Auckland, the latest you can offer is 3 PM their time (= 5 PM AEDT)

CONVERSION PROCESS:
1. User states their timezone and desired time
2. Calculate the offset difference (e.g., NZDT is UTC+13, AEDT is UTC+11, difference = +2 hours)
3. Convert user's requested time to AEDT by subtracting the difference
4. Check available slots in AEDT
5. Present results back to user in THEIR timezone
4. Handle Edge Cases
This approach uses Retell's dynamic variable system [(1) ]() and system time variables to maintain timezone accuracy throughout the conversation.
Copy code
BOUNDARY RULES:
- If converted time falls outside available slots, inform user: "The closest available time in your timezone is [TIME], which is [TIME] AEDT"
- Always confirm both timezones: "I'm booking you for 10 AM New Zealand time, which is 8 AM Australian Eastern time. Does that work?"
## Community-Reported Issues to Avoid Users have reported timezone issues with Cal.com integration where times were being incorrectly converted [(2) ]() . The Cal.com v2 API provides outputs in UTC only, which requires manual timezone handling [(3) ]() . When using external booking systems, ensure you're handling the timezone parameter correctly in your tool calls [(2) ]() . ## Tool Configuration Structure your check_slots tool to: 1. Accept
user_timezone
as a parameter 2. Perform conversion logic server-side (recommended) or instruct the LLM explicitly 3. Return slots with clear timezone labels ## Prompt Structure Example
Copy code
You are a booking assistant handling appointments across multiple timezones.

CORE RULES:
- All internal slots are in Australia/Sydney (AEDT, UTC+11)
- Current time in AEDT: {{current_time_Australia/Sydney}}
- User timezone: {{user_timezone}}

WORKFLOW:
1. Capture user timezone if not already known
2. When user requests a time, convert to AEDT before checking availability
3. Present available times in user's timezone with AEDT confirmation
4. Never hallucinate availability - only offer times that exist after conversion

CONVERSION EXAMPLES:
- User in Pacific/Auckland (UTC+13) wants 10 AM → Check 8 AM AEDT slots
- User in America/Los_Angeles (UTC-8) wants 2 PM → Check 9 AM next day AEDT slots (19 hour difference)
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Booking time zone issue with cal.com](https://discord.com/channels/1186424376300679209/1432743087112851518) [[3] Discord message from @sanava.ai on 2024-11-06](https://discord.com/channels/1186424376300679209/1294891368505937952/1303839533699170424) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
h
create me the ultimate final prompt for me also when storing varibles do i just tell my assistant to stroe them and will it be sotred or do i have to crate something in my assistant, ok craet the prompt only neccasasry elements go craet it make it clear concise organised plz
create me the ultimate final prompt for me also when storing varibles do i just tell my assistant to stroe them and will it be sotred or do i have to crate something in my assistant, ok craet the prompt only neccasasry elements go craet it make it clear concise organised plz @AI Evy
a
Thanks for the follow-up, @hans_70884. I'll get back to you soon.
### Answer ## Variable Storage in Retell AI To store variables, you need to use the Extract Dynamic Variables tool [(1) ]() . You can't just tell the assistant to "store" variables in the prompt - you must configure the tool . ### How to Set Up Variable Extraction: 1. Add Extract Dynamic Variable Tool to your agent 2. Define each variable with: - Variable Name (e.g.,
user_timezone
) - Description (what the value should be) - Variable Type: Text, Number, Enum, or Boolean 3. Update your prompt to tell the agent when to extract variables --- ## Complete Timezone Booking Prompt
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) ​
Copy code
ROLE: Appointment booking assistant for Australian business (AEDT timezone)

TIMEZONE RULES:
- All available slots from check_slots are in Australia/Sydney (AEDT, UTC+11)
- Current AEDT time: {{current_time_Australia/Sydney}}
- User timezone: {{user_timezone}}

WORKFLOW:
1. Ask: "What timezone are you in?" (if {{user_timezone}} is empty)
2. Extract timezone using extract_user_timezone function
3. When user requests a time, convert to AEDT before checking slots
4. Only offer times that exist after conversion
5. Confirm booking in both timezones

CONVERSION LOGIC:
- Pacific/Auckland (NZDT, UTC+13) : User time MINUS 2 hours = AEDT
- America/Los_Angeles (PST, UTC-8) : User time PLUS 19 hours = AEDT next day
- Always calculate offset before checking availability

BOUNDARY HANDLING:
- Last available slot: 5:00 PM AEDT
- If user in NZDT requests 7:00 PM (= 5:00 PM AEDT) , say: "Latest available is 5:00 PM your time, which is 5:00 PM AEDT"
- If user in NZDT requests 8:00 PM (= 6:00 PM AEDT) , say: "That time isn't available. Latest is 5:00 PM your time (5:00 PM AEDT) "

CONFIRMATION FORMAT:
"I'm booking you for [USER_TIME] [USER_TIMEZONE], which is [AEDT_TIME] Australian Eastern time. Correct?"

NEVER:
- Hallucinate available times
- Offer slots outside business hours after conversion
- Skip timezone confirmation
--- ## Required Tool Configuration In your prompt, add:
Copy code
When user states their timezone, immediately call extract_user_timezone to store it.
This tells the agent when to invoke the Extract Dynamic Variables function . --- **
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @hans_70884. I'll get back to you soon.
h
@AI Evy so essentially, I saw these guys I'm pretty sure they were building off retail. Basically they would self schedule their AR to callback user at a given time and essentially what they would do is I don't know how they did it, but they would store a variable. I believe I'm guessing I'd be the only like feasible waythey stored like a variable somewhere. I'm scheduled a call back and then when the AI would call them back. It wouldn't mention a particular data for instance, if someone's birthday saying like, oh sorry it's just like I'm in the middle of like my birthday. Can I call you back? It'll be yeah yeah no worries. I'll call you back and then when it calls, the user back will be like hey how was your birthdor like lead off wherever like it would like branch where they last left off how would I do that? Just give me like the most feasible way to I guess like implement that what would you recommend or like? How do you reckon they did it?
a
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[2] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) [[3] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[4] Here is how that can be fixed](https://retell.discourse.group/t/here-is-how-that-can-be-fixed/23) [[5] 404 Error on Create a Phone Call](https://retell.discourse.group/t/404-error-on-create-a-phone-call/22) [[6] Update Call](https://docs.retellai.com/api-references/update-call) [[7] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
### Answer --- ## How to Build Callback Context Memory Here's the most feasible implementation using Retell AI: ### 1. Extract & Store Context During First Call Use the Extract Dynamic Variables tool to capture conversation context [(1) ]() [(2) ]() : Variables to extract: -
callback_reason
(Text) - Why they need a callback -
conversation_context
(Text) - What was being discussed -
user_situation
(Text) - Personal context (e.g., "birthday", "meeting", "busy") -
callback_time
(Text) - When to call back In your prompt:
Copy code
When user requests a callback, extract the following information using extract_callback_context:
- Why they need the callback
- What you were discussing
- Any personal situation they mentioned
- Their preferred callback time
### 2. Store Variables in Your Database Use a Custom Function to save this data to your system [(3) ]() : Create a custom function tool: - Name:
store_callback_context
- HTTP Method: POST - Endpoint: Your database API - Parameters:
Copy code
json
{
  "type": "object",
  "properties": {
    "user_phone": {
      "type": "string",
      "description": "User's phone number"
    },
    "callback_reason": {
      "type": "string",
      "description": "Reason for callback"
    },
    "conversation_context": {
      "type": "string",
      "description": "What was being discussed"
    },
    "user_situation": {
      "type": "string",
      "description": "Personal context mentioned"
    }
  }
}
## Complete Workflow 1. First Call: Agent extracts context using Extract Dynamic Variables tool [(1) ]() [(2) ]() 2. Store: Custom function saves context to your database [(3) ]() 3. Schedule: Create Phone Call API schedules callback with dynamic variables [(4) ]() [(5) ]() 4. Callback: Agent references stored context using
{{variable_name}}
syntax [(7) ]() 5. Natural Resume: Agent picks up conversation naturally based on context This approach leverages Retell's dynamic variable system to maintain conversation continuity across multiple calls. ---
### 3. Schedule the Callback Use the Create Phone Call API to schedule the outbound call [(4) ]() [(5) ]() :
Copy code
javascript
const phoneCallResponse = await client.call.createPhoneCall({
  from_number: '+14157774444',
  to_number: user_phone_number,
  override_agent_id: 'your_agent_id',
  retell_llm_dynamic_variables: {
    callback_reason: "birthday celebration",
    conversation_context: "discussing appointment scheduling",
    user_situation: "was celebrating birthday"
  }
}) ;
### 4. Reference Context in Callback Prompt Callback agent prompt:
Copy code
You are calling back {{user_name}} who requested a callback.

PREVIOUS CONTEXT:
- Callback reason: {{callback_reason}}
- What you were discussing: {{conversation_context}}
- User's situation: {{user_situation}}

GREETING STRATEGY:
- Reference their situation naturally: "Hey! How was your {{user_situation}}?"
- Resume where you left off: "I'm calling back about {{conversation_context}}"
- Don't repeat information they already provided

Example: "Hi {{user_name}}! How was your birthday? I'm calling back to continue our conversation about {{conversation_context}}."
### 5. Update Call Metadata You can also update call metadata after extraction using the Update Call API [(6) ]() :
Copy code
javascript
const callResponse = await client.call.update('call_id', {
  metadata: { 
    callback_scheduled: true,
    callback_context: "birthday celebration",
    last_topic: "appointment scheduling"
  }
}) ;
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.